diff options
author | 2010-12-18 18:48:32 +0900 | |
---|---|---|
committer | 2010-12-18 20:41:53 +0900 | |
commit | 67a4ecacc7525c9343cded13fc93e9a2381ea2d8 (patch) | |
tree | 183de5509ddf669890ac8ee4df3764925d581bdf /java/src | |
parent | c59009648c98eb5ce0e74efa4f4e6e23912d026d (diff) | |
download | latinime-67a4ecacc7525c9343cded13fc93e9a2381ea2d8.tar.gz latinime-67a4ecacc7525c9343cded13fc93e9a2381ea2d8.tar.xz latinime-67a4ecacc7525c9343cded13fc93e9a2381ea2d8.zip |
Disallow sliding key input
This feature is configurable by R.bool.config_sliding_key_input_enabled.
Bug: 3294076
Change-Id: I0225a6ce19d9b911c9d9543a106ab57ee0b7de75
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/PointerTracker.java | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java index 65c370dcd..c96cefd2b 100644 --- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java +++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java @@ -51,6 +51,7 @@ public class PointerTracker { private final KeyDetector mKeyDetector; private KeyboardActionListener mListener; private final boolean mHasDistinctMultitouch; + private final boolean mConfigSlidingKeyInputEnabled; private Keyboard mKeyboard; private Key[] mKeys; @@ -64,6 +65,9 @@ public class PointerTracker { // true if this pointer is repeatable key private boolean mIsRepeatableKey; + // true if sliding key is allowed. + private boolean mIsAllowedSlidingKeyInput; + // For multi-tap private int mLastSentIndex; private int mTapCount; @@ -173,6 +177,7 @@ public class PointerTracker { mKeyDetector = keyDetector; mKeyState = new KeyState(keyDetector); mHasDistinctMultitouch = proxy.hasDistinctMultitouch(); + mConfigSlidingKeyInputEnabled = res.getBoolean(R.bool.config_sliding_key_input_enabled); mDelayBeforeKeyRepeatStart = res.getInteger(R.integer.config_delay_before_key_repeat_start); mLongPressKeyTimeout = res.getInteger(R.integer.config_long_press_key_timeout); mLongPressShiftKeyTimeout = res.getInteger(R.integer.config_long_press_shift_key_timeout); @@ -277,6 +282,10 @@ public class PointerTracker { if (DEBUG) debugLog("onDownEvent:", x, y); int keyIndex = mKeyState.onDownKey(x, y, eventTime); + // Sliding key is allowed when 1) enabled by configuration, 2) this pointer starts sliding + // form modifier key, or 3) this pointer is on mini-keyboard. + mIsAllowedSlidingKeyInput = mConfigSlidingKeyInputEnabled || isModifierInternal(keyIndex) + || mKeyDetector instanceof MiniKeyboardKeyDetector; mKeyAlreadyProcessed = false; mIsRepeatableKey = false; checkMultiTap(eventTime, keyIndex); @@ -304,7 +313,7 @@ public class PointerTracker { debugLog("onMoveEvent:", x, y); if (mKeyAlreadyProcessed) return; - KeyState keyState = mKeyState; + final KeyState keyState = mKeyState; final int keyIndex = keyState.onMoveKey(x, y); final Key oldKey = getKey(keyState.getKeyIndex()); if (isValidKeyIndex(keyIndex)) { @@ -314,16 +323,28 @@ public class PointerTracker { } else if (!isMinorMoveBounce(x, y, keyIndex)) { if (mListener != null) mListener.onRelease(oldKey.mCodes[0]); - resetMultiTap(); - keyState.onMoveToNewKey(keyIndex, x, y); - startLongPressTimer(keyIndex); + if (mIsAllowedSlidingKeyInput) { + resetMultiTap(); + keyState.onMoveToNewKey(keyIndex, x, y); + startLongPressTimer(keyIndex); + } else { + setAlreadyProcessed(); + showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY); + return; + } } } else { if (oldKey != null) { if (mListener != null) mListener.onRelease(oldKey.mCodes[0]); - keyState.onMoveToNewKey(keyIndex, x ,y); - mHandler.cancelLongPressTimers(); + if (mIsAllowedSlidingKeyInput) { + keyState.onMoveToNewKey(keyIndex, x ,y); + mHandler.cancelLongPressTimers(); + } else { + setAlreadyProcessed(); + showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY); + return; + } } else if (!isMinorMoveBounce(x, y, keyIndex)) { resetMultiTap(); keyState.onMoveToNewKey(keyIndex, x ,y); |