abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Keyboard2View.java
diff options
context:
space:
mode:
authorJules Aguillon2022-01-09 20:26:06 +0100
committerJules Aguillon2022-01-09 20:26:06 +0100
commit53113cadd9654c827ae306905dae4d738dedf818 (patch)
treefe56afe810939608893fd82732e9f7f29105a563 /srcs/juloo.keyboard2/Keyboard2View.java
parent4b43645c4b6632d0cd2388b90e7bc2bbde98087e (diff)
downloadunexpected-keyboard-53113cadd9654c827ae306905dae4d738dedf818.tar.gz
unexpected-keyboard-53113cadd9654c827ae306905dae4d738dedf818.zip
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.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java13
1 files changed, 11 insertions, 2 deletions
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();
}