diff options
| author | Jules Aguillon | 2025-03-10 23:41:51 +0100 |
|---|---|---|
| committer | GitHub | 2025-03-10 23:41:51 +0100 |
| commit | 9cfeb0f0c22dd649fcf32260925a5a84a731d1b3 (patch) | |
| tree | 447ceb35fe87b086ec7f75c0bee7addc4619a16c /srcs/juloo.keyboard2/Keyboard2.java | |
| parent | 5e77fa84cff5a55cc26f3e02e2823ad0ec845c51 (diff) | |
| download | unexpected-keyboard-9cfeb0f0c22dd649fcf32260925a5a84a731d1b3.tar.gz unexpected-keyboard-9cfeb0f0c22dd649fcf32260925a5a84a731d1b3.zip | |
Add a delay after a Keyevent key in a macro (#918)
* Construct a single handler
* Add a delay after a Keyevent key in a macro
Add a delay before sending the next key to avoid race conditions causing
keys to be handled in the wrong order. Notably, KeyEvent keys handling
is scheduled differently than the other edit functions.
Diffstat (limited to 'srcs/juloo.keyboard2/Keyboard2.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 6d3516d..02c062a 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.inputmethodservice.InputMethodService; import android.os.Build.VERSION; +import android.os.Handler; import android.os.IBinder; import android.text.InputType; import android.util.Log; @@ -38,6 +39,7 @@ public class Keyboard2 extends InputMethodService private ViewGroup _emojiPane = null; private ViewGroup _clipboard_pane = null; public int actionId; // Action performed by the Action key. + private Handler _handler; private Config _config; @@ -107,7 +109,8 @@ public class Keyboard2 extends InputMethodService { super.onCreate(); SharedPreferences prefs = DirectBootAwarePreferences.get_shared_preferences(this); - _keyeventhandler = new KeyEventHandler(getMainLooper(), this.new Receiver()); + _handler = new Handler(getMainLooper()); + _keyeventhandler = new KeyEventHandler(this.new Receiver()); Config.initGlobalConfig(prefs, getResources(), _keyeventhandler); prefs.registerOnSharedPreferenceChangeListener(this); _config = Config.globalConfig(); @@ -481,6 +484,11 @@ public class Keyboard2 extends InputMethodService { return Keyboard2.this.getCurrentInputConnection(); } + + public Handler getHandler() + { + return _handler; + } } private IBinder getConnectionToken() |
