Remove unnecessary default KeyDetector from PointerTracker
Change-Id: Ib0fbb40a7040202d2a4b4ab49319d9e247a2a6cemain
parent
dbb88e47c8
commit
921a32f0a9
|
@ -230,8 +230,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
|||
mKeyDetector = new KeyDetector(
|
||||
keyHysteresisDistance, keyHysteresisDistanceForSlidingModifier);
|
||||
|
||||
PointerTracker.init(mainKeyboardViewAttr, mKeyTimerHandler, this /* DrawingProxy */,
|
||||
mKeyDetector);
|
||||
PointerTracker.init(mainKeyboardViewAttr, mKeyTimerHandler, this /* DrawingProxy */);
|
||||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final boolean forceNonDistinctMultitouch = prefs.getBoolean(
|
||||
|
@ -240,7 +239,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
|||
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT)
|
||||
&& !forceNonDistinctMultitouch;
|
||||
mNonDistinctMultitouchHelper = hasDistinctMultitouch ? null
|
||||
: new NonDistinctMultitouchHelper(PointerTracker.getPointerTracker(0));
|
||||
: new NonDistinctMultitouchHelper();
|
||||
|
||||
final int backgroundDimAlpha = mainKeyboardViewAttr.getInt(
|
||||
R.styleable.MainKeyboardView_backgroundDimAlpha, 0);
|
||||
|
@ -431,7 +430,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
|||
mKeyDetector.setKeyboard(
|
||||
keyboard, -getPaddingLeft(), -getPaddingTop() + getVerticalCorrection());
|
||||
PointerTracker.setKeyDetector(mKeyDetector);
|
||||
PointerTracker.setKeyboardActionListener(mKeyboardActionListener);
|
||||
mMoreKeysKeyboardCache.clear();
|
||||
|
||||
mSpaceKey = keyboard.getKey(Constants.CODE_SPACE);
|
||||
|
|
|
@ -155,10 +155,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
|||
|
||||
private static DrawingProxy sDrawingProxy;
|
||||
private static TimerProxy sTimerProxy;
|
||||
private static KeyDetector sDefaultKeyDetector;
|
||||
private KeyDetector mKeyDetector;
|
||||
private static KeyboardActionListener sListener = KeyboardActionListener.EMPTY_LISTENER;
|
||||
|
||||
// The {@link KeyDetector} is set whenever the down event is processed. Also this is updated
|
||||
// when new {@link Keyboard} is set by {@link #setKeyDetector(KeyDetector)}.
|
||||
private KeyDetector mKeyDetector;
|
||||
private Keyboard mKeyboard;
|
||||
private int mPhantomSuddenMoveThreshold;
|
||||
private final BogusMoveEventDetector mBogusMoveEventDetector = new BogusMoveEventDetector();
|
||||
|
@ -344,7 +345,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
|||
|
||||
// TODO: Add PointerTrackerFactory singleton and move some class static methods into it.
|
||||
public static void init(final TypedArray mainKeyboardViewAttr, final TimerProxy timerProxy,
|
||||
final DrawingProxy drawingProxy, final KeyDetector defaultKeyDetector) {
|
||||
final DrawingProxy drawingProxy) {
|
||||
sParams = new PointerTrackerParams(mainKeyboardViewAttr);
|
||||
sGestureStrokeParams = new GestureStrokeParams(mainKeyboardViewAttr);
|
||||
sGesturePreviewParams = new GestureStrokePreviewParams(mainKeyboardViewAttr);
|
||||
|
@ -358,7 +359,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
|||
|
||||
sTimerProxy = timerProxy;
|
||||
sDrawingProxy = drawingProxy;
|
||||
sDefaultKeyDetector = defaultKeyDetector;
|
||||
}
|
||||
|
||||
private static void updateGestureHandlingMode() {
|
||||
|
@ -434,7 +434,6 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
|
|||
mPointerId = id;
|
||||
mGestureStrokeWithPreviewPoints = new GestureStrokeWithPreviewPoints(
|
||||
id, sGestureStrokeParams, sGesturePreviewParams);
|
||||
setKeyDetectorInner(sDefaultKeyDetector);
|
||||
}
|
||||
|
||||
// Returns true if keyboard has been changed by this callback.
|
||||
|
|
|
@ -27,16 +27,11 @@ import com.android.inputmethod.latin.utils.CoordinateUtils;
|
|||
public final class NonDistinctMultitouchHelper {
|
||||
private static final String TAG = NonDistinctMultitouchHelper.class.getSimpleName();
|
||||
|
||||
// Use only main (id=0) pointer tracker.
|
||||
private final PointerTracker mMainTracker;
|
||||
private static final int MAIN_POINTER_TRACKER_ID = 0;
|
||||
private int mOldPointerCount = 1;
|
||||
private Key mOldKey;
|
||||
private int[] mLastCoords = CoordinateUtils.newInstance();
|
||||
|
||||
public NonDistinctMultitouchHelper(final PointerTracker mainTracker) {
|
||||
mMainTracker = mainTracker;
|
||||
}
|
||||
|
||||
public void processMotionEvent(final MotionEvent me, final KeyDetector keyDetector) {
|
||||
final int pointerCount = me.getPointerCount();
|
||||
final int oldPointerCount = mOldPointerCount;
|
||||
|
@ -47,7 +42,9 @@ public final class NonDistinctMultitouchHelper {
|
|||
return;
|
||||
}
|
||||
|
||||
final PointerTracker mainTracker = mMainTracker;
|
||||
// Use only main pointer tracker.
|
||||
final PointerTracker mainTracker = PointerTracker.getPointerTracker(
|
||||
MAIN_POINTER_TRACKER_ID);
|
||||
final int action = me.getActionMasked();
|
||||
final int index = me.getActionIndex();
|
||||
final long eventTime = me.getEventTime();
|
||||
|
|
Loading…
Reference in New Issue