Cleaup non-distinct multitouch related stuff

Change-Id: I09072267217caad2513f83b61d7db1c6d74e18d1
main
Tadashi G. Takaoka 2012-11-01 13:04:49 +09:00
parent 01f6a61e51
commit 13ae76d7a3
3 changed files with 17 additions and 31 deletions

View File

@ -30,7 +30,6 @@ import com.android.inputmethod.keyboard.KeyboardLayoutSet.KeyboardLayoutSetExcep
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
import com.android.inputmethod.keyboard.internal.KeyboardState;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.DebugSettings;
import com.android.inputmethod.latin.ImfUtils;
import com.android.inputmethod.latin.InputView;
import com.android.inputmethod.latin.LatinIME;
@ -69,7 +68,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private AudioAndHapticFeedbackManager mFeedbackManager;
private SubtypeSwitcher mSubtypeSwitcher;
private SharedPreferences mPrefs;
private boolean mForceNonDistinctMultitouch;
private InputView mCurrentInputView;
private MainKeyboardView mKeyboardView;
@ -109,8 +107,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
mState = new KeyboardState(this);
setContextThemeWrapper(latinIme, getKeyboardTheme(latinIme, prefs));
mForceNonDistinctMultitouch = prefs.getBoolean(
DebugSettings.FORCE_NON_DISTINCT_MULTITOUCH_KEY, false);
}
private static KeyboardTheme getKeyboardTheme(Context context, SharedPreferences prefs) {
@ -341,10 +337,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
return mKeyboardView != null && mKeyboardView.getPointerCount() == 1;
}
public boolean hasDistinctMultitouch() {
return mKeyboardView != null && mKeyboardView.hasDistinctMultitouch();
}
/**
* Updates state machine to figure out when to automatically switch back to the previous mode.
*/
@ -371,9 +363,6 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
// TODO: Should use LAYER_TYPE_SOFTWARE when hardware acceleration is off?
}
mKeyboardView.setKeyboardActionListener(mLatinIME);
if (mForceNonDistinctMultitouch) {
mKeyboardView.setDistinctMultitouch(false);
}
// This always needs to be set since the accessibility state can
// potentially change without the input view being re-created.

View File

@ -19,6 +19,7 @@ package com.android.inputmethod.keyboard;
import android.animation.AnimatorInflater;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
@ -28,6 +29,7 @@ import android.graphics.Paint.Align;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Message;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@ -47,6 +49,7 @@ import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.SuddenJumpingTouchEventHandler;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.DebugSettings;
import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
@ -142,7 +145,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
private final SuddenJumpingTouchEventHandler mTouchScreenRegulator;
protected KeyDetector mKeyDetector;
private boolean mHasDistinctMultitouch;
private final boolean mHasDistinctMultitouch;
private int mOldPointerCount = 1;
private Key mOldKey;
@ -359,8 +362,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
mTouchScreenRegulator = new SuddenJumpingTouchEventHandler(getContext(), this);
mHasDistinctMultitouch = context.getPackageManager()
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final boolean forceNonDistinctMultitouch = prefs.getBoolean(
DebugSettings.FORCE_NON_DISTINCT_MULTITOUCH_KEY, false);
final boolean hasDistinctMultitouch = context.getPackageManager()
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
mHasDistinctMultitouch = hasDistinctMultitouch && !forceNonDistinctMultitouch;
final Resources res = getResources();
final boolean needsPhantomSuddenMoveEventHack = Boolean.parseBoolean(
ResourceUtils.getDeviceOverrideValue(res,
@ -510,18 +517,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
PointerTracker.setGestureHandlingEnabledByUser(gestureHandlingEnabledByUser);
}
/**
* Returns whether the device has distinct multi-touch panel.
* @return true if the device has distinct multi-touch panel.
*/
public boolean hasDistinctMultitouch() {
return mHasDistinctMultitouch;
}
public void setDistinctMultitouch(final boolean hasDistinctMultitouch) {
mHasDistinctMultitouch = hasDistinctMultitouch;
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();

View File

@ -686,6 +686,11 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
return (sPointerTrackerQueue == null) ? 1 : sPointerTrackerQueue.size();
}
private static boolean isOldestTrackerInQueue(final PointerTracker tracker) {
return sPointerTrackerQueue == null
|| sPointerTrackerQueue.getOldestElement() == tracker;
}
private void mayStartBatchInput(final Key key) {
if (sInGesture || !mGestureStrokeWithPreviewPoints.isStartOfAGesture()) {
return;
@ -704,8 +709,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
mListener.onStartBatchInput();
}
mTimerProxy.cancelLongPressTimer();
final boolean isOldestTracker = sPointerTrackerQueue.getOldestElement() == this;
mDrawingProxy.showGesturePreviewTrail(this, isOldestTracker);
mDrawingProxy.showGesturePreviewTrail(this, isOldestTrackerInQueue(this));
}
private void mayUpdateBatchInput(final long eventTime, final Key key) {
@ -726,8 +730,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
}
}
final boolean isOldestTracker = sPointerTrackerQueue.getOldestElement() == this;
mDrawingProxy.showGesturePreviewTrail(this, isOldestTracker);
mDrawingProxy.showGesturePreviewTrail(this, isOldestTrackerInQueue(this));
}
private void mayEndBatchInput(final long eventTime) {
@ -743,8 +746,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
mListener.onEndBatchInput(sAggregratedPointers);
}
}
final boolean isOldestTracker = sPointerTrackerQueue.getOldestElement() == this;
mDrawingProxy.showGesturePreviewTrail(this, isOldestTracker);
mDrawingProxy.showGesturePreviewTrail(this, isOldestTrackerInQueue(this));
}
public void processMotionEvent(final int action, final int x, final int y, final long eventTime,