am 03eba092: Merge "Use MoreKeysDetector for accessibility"
* commit '03eba0927dfb82c890c0745840bc6098240c04d4': Use MoreKeysDetector for accessibilitymain
commit
6b3592183e
|
@ -23,7 +23,6 @@ import android.view.MotionEvent;
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
import com.android.inputmethod.keyboard.KeyDetector;
|
import com.android.inputmethod.keyboard.KeyDetector;
|
||||||
import com.android.inputmethod.keyboard.MoreKeysKeyboardView;
|
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
|
* This class represents a delegate that can be registered in {@link MoreKeysKeyboardView} to
|
||||||
|
@ -107,8 +106,7 @@ public class MoreKeysKeyboardAccessibilityDelegate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Close the more keys keyboard.
|
// Close the more keys keyboard.
|
||||||
mKeyboardView.onMoveEvent(
|
mKeyboardView.dismissMoreKeysPanel();
|
||||||
Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, pointerId, eventTime);
|
|
||||||
sendWindowStateChanged(mCloseAnnounceResId);
|
sendWindowStateChanged(mCloseAnnounceResId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import com.android.inputmethod.latin.utils.CoordinateUtils;
|
||||||
public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel {
|
public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel {
|
||||||
private final int[] mCoordinates = CoordinateUtils.newInstance();
|
private final int[] mCoordinates = CoordinateUtils.newInstance();
|
||||||
|
|
||||||
protected KeyDetector mKeyDetector;
|
protected final KeyDetector mKeyDetector;
|
||||||
private Controller mController = EMPTY_CONTROLLER;
|
private Controller mController = EMPTY_CONTROLLER;
|
||||||
protected KeyboardActionListener mListener;
|
protected KeyboardActionListener mListener;
|
||||||
private int mOriginX;
|
private int mOriginX;
|
||||||
|
@ -72,13 +72,10 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
||||||
@Override
|
@Override
|
||||||
public void setKeyboard(final Keyboard keyboard) {
|
public void setKeyboard(final Keyboard keyboard) {
|
||||||
super.setKeyboard(keyboard);
|
super.setKeyboard(keyboard);
|
||||||
|
mKeyDetector.setKeyboard(
|
||||||
|
keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection());
|
||||||
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
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) {
|
if (mAccessibilityDelegate == null) {
|
||||||
mKeyDetector = new KeyDetector();
|
|
||||||
mAccessibilityDelegate = new MoreKeysKeyboardAccessibilityDelegate(
|
mAccessibilityDelegate = new MoreKeysKeyboardAccessibilityDelegate(
|
||||||
this, mKeyDetector);
|
this, mKeyDetector);
|
||||||
mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_keys_keyboard);
|
mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_keys_keyboard);
|
||||||
|
@ -86,12 +83,8 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
||||||
}
|
}
|
||||||
mAccessibilityDelegate.setKeyboard(keyboard);
|
mAccessibilityDelegate.setKeyboard(keyboard);
|
||||||
} else {
|
} else {
|
||||||
mKeyDetector = new MoreKeysDetector(getResources().getDimension(
|
|
||||||
R.dimen.config_more_keys_keyboard_slide_allowance));
|
|
||||||
mAccessibilityDelegate = null;
|
mAccessibilityDelegate = null;
|
||||||
}
|
}
|
||||||
mKeyDetector.setKeyboard(
|
|
||||||
keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue