From 53113cadd9654c827ae306905dae4d738dedf818 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 9 Jan 2022 20:26:06 +0100 Subject: Add the Action key It is placed on the top-right of the enter key on every layouts. It sends a special event (performEditorAction) instead of writing a newline. The "actionId" is passed through the EditorInfo object in an obfuscated way so it's not clear whether it's using the right one. --- srcs/juloo.keyboard2/Keyboard2View.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2View.java') diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index d0b1a6d..984920e 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -60,9 +60,18 @@ public class Keyboard2View extends View public void setKeyboard(KeyboardData kw) { if (!_config.shouldOfferSwitchingToNextInputMethod) - kw = kw.removeKeys(new KeyboardData.RemoveKeysByEvent(KeyValue.EVENT_CHANGE_METHOD)); + kw = kw.replaceKeys( + new KeyboardData.ReplaceKeysByEvent(KeyValue.EVENT_CHANGE_METHOD, null)); if (_config.key_flags_to_remove != 0) - kw = kw.removeKeys(new KeyboardData.RemoveKeysByFlags(_config.key_flags_to_remove)); + kw = kw.replaceKeys( + new KeyboardData.ReplaceKeysByFlags(_config.key_flags_to_remove, null)); + // Replace the action key to show the right label. + KeyValue action_key = null; + if (_config.actionLabel != null) + action_key = new KeyValue(_config.actionLabel, _config.actionLabel, + KeyValue.CHAR_NONE, KeyValue.EVENT_ACTION, KeyValue.FLAG_NOREPEAT); + kw = kw.replaceKeys( + new KeyboardData.ReplaceKeysByEvent(KeyValue.EVENT_ACTION, action_key)); _keyboard = kw; reset(); } -- cgit v1.2.3