forked from extern/Unexpected-Keyboard
Add keys for every context menu actions
The most requested keys are undo and redo. Unfortunatly redo doesn't work reliably. The other context menu actions like share, assist and autofill are added even thought they are rarely useful or implemented.
This commit is contained in:
parent
764cd882d2
commit
e333eb06fd
@ -32,6 +32,13 @@
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="23"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="24"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="25"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="26"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="27"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="28"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="29"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="30"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="31"/>
|
||||
<juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="32"/>
|
||||
</PreferenceScreen>
|
||||
<ListPreference android:key="numpad_layout" android:title="@string/pref_numpad_layout" android:summary="%s" android:defaultValue="high_first" android:entries="@array/pref_numpad_layout_entries" android:entryValues="@array/pref_numpad_layout_values"/>
|
||||
</PreferenceCategory>
|
||||
|
@ -39,7 +39,14 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
|
||||
"copy",
|
||||
"paste",
|
||||
"cut",
|
||||
"select_all",
|
||||
"selectAll",
|
||||
"shareText",
|
||||
"pasteAsPlainText",
|
||||
"undo",
|
||||
"redo",
|
||||
"replaceText",
|
||||
"textAssist",
|
||||
"autofill",
|
||||
};
|
||||
|
||||
public static boolean default_checked(String name)
|
||||
|
@ -66,17 +66,30 @@ class KeyEventHandler implements Config.IKeyEventHandler
|
||||
case Modifier:
|
||||
break;
|
||||
case Editing:
|
||||
switch (key.getEditing())
|
||||
{
|
||||
case COPY: send_context_menu_action(android.R.id.copy); break;
|
||||
case PASTE: send_context_menu_action(android.R.id.paste); break;
|
||||
case CUT: send_context_menu_action(android.R.id.cut); break;
|
||||
case SELECT_ALL: send_context_menu_action(android.R.id.selectAll); break;
|
||||
}
|
||||
send_context_menu_action(action_of_editing_key(key.getEditing()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int action_of_editing_key(KeyValue.Editing e)
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
case COPY: return android.R.id.copy;
|
||||
case PASTE: return android.R.id.paste;
|
||||
case CUT: return android.R.id.cut;
|
||||
case SELECT_ALL: return android.R.id.selectAll;
|
||||
case SHARE: return android.R.id.shareText;
|
||||
case PASTE_PLAIN: return android.R.id.pasteAsPlainText;
|
||||
case UNDO: return android.R.id.undo;
|
||||
case REDO: return android.R.id.redo;
|
||||
case REPLACE: return android.R.id.replaceText;
|
||||
case ASSIST: return android.R.id.textAssist;
|
||||
case AUTOFILL: return android.R.id.autofill;
|
||||
default: return -1; // sad
|
||||
}
|
||||
}
|
||||
|
||||
// private void handleDelKey(int before, int after)
|
||||
// {
|
||||
// CharSequence selection = getCurrentInputConnection().getSelectedText(0);
|
||||
|
@ -58,6 +58,14 @@ final class KeyValue
|
||||
PASTE,
|
||||
CUT,
|
||||
SELECT_ALL,
|
||||
PASTE_PLAIN,
|
||||
UNDO,
|
||||
REDO,
|
||||
// Android context menu actions
|
||||
REPLACE,
|
||||
SHARE,
|
||||
ASSIST,
|
||||
AUTOFILL,
|
||||
}
|
||||
|
||||
public static enum Kind
|
||||
@ -356,7 +364,14 @@ final class KeyValue
|
||||
addEditingKey("copy", "copy", Editing.COPY);
|
||||
addEditingKey("paste", "paste", Editing.PASTE);
|
||||
addEditingKey("cut", "cut", Editing.CUT);
|
||||
addEditingKey("select_all", "s. all", Editing.SELECT_ALL);
|
||||
addEditingKey("selectAll", "s. all", Editing.SELECT_ALL);
|
||||
addEditingKey("shareText", "share", Editing.SHARE);
|
||||
addEditingKey("pasteAsPlainText", "<paste>", Editing.PASTE_PLAIN);
|
||||
addEditingKey("undo", "undo", Editing.UNDO);
|
||||
addEditingKey("redo", "redo", Editing.REDO);
|
||||
addEditingKey("replaceText", "repl.", Editing.REPLACE);
|
||||
addEditingKey("textAssist", "assist", Editing.ASSIST);
|
||||
addEditingKey("autofill", "auto.", Editing.AUTOFILL);
|
||||
}
|
||||
|
||||
static final HashMap<String, String> keys_descr = new HashMap<String, String>();
|
||||
|
Loading…
Reference in New Issue
Block a user