From 82674ca81c40acbba4fb9b7113a9a8fe13afccc6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 2 Jun 2014 14:49:24 +0900 Subject: [PATCH] Fix to clear on hover visual cue Bug: 12491371 Change-Id: Ib7ca91ae73aa40e45ea5f6d4e53348a261a4b823 --- .../KeyboardAccessibilityDelegate.java | 30 +++++++++++-------- 1 file 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 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 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 * @param event The hover event. * @return key The key that the event 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 * @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 * @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 if (key != null) { onHoverMoveKey(key); } - setCurrentHoverKey(key); + setLastHoverKey(key); } /** @@ -214,7 +214,11 @@ public class KeyboardAccessibilityDelegate * @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 simulateTouchEvent(MotionEvent.ACTION_UP, event); onHoverExitKey(key); } - setCurrentHoverKey(null); + setLastHoverKey(null); } /**