Move PointerTrackerQueue into PointerTracker
Bug: 4768084 Change-Id: I1be83b38c48147827c871c92e17d37da3aeb0f95main
parent
e0d3922ba3
commit
5c73ed628b
|
@ -37,11 +37,9 @@ import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
||||||
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
|
import com.android.inputmethod.keyboard.PointerTracker.DrawingProxy;
|
||||||
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
import com.android.inputmethod.keyboard.PointerTracker.TimerProxy;
|
||||||
import com.android.inputmethod.keyboard.internal.MiniKeyboardBuilder;
|
import com.android.inputmethod.keyboard.internal.MiniKeyboardBuilder;
|
||||||
import com.android.inputmethod.keyboard.internal.PointerTrackerQueue;
|
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
|
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,11 +72,6 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
/** Listener for {@link KeyboardActionListener}. */
|
/** Listener for {@link KeyboardActionListener}. */
|
||||||
private KeyboardActionListener mKeyboardActionListener;
|
private KeyboardActionListener mKeyboardActionListener;
|
||||||
|
|
||||||
private final ArrayList<PointerTracker> mPointerTrackers = new ArrayList<PointerTracker>();
|
|
||||||
|
|
||||||
// TODO: Let the PointerTracker class manage this pointer queue
|
|
||||||
private final PointerTrackerQueue mPointerQueue;
|
|
||||||
|
|
||||||
private final boolean mHasDistinctMultitouch;
|
private final boolean mHasDistinctMultitouch;
|
||||||
private int mOldPointerCount = 1;
|
private int mOldPointerCount = 1;
|
||||||
private int mOldKeyIndex;
|
private int mOldKeyIndex;
|
||||||
|
@ -251,7 +244,7 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
|
.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT);
|
||||||
mKeyRepeatInterval = res.getInteger(R.integer.config_key_repeat_interval);
|
mKeyRepeatInterval = res.getInteger(R.integer.config_key_repeat_interval);
|
||||||
|
|
||||||
mPointerQueue = mHasDistinctMultitouch ? new PointerTrackerQueue() : null;
|
PointerTracker.init(mHasDistinctMultitouch, getContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startIgnoringDoubleTap() {
|
public void startIgnoringDoubleTap() {
|
||||||
|
@ -261,9 +254,7 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
|
|
||||||
public void setKeyboardActionListener(KeyboardActionListener listener) {
|
public void setKeyboardActionListener(KeyboardActionListener listener) {
|
||||||
mKeyboardActionListener = listener;
|
mKeyboardActionListener = listener;
|
||||||
for (PointerTracker tracker : mPointerTrackers) {
|
PointerTracker.setKeyboardActionListener(listener);
|
||||||
tracker.setKeyboardActionListener(listener);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,17 +297,15 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
@Override
|
@Override
|
||||||
public void setKeyboard(Keyboard keyboard) {
|
public void setKeyboard(Keyboard keyboard) {
|
||||||
if (getKeyboard() != null) {
|
if (getKeyboard() != null) {
|
||||||
dismissAllKeyPreviews();
|
PointerTracker.dismissAllKeyPreviews();
|
||||||
}
|
}
|
||||||
// Remove any pending messages, except dismissing preview
|
// Remove any pending messages, except dismissing preview
|
||||||
mKeyTimerHandler.cancelKeyTimers();
|
mKeyTimerHandler.cancelKeyTimers();
|
||||||
super.setKeyboard(keyboard);
|
super.setKeyboard(keyboard);
|
||||||
mKeyDetector.setKeyboard(
|
mKeyDetector.setKeyboard(
|
||||||
keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection);
|
keyboard, -getPaddingLeft(), -getPaddingTop() + mVerticalCorrection);
|
||||||
for (PointerTracker tracker : mPointerTrackers) {
|
|
||||||
tracker.setKeyDetector(mKeyDetector);
|
|
||||||
}
|
|
||||||
mKeyDetector.setProximityThreshold(keyboard.getMostCommonKeyWidth());
|
mKeyDetector.setProximityThreshold(keyboard.getMostCommonKeyWidth());
|
||||||
|
PointerTracker.setKeyDetector(mKeyDetector);
|
||||||
mPopupPanelCache.clear();
|
mPopupPanelCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,14 +334,6 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
return mKeyDetector.isProximityCorrectionEnabled();
|
return mKeyDetector.isProximityCorrectionEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: clean up this method.
|
|
||||||
private void dismissAllKeyPreviews() {
|
|
||||||
for (PointerTracker tracker : mPointerTrackers) {
|
|
||||||
tracker.setReleasedKeyGraphics();
|
|
||||||
dismissKeyPreview(tracker);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cancelAllMessages() {
|
public void cancelAllMessages() {
|
||||||
mKeyTimerHandler.cancelAllMessages();
|
mKeyTimerHandler.cancelAllMessages();
|
||||||
|
@ -451,29 +432,14 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
}
|
}
|
||||||
|
|
||||||
private PointerTracker getPointerTracker(final int id) {
|
private PointerTracker getPointerTracker(final int id) {
|
||||||
final ArrayList<PointerTracker> pointers = mPointerTrackers;
|
return PointerTracker.getPointerTracker(id, this);
|
||||||
final KeyboardActionListener listener = mKeyboardActionListener;
|
|
||||||
|
|
||||||
// Create pointer trackers until we can get 'id+1'-th tracker, if needed.
|
|
||||||
for (int i = pointers.size(); i <= id; i++) {
|
|
||||||
final PointerTracker tracker =
|
|
||||||
new PointerTracker(i, getContext(), mKeyTimerHandler, mKeyDetector, this,
|
|
||||||
mPointerQueue);
|
|
||||||
if (listener != null)
|
|
||||||
tracker.setKeyboardActionListener(listener);
|
|
||||||
pointers.add(tracker);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pointers.get(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isInSlidingKeyInput() {
|
||||||
if (mPopupPanel != null) {
|
if (mPopupPanel != null) {
|
||||||
return true;
|
return true;
|
||||||
} else if (mPointerQueue != null) {
|
|
||||||
return mPointerQueue.isInSlidingKeyInput();
|
|
||||||
} else {
|
} else {
|
||||||
return getPointerTracker(0).isInSlidingKeyInput();
|
return PointerTracker.isAnyInSlidingKeyInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +465,7 @@ public class LatinKeyboardBaseView extends KeyboardView implements PointerTracke
|
||||||
// Gesture detector must be enabled only when mini-keyboard is not on the screen.
|
// Gesture detector must be enabled only when mini-keyboard is not on the screen.
|
||||||
if (mPopupPanel == null && mGestureDetector != null
|
if (mPopupPanel == null && mGestureDetector != null
|
||||||
&& mGestureDetector.onTouchEvent(me)) {
|
&& mGestureDetector.onTouchEvent(me)) {
|
||||||
dismissAllKeyPreviews();
|
PointerTracker.dismissAllKeyPreviews();
|
||||||
mKeyTimerHandler.cancelKeyTimers();
|
mKeyTimerHandler.cancelKeyTimers();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.android.inputmethod.latin.LatinImeLogger;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.SubtypeSwitcher;
|
import com.android.inputmethod.latin.SubtypeSwitcher;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -77,23 +78,24 @@ public class PointerTracker {
|
||||||
public void cancelKeyTimers();
|
public void cancelKeyTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int mPointerId;
|
private static KeyboardSwitcher sKeyboardSwitcher;
|
||||||
|
private static boolean sConfigSlidingKeyInputEnabled;
|
||||||
// Timing constants
|
// Timing constants
|
||||||
private final int mDelayBeforeKeyRepeatStart;
|
private static int sDelayBeforeKeyRepeatStart;
|
||||||
private final int mLongPressKeyTimeout;
|
private static int sLongPressKeyTimeout;
|
||||||
private final int mLongPressShiftKeyTimeout;
|
private static int sLongPressShiftKeyTimeout;
|
||||||
|
private static int sTouchNoiseThresholdMillis;
|
||||||
|
private static int sTouchNoiseThresholdDistanceSquared;
|
||||||
|
|
||||||
|
private static final List<PointerTracker> sTrackers = new ArrayList<PointerTracker>();
|
||||||
|
private static PointerTrackerQueue sPointerTrackerQueue;
|
||||||
|
|
||||||
|
public final int mPointerId;
|
||||||
|
|
||||||
private DrawingProxy mDrawingProxy;
|
private DrawingProxy mDrawingProxy;
|
||||||
private TimerProxy mTimerProxy;
|
private TimerProxy mTimerProxy;
|
||||||
private final PointerTrackerQueue mPointerTrackerQueue;
|
|
||||||
private KeyDetector mKeyDetector;
|
private KeyDetector mKeyDetector;
|
||||||
private KeyboardActionListener mListener = EMPTY_LISTENER;
|
private KeyboardActionListener mListener = EMPTY_LISTENER;
|
||||||
private final KeyboardSwitcher mKeyboardSwitcher;
|
|
||||||
private final boolean mConfigSlidingKeyInputEnabled;
|
|
||||||
|
|
||||||
private final int mTouchNoiseThresholdMillis;
|
|
||||||
private final int mTouchNoiseThresholdDistanceSquared;
|
|
||||||
|
|
||||||
private Keyboard mKeyboard;
|
private Keyboard mKeyboard;
|
||||||
private List<Key> mKeys;
|
private List<Key> mKeys;
|
||||||
|
@ -123,7 +125,7 @@ public class PointerTracker {
|
||||||
private boolean mIsRepeatableKey;
|
private boolean mIsRepeatableKey;
|
||||||
|
|
||||||
// true if this pointer is in sliding key input
|
// true if this pointer is in sliding key input
|
||||||
private boolean mIsInSlidingKeyInput;
|
boolean mIsInSlidingKeyInput;
|
||||||
|
|
||||||
// true if sliding key is allowed.
|
// true if sliding key is allowed.
|
||||||
private boolean mIsAllowedSlidingKeyInput;
|
private boolean mIsAllowedSlidingKeyInput;
|
||||||
|
@ -135,7 +137,7 @@ public class PointerTracker {
|
||||||
// true if this pointer is in sliding language switch
|
// true if this pointer is in sliding language switch
|
||||||
private boolean mIsInSlidingLanguageSwitch;
|
private boolean mIsInSlidingLanguageSwitch;
|
||||||
private int mSpaceKeyIndex;
|
private int mSpaceKeyIndex;
|
||||||
private final SubtypeSwitcher mSubtypeSwitcher;
|
private static SubtypeSwitcher sSubtypeSwitcher;
|
||||||
|
|
||||||
// Empty {@link KeyboardActionListener}
|
// Empty {@link KeyboardActionListener}
|
||||||
private static final KeyboardActionListener EMPTY_LISTENER = new KeyboardActionListener() {
|
private static final KeyboardActionListener EMPTY_LISTENER = new KeyboardActionListener() {
|
||||||
|
@ -151,31 +153,72 @@ public class PointerTracker {
|
||||||
public void onCancelInput() {}
|
public void onCancelInput() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
public PointerTracker(int id, Context context, TimerProxy timerProxy, KeyDetector keyDetector,
|
public static void init(boolean hasDistinctMultitouch, Context context) {
|
||||||
DrawingProxy drawingProxy, PointerTrackerQueue queue) {
|
if (hasDistinctMultitouch) {
|
||||||
if (drawingProxy == null || timerProxy == null || keyDetector == null)
|
sPointerTrackerQueue = new PointerTrackerQueue();
|
||||||
throw new NullPointerException();
|
} else {
|
||||||
mPointerId = id;
|
sPointerTrackerQueue = null;
|
||||||
mDrawingProxy = drawingProxy;
|
}
|
||||||
mTimerProxy = timerProxy;
|
|
||||||
mPointerTrackerQueue = queue; // This is null for non-distinct multi-touch device.
|
|
||||||
setKeyDetectorInner(keyDetector);
|
|
||||||
mKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
mConfigSlidingKeyInputEnabled = res.getBoolean(R.bool.config_sliding_key_input_enabled);
|
sConfigSlidingKeyInputEnabled = res.getBoolean(R.bool.config_sliding_key_input_enabled);
|
||||||
mDelayBeforeKeyRepeatStart = res.getInteger(R.integer.config_delay_before_key_repeat_start);
|
sDelayBeforeKeyRepeatStart = res.getInteger(R.integer.config_delay_before_key_repeat_start);
|
||||||
mLongPressKeyTimeout = res.getInteger(R.integer.config_long_press_key_timeout);
|
sLongPressKeyTimeout = res.getInteger(R.integer.config_long_press_key_timeout);
|
||||||
mLongPressShiftKeyTimeout = res.getInteger(R.integer.config_long_press_shift_key_timeout);
|
sLongPressShiftKeyTimeout = res.getInteger(R.integer.config_long_press_shift_key_timeout);
|
||||||
mTouchNoiseThresholdMillis = res.getInteger(R.integer.config_touch_noise_threshold_millis);
|
sTouchNoiseThresholdMillis = res.getInteger(R.integer.config_touch_noise_threshold_millis);
|
||||||
final float touchNoiseThresholdDistance = res.getDimension(
|
final float touchNoiseThresholdDistance = res.getDimension(
|
||||||
R.dimen.config_touch_noise_threshold_distance);
|
R.dimen.config_touch_noise_threshold_distance);
|
||||||
mTouchNoiseThresholdDistanceSquared = (int)(
|
sTouchNoiseThresholdDistanceSquared = (int)(
|
||||||
touchNoiseThresholdDistance * touchNoiseThresholdDistance);
|
touchNoiseThresholdDistance * touchNoiseThresholdDistance);
|
||||||
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
sKeyboardSwitcher = KeyboardSwitcher.getInstance();
|
||||||
|
sSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyboardActionListener(KeyboardActionListener listener) {
|
public static PointerTracker getPointerTracker(final int id, KeyEventHandler handler) {
|
||||||
mListener = listener;
|
final List<PointerTracker> trackers = sTrackers;
|
||||||
|
|
||||||
|
// Create pointer trackers until we can get 'id+1'-th tracker, if needed.
|
||||||
|
for (int i = trackers.size(); i <= id; i++) {
|
||||||
|
final PointerTracker tracker = new PointerTracker(i, handler);
|
||||||
|
trackers.add(tracker);
|
||||||
|
}
|
||||||
|
|
||||||
|
return trackers.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAnyInSlidingKeyInput() {
|
||||||
|
return sPointerTrackerQueue != null ? sPointerTrackerQueue.isAnyInSlidingKeyInput() : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setKeyboardActionListener(KeyboardActionListener listener) {
|
||||||
|
for (final PointerTracker tracker : sTrackers) {
|
||||||
|
tracker.mListener = listener;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setKeyDetector(KeyDetector keyDetector) {
|
||||||
|
for (final PointerTracker tracker : sTrackers) {
|
||||||
|
tracker.setKeyDetectorInner(keyDetector);
|
||||||
|
// Mark that keyboard layout has been changed.
|
||||||
|
tracker.mKeyboardLayoutHasBeenChanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void dismissAllKeyPreviews() {
|
||||||
|
for (final PointerTracker tracker : sTrackers) {
|
||||||
|
tracker.setReleasedKeyGraphics();
|
||||||
|
tracker.dismissKeyPreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointerTracker(int id, KeyEventHandler handler) {
|
||||||
|
if (handler == null)
|
||||||
|
throw new NullPointerException();
|
||||||
|
mPointerId = id;
|
||||||
|
setKeyDetectorInner(handler.getKeyDetector());
|
||||||
|
mListener = handler.getKeyboardActionListener();
|
||||||
|
mDrawingProxy = handler.getDrawingProxy();
|
||||||
|
mTimerProxy = handler.getTimerProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if keyboard has been changed by this callback.
|
// Returns true if keyboard has been changed by this callback.
|
||||||
|
@ -243,14 +286,6 @@ public class PointerTracker {
|
||||||
mKeyQuarterWidthSquared = keyQuarterWidth * keyQuarterWidth;
|
mKeyQuarterWidthSquared = keyQuarterWidth * keyQuarterWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyDetector(KeyDetector keyDetector) {
|
|
||||||
if (keyDetector == null)
|
|
||||||
throw new NullPointerException();
|
|
||||||
setKeyDetectorInner(keyDetector);
|
|
||||||
// Mark that keyboard layout has been changed.
|
|
||||||
mKeyboardLayoutHasBeenChanged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isInSlidingKeyInput() {
|
||||||
return mIsInSlidingKeyInput;
|
return mIsInSlidingKeyInput;
|
||||||
}
|
}
|
||||||
|
@ -365,11 +400,11 @@ public class PointerTracker {
|
||||||
setKeyDetectorInner(handler.getKeyDetector());
|
setKeyDetectorInner(handler.getKeyDetector());
|
||||||
// Naive up-to-down noise filter.
|
// Naive up-to-down noise filter.
|
||||||
final long deltaT = eventTime - mUpTime;
|
final long deltaT = eventTime - mUpTime;
|
||||||
if (deltaT < mTouchNoiseThresholdMillis) {
|
if (deltaT < sTouchNoiseThresholdMillis) {
|
||||||
final int dx = x - mLastX;
|
final int dx = x - mLastX;
|
||||||
final int dy = y - mLastY;
|
final int dy = y - mLastY;
|
||||||
final int distanceSquared = (dx * dx + dy * dy);
|
final int distanceSquared = (dx * dx + dy * dy);
|
||||||
if (distanceSquared < mTouchNoiseThresholdDistanceSquared) {
|
if (distanceSquared < sTouchNoiseThresholdDistanceSquared) {
|
||||||
if (DEBUG_MODE)
|
if (DEBUG_MODE)
|
||||||
Log.w(TAG, "onDownEvent: ignore potential noise: time=" + deltaT
|
Log.w(TAG, "onDownEvent: ignore potential noise: time=" + deltaT
|
||||||
+ " distance=" + distanceSquared);
|
+ " distance=" + distanceSquared);
|
||||||
|
@ -378,7 +413,7 @@ public class PointerTracker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final PointerTrackerQueue queue = mPointerTrackerQueue;
|
final PointerTrackerQueue queue = sPointerTrackerQueue;
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
if (isOnModifierKey(x, y)) {
|
if (isOnModifierKey(x, y)) {
|
||||||
// Before processing a down event of modifier key, all pointers already being
|
// Before processing a down event of modifier key, all pointers already being
|
||||||
|
@ -394,7 +429,7 @@ public class PointerTracker {
|
||||||
int keyIndex = onDownKey(x, y, eventTime);
|
int keyIndex = onDownKey(x, y, eventTime);
|
||||||
// Sliding key is allowed when 1) enabled by configuration, 2) this pointer starts sliding
|
// Sliding key is allowed when 1) enabled by configuration, 2) this pointer starts sliding
|
||||||
// from modifier key, or 3) this pointer is on mini-keyboard.
|
// from modifier key, or 3) this pointer is on mini-keyboard.
|
||||||
mIsAllowedSlidingKeyInput = mConfigSlidingKeyInputEnabled || isModifierInternal(keyIndex)
|
mIsAllowedSlidingKeyInput = sConfigSlidingKeyInputEnabled || isModifierInternal(keyIndex)
|
||||||
|| mKeyDetector instanceof MiniKeyboardKeyDetector;
|
|| mKeyDetector instanceof MiniKeyboardKeyDetector;
|
||||||
mKeyboardLayoutHasBeenChanged = false;
|
mKeyboardLayoutHasBeenChanged = false;
|
||||||
mKeyAlreadyProcessed = false;
|
mKeyAlreadyProcessed = false;
|
||||||
|
@ -495,8 +530,8 @@ public class PointerTracker {
|
||||||
else if (isSpaceKey(keyIndex) && !mIsInSlidingLanguageSwitch
|
else if (isSpaceKey(keyIndex) && !mIsInSlidingLanguageSwitch
|
||||||
&& mKeyboard instanceof LatinKeyboard) {
|
&& mKeyboard instanceof LatinKeyboard) {
|
||||||
final LatinKeyboard keyboard = ((LatinKeyboard)mKeyboard);
|
final LatinKeyboard keyboard = ((LatinKeyboard)mKeyboard);
|
||||||
if (mSubtypeSwitcher.useSpacebarLanguageSwitcher()
|
if (sSubtypeSwitcher.useSpacebarLanguageSwitcher()
|
||||||
&& mSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1) {
|
&& sSubtypeSwitcher.getEnabledKeyboardLocaleCount() > 1) {
|
||||||
final int diff = x - mKeyX;
|
final int diff = x - mKeyX;
|
||||||
if (keyboard.shouldTriggerSpacebarSlidingLanguageSwitch(diff)) {
|
if (keyboard.shouldTriggerSpacebarSlidingLanguageSwitch(diff)) {
|
||||||
// Detect start sliding language switch.
|
// Detect start sliding language switch.
|
||||||
|
@ -505,7 +540,7 @@ public class PointerTracker {
|
||||||
keyboard.updateSpacebarPreviewIcon(diff);
|
keyboard.updateSpacebarPreviewIcon(diff);
|
||||||
// Display spacebar slide language switcher.
|
// Display spacebar slide language switcher.
|
||||||
showKeyPreview(keyIndex);
|
showKeyPreview(keyIndex);
|
||||||
final PointerTrackerQueue queue = mPointerTrackerQueue;
|
final PointerTrackerQueue queue = sPointerTrackerQueue;
|
||||||
if (queue != null)
|
if (queue != null)
|
||||||
queue.releaseAllPointersExcept(this, eventTime, true);
|
queue.releaseAllPointersExcept(this, eventTime, true);
|
||||||
}
|
}
|
||||||
|
@ -533,7 +568,7 @@ public class PointerTracker {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
printTouchEvent("onUpEvent :", x, y, eventTime);
|
printTouchEvent("onUpEvent :", x, y, eventTime);
|
||||||
|
|
||||||
final PointerTrackerQueue queue = mPointerTrackerQueue;
|
final PointerTrackerQueue queue = sPointerTrackerQueue;
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
if (isModifier()) {
|
if (isModifier()) {
|
||||||
// Before processing an up event of modifier key, all pointers already being
|
// Before processing an up event of modifier key, all pointers already being
|
||||||
|
@ -600,7 +635,7 @@ public class PointerTracker {
|
||||||
mKeyAlreadyProcessed = true;
|
mKeyAlreadyProcessed = true;
|
||||||
setReleasedKeyGraphics();
|
setReleasedKeyGraphics();
|
||||||
dismissKeyPreview();
|
dismissKeyPreview();
|
||||||
final PointerTrackerQueue queue = mPointerTrackerQueue;
|
final PointerTrackerQueue queue = sPointerTrackerQueue;
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
queue.remove(this);
|
queue.remove(this);
|
||||||
}
|
}
|
||||||
|
@ -610,7 +645,7 @@ public class PointerTracker {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
printTouchEvent("onCancelEvt:", x, y, eventTime);
|
printTouchEvent("onCancelEvt:", x, y, eventTime);
|
||||||
|
|
||||||
final PointerTrackerQueue queue = mPointerTrackerQueue;
|
final PointerTrackerQueue queue = sPointerTrackerQueue;
|
||||||
if (queue != null) {
|
if (queue != null) {
|
||||||
queue.releaseAllPointersExcept(this, eventTime, true);
|
queue.releaseAllPointersExcept(this, eventTime, true);
|
||||||
queue.remove(this);
|
queue.remove(this);
|
||||||
|
@ -631,7 +666,7 @@ public class PointerTracker {
|
||||||
if (key != null && key.mRepeatable) {
|
if (key != null && key.mRepeatable) {
|
||||||
dismissKeyPreview();
|
dismissKeyPreview();
|
||||||
onRepeatKey(keyIndex);
|
onRepeatKey(keyIndex);
|
||||||
mTimerProxy.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this);
|
mTimerProxy.startKeyRepeatTimer(sDelayBeforeKeyRepeatStart, keyIndex, this);
|
||||||
mIsRepeatableKey = true;
|
mIsRepeatableKey = true;
|
||||||
} else {
|
} else {
|
||||||
mIsRepeatableKey = false;
|
mIsRepeatableKey = false;
|
||||||
|
@ -685,16 +720,16 @@ public class PointerTracker {
|
||||||
private void startLongPressTimer(int keyIndex) {
|
private void startLongPressTimer(int keyIndex) {
|
||||||
Key key = getKey(keyIndex);
|
Key key = getKey(keyIndex);
|
||||||
if (key.mCode == Keyboard.CODE_SHIFT) {
|
if (key.mCode == Keyboard.CODE_SHIFT) {
|
||||||
mTimerProxy.startLongPressShiftTimer(mLongPressShiftKeyTimeout, keyIndex, this);
|
mTimerProxy.startLongPressShiftTimer(sLongPressShiftKeyTimeout, keyIndex, this);
|
||||||
} else if (key.hasUppercaseLetter() && mKeyboard.isManualTemporaryUpperCase()) {
|
} else if (key.hasUppercaseLetter() && mKeyboard.isManualTemporaryUpperCase()) {
|
||||||
// We need not start long press timer on the key which has manual temporary upper case
|
// We need not start long press timer on the key which has manual temporary upper case
|
||||||
// code defined and the keyboard is in manual temporary upper case mode.
|
// code defined and the keyboard is in manual temporary upper case mode.
|
||||||
return;
|
return;
|
||||||
} else if (mKeyboardSwitcher.isInMomentarySwitchState()) {
|
} else if (sKeyboardSwitcher.isInMomentarySwitchState()) {
|
||||||
// We use longer timeout for sliding finger input started from the symbols mode key.
|
// We use longer timeout for sliding finger input started from the symbols mode key.
|
||||||
mTimerProxy.startLongPressTimer(mLongPressKeyTimeout * 3, keyIndex, this);
|
mTimerProxy.startLongPressTimer(sLongPressKeyTimeout * 3, keyIndex, this);
|
||||||
} else {
|
} else {
|
||||||
mTimerProxy.startLongPressTimer(mLongPressKeyTimeout, keyIndex, this);
|
mTimerProxy.startLongPressTimer(sLongPressKeyTimeout, keyIndex, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class PointerTrackerQueue {
|
||||||
mQueue.remove(tracker);
|
mQueue.remove(tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInSlidingKeyInput() {
|
public boolean isAnyInSlidingKeyInput() {
|
||||||
for (final PointerTracker tracker : mQueue) {
|
for (final PointerTracker tracker : mQueue) {
|
||||||
if (tracker.isInSlidingKeyInput())
|
if (tracker.isInSlidingKeyInput())
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue