opt(ui): js beautifier supports formatting xml

This commit is contained in:
hyb1996
2018-09-13 11:07:19 +08:00
parent 23f817f4e3
commit ccf85fe2f5
7 changed files with 121 additions and 36 deletions

View File

@@ -211,6 +211,9 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
if (content != null) {
setInitialText(content);
} else {
if (path == null) {
return;
}
mFile = new File(path);
if (mName == null) {
mName = mFile.getName();
@@ -279,11 +282,11 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
private void initNormalToolbar() {
mNormalToolbar.setOnMenuItemClickListener(this);
mNormalToolbar.setOnMenuItemLongClickListener(id -> {
if(id == R.id.run){
debug();
return true;
}
return false;
if (id == R.id.run) {
debug();
return true;
}
return false;
});
Fragment fragment = getActivity().getSupportFragmentManager().findFragmentById(R.id.toolbar_menu);
if (fragment == null) {
@@ -388,7 +391,7 @@ public class EditorView extends FrameLayout implements CodeCompletionBar.OnHintC
}
public ScriptExecution run(boolean showMessage) {
if(showMessage){
if (showMessage) {
Snackbar.make(this, R.string.text_start_running, Snackbar.LENGTH_SHORT).show();
}
ScriptExecution execution = Scripts.runWithBroadcastSender(mFile);

View File

@@ -80,7 +80,7 @@ public class CodeEditor extends HVScrollView {
mTextViewRedoUndo = new TextViewUndoRedo(mCodeEditText);
mJavaScriptHighlighter = new JavaScriptHighlighter(mTheme, mCodeEditText);
setTheme(Theme.getDefault(getContext()));
mJsBeautifier = new JsBeautifier(this, "js/beautify.js");
mJsBeautifier = new JsBeautifier(this, "js/js-beautify");
}