diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 5d7f025..b585ba1 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -28,6 +28,10 @@
+
+
+
+
diff --git a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
index 9bfb614..f8e0d1e 100644
--- a/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
+++ b/srcs/juloo.keyboard2/ExtraKeyCheckBoxPreference.java
@@ -36,6 +36,10 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
"£",
"switch_greekmath",
"capslock",
+ "copy",
+ "paste",
+ "cut",
+ "select_all",
};
public static boolean default_checked(String name)
diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java
index ebf838c..9062555 100644
--- a/srcs/juloo.keyboard2/KeyEventHandler.java
+++ b/srcs/juloo.keyboard2/KeyEventHandler.java
@@ -65,6 +65,15 @@ class KeyEventHandler implements Config.IKeyEventHandler
break;
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;
+ }
+ break;
}
}
@@ -137,6 +146,15 @@ class KeyEventHandler implements Config.IKeyEventHandler
_autocap.typed(text);
}
+ /** See {!InputConnection.performContextMenuAction}. */
+ void send_context_menu_action(int id)
+ {
+ InputConnection conn = _recv.getCurrentInputConnection();
+ if (conn == null)
+ return;
+ conn.performContextMenuAction(id);
+ }
+
public static interface IReceiver
{
public void switchToNextInputMethod();
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index df0d290..7215736 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -52,9 +52,17 @@ final class KeyValue
FN, // Must be placed last to be applied first
}
+ public static enum Editing
+ {
+ COPY,
+ PASTE,
+ CUT,
+ SELECT_ALL,
+ }
+
public static enum Kind
{
- Char, String, Keyevent, Event, Modifier
+ Char, String, Keyevent, Event, Modifier, Editing
}
// Behavior flags.
@@ -132,6 +140,12 @@ final class KeyValue
return Modifier.values()[(_code & VALUE_BITS)];
}
+ /** Defined only when [getKind() == Kind.Editing]. */
+ public Editing getEditing()
+ {
+ return Editing.values()[(_code & VALUE_BITS)];
+ }
+
/* Update the char and the symbol. */
public KeyValue withChar(char c)
{
@@ -247,6 +261,12 @@ final class KeyValue
addKeyeventKey(name, String.valueOf((char)symbol), code, flags | FLAG_KEY_FONT);
}
+ private static void addEditingKey(String name, String symbol, Editing action)
+ {
+ addKey(name, symbol, Kind.Editing, action.ordinal(),
+ FLAG_SPECIAL | FLAG_SECONDARY | FLAG_SMALLER_FONT);
+ }
+
// Within VALUE_BITS
private static int placeholder_unique_id = 0;
@@ -332,6 +352,11 @@ final class KeyValue
addPlaceholderKey("removed");
addPlaceholderKey("f11_placeholder");
addPlaceholderKey("f12_placeholder");
+
+ addEditingKey("copy", "copy", Editing.COPY);
+ addEditingKey("paste", "paste", Editing.PASTE);
+ addEditingKey("cut", "cut", Editing.CUT);
+ addEditingKey("select_all", "s. all", Editing.SELECT_ALL);
}
static final HashMap keys_descr = new HashMap();