diff options
| author | Jules Aguillon | 2022-05-08 16:38:44 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2022-05-08 16:55:03 +0200 |
| commit | b15ca662c2329fd638cbf74b097988c1be477cc8 (patch) | |
| tree | 54e9d2a31c7eb054129a74e9b8714f1fd8a38e4f /srcs/juloo.keyboard2/KeyboardData.java | |
| parent | 9a48acfe3e5ab8e7cf6b748a0764b96fbf4ff484 (diff) | |
| download | unexpected-keyboard-b15ca662c2329fd638cbf74b097988c1be477cc8.tar.gz unexpected-keyboard-b15ca662c2329fd638cbf74b097988c1be477cc8.zip | |
Better handling of removed keys and swipe geture
The "closest key" logic must be careful not to reveal keys removed by a
modifier.
Must check [_handler.onPointerSwipe] for every candidate values.
[selected_value] is changed back to [selected_direction].
This adds a new bug: When the direction change, the selected value might
not change but a vibration will be triggered anyway.
Diffstat (limited to 'srcs/juloo.keyboard2/KeyboardData.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 6274eb0..adbf790 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -195,7 +195,10 @@ class KeyboardData return new Key(key0, key1, key2, key3, key4, width * s, shift, edgekeys); } - private KeyValue getAtDirectionExact(int direction) + /* + * See Pointers.onTouchMove() for the represented direction. + */ + public KeyValue getAtDirection(int direction) { if (edgekeys) { @@ -229,25 +232,6 @@ class KeyboardData } return null; } - - /* - * Get the KeyValue at the given direction. In case of swipe (!= 0), get the - * nearest KeyValue that is not key0. See Pointers.onTouchMove() for the - * represented direction. - */ - public KeyValue getAtDirection(int direction) - { - if (direction == 0) - return key0; - KeyValue k; - for (int i = 0; i > -2; i = (~i>>31) - i) - { - k = getAtDirectionExact(Math.floorMod(direction + i - 1, 8) + 1); - if (k != null) - return k; - } - return null; - } } // Not using Function<KeyValue, KeyValue> to keep compatibility with Android 6. |
