diff options
author | 2010-11-09 11:57:41 -0800 | |
---|---|---|
committer | 2010-12-01 15:12:08 +0900 | |
commit | c0b5c9c43e5eb7a6ed768d56f462ca9ed5c5f913 (patch) | |
tree | 61d1a4c4a7a1a7eb57662a2f5c9da8c5000564f4 /java/src/com/android/inputmethod/latin/PointerTracker.java | |
parent | c2052373145d4664a361e3196aa334e2307d85be (diff) | |
download | latinime-c0b5c9c43e5eb7a6ed768d56f462ca9ed5c5f913.tar.gz latinime-c0b5c9c43e5eb7a6ed768d56f462ca9ed5c5f913.tar.xz latinime-c0b5c9c43e5eb7a6ed768d56f462ca9ed5c5f913.zip |
Key release event should be sent when finger sliding
This change is cherry-pick I1a020e3d from Gingerbread-MR
Bug: 3132881
Change-Id: I885eab7744369dfb841f9b34d210b6c2aef8f19a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/PointerTracker.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PointerTracker.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index 4d9133045..327fef107 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -301,19 +301,23 @@ public class PointerTracker { if (mKeyAlreadyProcessed) return; KeyState keyState = mKeyState; - int keyIndex = keyState.onMoveKey(x, y); - Key key = getKey(keyIndex); - if (key != null) { - if (keyState.getKeyIndex() == NOT_A_KEY) { + final int keyIndex = keyState.onMoveKey(x, y); + final Key oldKey = getKey(keyState.getKeyIndex()); + if (isValidKeyIndex(keyIndex)) { + if (oldKey == null) { keyState.onMoveToNewKey(keyIndex, x, y); startLongPressTimer(keyIndex); } else if (!isMinorMoveBounce(x, y, keyIndex)) { + if (mListener != null) + mListener.onRelease(oldKey.codes[0]); resetMultiTap(); keyState.onMoveToNewKey(keyIndex, x, y); startLongPressTimer(keyIndex); } } else { - if (keyState.getKeyIndex() != NOT_A_KEY) { + if (oldKey != null) { + if (mListener != null) + mListener.onRelease(oldKey.codes[0]); keyState.onMoveToNewKey(keyIndex, x ,y); mHandler.cancelLongPressTimers(); } else if (!isMinorMoveBounce(x, y, keyIndex)) { @@ -405,7 +409,7 @@ public class PointerTracker { private void showKeyPreviewAndUpdateKeyGraphics(int keyIndex) { updateKeyGraphics(keyIndex); // The modifier key, such as shift key, should not be shown as preview when multi-touch is - // supported. On thge other hand, if multi-touch is not supported, the modifier key should + // supported. On the other hand, if multi-touch is not supported, the modifier key should // be shown as preview. if (mHasDistinctMultitouch && isModifier()) { mProxy.showPreview(NOT_A_KEY, this); |