Fixed undo/redo keyboard

pull/214/head
M66B 12 months ago
parent 6483cf9d43
commit 534aad5e66

@ -79,6 +79,7 @@ public class EditTextCompose extends FixedEditText {
private int quoteGap; private int quoteGap;
private int quoteStripe; private int quoteStripe;
private boolean lt_description; private boolean lt_description;
private boolean undo_manager;
private int lastStart = -1; private int lastStart = -1;
private int lastEnd = -1; private int lastEnd = -1;
@ -108,7 +109,7 @@ public class EditTextCompose extends FixedEditText {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.lt_description = prefs.getBoolean("lt_description", false); this.lt_description = prefs.getBoolean("lt_description", false);
boolean undo_manager = prefs.getBoolean("undo_manager", false); this.undo_manager = prefs.getBoolean("undo_manager", false);
addTextChangedListener(new TextWatcher() { addTextChangedListener(new TextWatcher() {
private Integer replace; private Integer replace;
@ -326,9 +327,9 @@ public class EditTextCompose extends FixedEditText {
int id = item.getItemId(); int id = item.getItemId();
if (id == android.R.id.pasteAsPlainText) if (id == android.R.id.pasteAsPlainText)
return insertPlain(); return insertPlain();
else if (id == R.string.title_undo) else if (id == R.string.title_undo && undo_manager)
return EditTextCompose.super.onTextContextMenuItem(android.R.id.undo); return EditTextCompose.super.onTextContextMenuItem(android.R.id.undo);
else if (id == R.string.title_redo) else if (id == R.string.title_redo && undo_manager)
return EditTextCompose.super.onTextContextMenuItem(android.R.id.redo); return EditTextCompose.super.onTextContextMenuItem(android.R.id.redo);
else if (id == R.string.title_insert_line) else if (id == R.string.title_insert_line)
return insertLine(); return insertLine();
@ -632,10 +633,10 @@ public class EditTextCompose extends FixedEditText {
}); });
return true; return true;
} else if (id == android.R.id.undo) { } else if (id == android.R.id.undo && undo_manager) {
canUndo = true; canUndo = true;
return true; return true;
} else if (id == android.R.id.redo) { } else if (id == android.R.id.redo && undo_manager) {
canRedo = true; canRedo = true;
return true; return true;
} }

Loading…
Cancel
Save