Debug: insert arrow

This commit is contained in:
M66B 2022-03-03 13:19:33 +01:00
parent 374701f396
commit 5488b980b9
2 changed files with 18 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public class EditTextCompose extends FixedEditText {
if (undo_manager && can(android.R.id.redo)) if (undo_manager && can(android.R.id.redo))
menu.add(Menu.CATEGORY_SECONDARY, R.string.title_redo, 1002, getTitle(R.string.title_redo)); menu.add(Menu.CATEGORY_SECONDARY, R.string.title_redo, 1002, getTitle(R.string.title_redo));
menu.add(Menu.CATEGORY_SECONDARY, R.string.title_insert_line, 1003, R.string.title_insert_line); menu.add(Menu.CATEGORY_SECONDARY, R.string.title_insert_line, 1003, R.string.title_insert_line);
if (BuildConfig.DEBUG)
menu.add(Menu.CATEGORY_SECONDARY, R.string.title_insert_arrow, 1004, R.string.title_insert_arrow);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
@ -125,6 +127,8 @@ public class EditTextCompose extends FixedEditText {
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();
else if (id == R.string.title_insert_arrow)
return insertArrow();
} }
return false; return false;
} }
@ -167,6 +171,19 @@ public class EditTextCompose extends FixedEditText {
return false; return false;
} }
} }
private boolean insertArrow() {
int start = getSelectionStart();
if (start < 0)
return false;
Editable edit = getText();
if (edit == null)
return false;
edit.insert(start, " \u27f6 ");
return true;
}
}); });
} }
} }

View File

@ -1763,6 +1763,7 @@
<string name="title_undo">Undo</string> <string name="title_undo">Undo</string>
<string name="title_redo">Redo</string> <string name="title_redo">Redo</string>
<string name="title_insert_line">Insert line</string> <string name="title_insert_line">Insert line</string>
<string name="title_insert_arrow" translatable="false">Insert arrow</string>
<string name="title_add">Add</string> <string name="title_add">Add</string>
<string name="title_browse">Open with</string> <string name="title_browse">Open with</string>
<string name="title_info">Info</string> <string name="title_info">Info</string>