diff options
| author | Jules Aguillon | 2022-01-10 00:27:22 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2022-01-10 00:27:22 +0100 |
| commit | dfec26a93be8cc3bf605273a49a46223e2551cde (patch) | |
| tree | fd942a142fb5c84835079875092bc7cb95620bf8 /srcs/juloo.keyboard2/Keyboard2View.java | |
| parent | 53113cadd9654c827ae306905dae4d738dedf818 (diff) | |
| download | unexpected-keyboard-dfec26a93be8cc3bf605273a49a46223e2551cde.tar.gz unexpected-keyboard-dfec26a93be8cc3bf605273a49a46223e2551cde.zip | |
Swap the Enter and Action keys when needed
When IME_FLAG_NO_ENTER_ACTION is set.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2View.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2View.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java index 984920e..5e687d7 100644 --- a/srcs/juloo.keyboard2/Keyboard2View.java +++ b/srcs/juloo.keyboard2/Keyboard2View.java @@ -9,6 +9,7 @@ import android.os.Message; import android.os.Vibrator; import android.util.AttributeSet; import android.util.DisplayMetrics; +import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.widget.PopupWindow; @@ -68,10 +69,18 @@ public class Keyboard2View extends View // 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)); + } + if (_config.swapEnterActionKey && action_key != null) + kw = kw.replaceKeys( + new KeyboardData.ReplaceKeysByEvent2(KeyEvent.KEYCODE_ENTER, + action_key, KeyValue.EVENT_ACTION, + KeyValue.getKeyByName("enter"))); + else + kw = kw.replaceKeys( + new KeyboardData.ReplaceKeysByEvent(KeyValue.EVENT_ACTION, action_key)); _keyboard = kw; reset(); } |
