mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Allow empty files to be opened in editor (#33)
This commit is contained in:
@@ -220,7 +220,7 @@ public class EditorActivity extends StudioActivity implements FileTreeFragment.F
|
||||
mFileTreeFragment = FileTreeFragment.newInstance (this.mProject).setFileActionListener (this);
|
||||
mDaemonStatusFragment = new TextSheetFragment ().setTextSelectable (true);
|
||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle (this, mBinding.editorDrawerLayout, mBinding.editorToolbar, R.string.app_name, R.string.app_name);
|
||||
mBinding.editorDrawerLayout.setDrawerListener (toggle);
|
||||
mBinding.editorDrawerLayout.addDrawerListener (toggle);
|
||||
mBinding.startNav.setNavigationItemSelectedListener (this);
|
||||
toggle.syncState ();
|
||||
loadFragment (mFileTreeFragment);
|
||||
|
||||
@@ -92,7 +92,7 @@ public class FileTreeFragment extends BottomSheetDialogFragment implements TreeN
|
||||
public void onClick(TreeNode node, Object p2) {
|
||||
final File f = (File) p2;
|
||||
if(f.isFile()) {
|
||||
if (mFileActionListener != null && FileUtils.isUtf8(f)) {
|
||||
if (mFileActionListener != null && (FileUtils.isUtf8 (f) || f.length () == 0)) {
|
||||
mFileActionListener.openFile(f);
|
||||
}
|
||||
} else if(f.isDirectory() && f.exists()) {
|
||||
|
||||
@@ -22,6 +22,14 @@ import androidx.annotation.NonNull;
|
||||
import com.blankj.utilcode.util.ThrowableUtils;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingDeque;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
/**
|
||||
* Logger for the IDE.
|
||||
*
|
||||
@@ -54,6 +62,7 @@ public class Logger {
|
||||
|
||||
private Logger(String tag) {
|
||||
TAG = tag;
|
||||
|
||||
}
|
||||
|
||||
public Logger warn(Object... messages) {
|
||||
@@ -95,7 +104,7 @@ public class Logger {
|
||||
msg);
|
||||
sb.append(MSG_SEPARATOR);
|
||||
}
|
||||
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user