From 1dbeb251b2570dd3025dcd7134090de0fc860d04 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 13 Jun 2014 11:15:38 +0900 Subject: [PATCH] Use MoreKeysDetector for accessibility A more keys keyboard may have a divider on it. The MoreKeysDetector should be used even with accessibility mode on to be able to handle a divider. Bug: 15583354 Change-Id: Ife2cf8304496c4c330127fde8ca1f34c2f0838e2 --- .../MoreKeysKeyboardAccessibilityDelegate.java | 4 +--- .../inputmethod/keyboard/MoreKeysKeyboardView.java | 13 +++---------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/java/src/com/android/inputmethod/accessibility/MoreKeysKeyboardAccessibilityDelegate.java b/java/src/com/android/inputmethod/accessibility/MoreKeysKeyboardAccessibilityDelegate.java index 3a56c5d2a..331c26786 100644 --- a/java/src/com/android/inputmethod/accessibility/MoreKeysKeyboardAccessibilityDelegate.java +++ b/java/src/com/android/inputmethod/accessibility/MoreKeysKeyboardAccessibilityDelegate.java @@ -23,7 +23,6 @@ import android.view.MotionEvent; import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.KeyDetector; import com.android.inputmethod.keyboard.MoreKeysKeyboardView; -import com.android.inputmethod.latin.Constants; /** * This class represents a delegate that can be registered in {@link MoreKeysKeyboardView} to @@ -107,8 +106,7 @@ public class MoreKeysKeyboardAccessibilityDelegate return; } // Close the more keys keyboard. - mKeyboardView.onMoveEvent( - Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, pointerId, eventTime); + mKeyboardView.dismissMoreKeysPanel(); sendWindowStateChanged(mCloseAnnounceResId); } } diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index 0f575d30c..68a11398c 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -35,7 +35,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils; public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel { private final int[] mCoordinates = CoordinateUtils.newInstance(); - protected KeyDetector mKeyDetector; + protected final KeyDetector mKeyDetector; private Controller mController = EMPTY_CONTROLLER; protected KeyboardActionListener mListener; private int mOriginX; @@ -72,13 +72,10 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel @Override public void setKeyboard(final Keyboard keyboard) { super.setKeyboard(keyboard); + mKeyDetector.setKeyboard( + keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection()); if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) { - // With accessibility mode on, any hover event outside {@link MoreKeysKeyboardView} is - // discarded at {@link InputView#dispatchHoverEvent(MotionEvent)}. Because only a hover - // event that is on this view is dispatched by the platform, we should use a - // {@link KeyDetector} that has no sliding allowance and no hysteresis. if (mAccessibilityDelegate == null) { - mKeyDetector = new KeyDetector(); mAccessibilityDelegate = new MoreKeysKeyboardAccessibilityDelegate( this, mKeyDetector); mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_keys_keyboard); @@ -86,12 +83,8 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel } mAccessibilityDelegate.setKeyboard(keyboard); } else { - mKeyDetector = new MoreKeysDetector(getResources().getDimension( - R.dimen.config_more_keys_keyboard_slide_allowance)); mAccessibilityDelegate = null; } - mKeyDetector.setKeyboard( - keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection()); } @Override