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
Tadashi G. Takaoka 2014-06-13 11:15:38 +09:00
parent c1cb930dde
commit 1dbeb251b2
2 changed files with 4 additions and 13 deletions

View File

@ -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);
}
}

View File

@ -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