From e76a9b36cabc3eb9222be245e2cf736169432cd6 Mon Sep 17 00:00:00 2001 From: alanv Date: Mon, 27 Aug 2012 18:05:21 -0700 Subject: [PATCH] Adjust accessibility edge slop. Bug: 6969558 Change-Id: Ie33f444e085e5c01326bdf9396eabee5c04ee81e --- java/res/values/dimens.xml | 3 +++ .../AccessibleKeyboardViewProxy.java | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index c59bad302..020d2a99a 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -101,4 +101,7 @@ 17.5dp 7.5dp 1.0dp + + + 8dp diff --git a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java index 2fff73154..e42de0b4c 100644 --- a/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java +++ b/java/src/com/android/inputmethod/accessibility/AccessibleKeyboardViewProxy.java @@ -24,7 +24,6 @@ import android.support.v4.view.accessibility.AccessibilityEventCompat; import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat; import android.view.MotionEvent; import android.view.View; -import android.view.ViewConfiguration; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Keyboard; @@ -44,7 +43,7 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { /** * Inset in pixels to look for keys when the user's finger exits the - * keyboard area. See {@link ViewConfiguration#getScaledEdgeSlop()}. + * keyboard area. */ private int mEdgeSlop; @@ -62,7 +61,8 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { private void initInternal(InputMethodService inputMethod) { mInputMethod = inputMethod; - mEdgeSlop = ViewConfiguration.get(inputMethod).getScaledEdgeSlop(); + mEdgeSlop = inputMethod.getResources().getDimensionPixelSize( + R.dimen.accessibility_edge_slop); } /** @@ -114,8 +114,14 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { public boolean dispatchHoverEvent(MotionEvent event, PointerTracker tracker) { final int x = (int) event.getX(); final int y = (int) event.getY(); - final Key key = tracker.getKeyOn(x, y); final Key previousKey = mLastHoverKey; + final Key key; + + if (pointInView(x, y)) { + key = tracker.getKeyOn(x, y); + } else { + key = null; + } mLastHoverKey = key; @@ -123,7 +129,7 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { case MotionEvent.ACTION_HOVER_EXIT: // Make sure we're not getting an EXIT event because the user slid // off the keyboard area, then force a key press. - if (pointInView(x, y) && (key != null)) { + if (key != null) { getAccessibilityNodeProvider().simulateKeyPress(key); } //$FALL-THROUGH$