diff options
author | 2014-06-02 14:49:24 +0900 | |
---|---|---|
committer | 2014-06-02 14:57:52 +0900 | |
commit | 82674ca81c40acbba4fb9b7113a9a8fe13afccc6 (patch) | |
tree | 985d5967714f62b99a45a6f1db4df50195248727 /java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java | |
parent | fa9b9578d44748de512c947651010e703c663936 (diff) | |
download | latinime-82674ca81c40acbba4fb9b7113a9a8fe13afccc6.tar.gz latinime-82674ca81c40acbba4fb9b7113a9a8fe13afccc6.tar.xz latinime-82674ca81c40acbba4fb9b7113a9a8fe13afccc6.zip |
Fix to clear on hover visual cue
Bug: 12491371
Change-Id: Ib7ca91ae73aa40e45ea5f6d4e53348a261a4b823
Diffstat (limited to 'java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java')
-rw-r--r-- | java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java index 7cae9861c..8ed019605 100644 --- a/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java +++ b/java/src/com/android/inputmethod/accessibility/KeyboardAccessibilityDelegate.java @@ -39,7 +39,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> protected final KeyDetector mKeyDetector; private Keyboard mKeyboard; private KeyboardAccessibilityNodeProvider mAccessibilityNodeProvider; - private Key mCurrentHoverKey; + private Key mLastHoverKey; public KeyboardAccessibilityDelegate(final KV keyboardView, final KeyDetector keyDetector) { super(); @@ -71,12 +71,12 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> return mKeyboard; } - protected final void setCurrentHoverKey(final Key key) { - mCurrentHoverKey = key; + protected final void setLastHoverKey(final Key key) { + mLastHoverKey = key; } - protected final Key getCurrentHoverKey() { - return mCurrentHoverKey; + protected final Key getLastHoverKey() { + return mLastHoverKey; } /** @@ -142,7 +142,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> * @param event The hover event. * @return key The key that the <code>event</code> is on. */ - protected final Key getHoverKey(final MotionEvent event) { + protected final Key getHoverKeyOf(final MotionEvent event) { final int actionIndex = event.getActionIndex(); final int x = (int)event.getX(actionIndex); final int y = (int)event.getY(actionIndex); @@ -179,11 +179,11 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> * @param event A hover enter event. */ protected void onHoverEnter(final MotionEvent event) { - final Key key = getHoverKey(event); + final Key key = getHoverKeyOf(event); if (key != null) { onHoverEnterKey(key); } - setCurrentHoverKey(key); + setLastHoverKey(key); } /** @@ -192,8 +192,8 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> * @param event A hover move event. */ protected void onHoverMove(final MotionEvent event) { - final Key previousKey = getCurrentHoverKey(); - final Key key = getHoverKey(event); + final Key previousKey = getLastHoverKey(); + final Key key = getHoverKeyOf(event); if (key != previousKey) { if (previousKey != null) { onHoverExitKey(previousKey); @@ -205,7 +205,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> if (key != null) { onHoverMoveKey(key); } - setCurrentHoverKey(key); + setLastHoverKey(key); } /** @@ -214,7 +214,11 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> * @param event A hover exit event. */ protected void onHoverExit(final MotionEvent event) { - final Key key = getHoverKey(event); + final Key lastKey = getLastHoverKey(); + if (lastKey != null) { + onHoverExitKey(lastKey); + } + final Key key = getHoverKeyOf(event); // Make sure we're not getting an EXIT event because the user slid // off the keyboard area, then force a key press. if (key != null) { @@ -222,7 +226,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView> simulateTouchEvent(MotionEvent.ACTION_UP, event); onHoverExitKey(key); } - setCurrentHoverKey(null); + setLastHoverKey(null); } /** |