From b15ca662c2329fd638cbf74b097988c1be477cc8 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 8 May 2022 16:38:44 +0200 Subject: 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. --- srcs/juloo.keyboard2/KeyboardData.java | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'srcs/juloo.keyboard2/KeyboardData.java') 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 to keep compatibility with Android 6. -- cgit v1.2.3