diff options
author | 2010-09-02 01:35:24 +0900 | |
---|---|---|
committer | 2010-09-02 16:03:46 +0900 | |
commit | 40a05f62edc6cdedb4365a722b48a72826ef2bf6 (patch) | |
tree | 0ad4f8c12541831bdb60d5d9b85f168174a57bf5 /java/src/com/android/inputmethod/latin/PointerTracker.java | |
parent | f7d71c338f2585810ca2da95e7aee5c166b06ac2 (diff) | |
download | latinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.tar.gz latinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.tar.xz latinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.zip |
Queuing PointerTracker to support n-key roll-over and shift modifier.
Bug: 2910379
Change-Id: I5cfae33e72a406585137842a2260310813cee07f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/PointerTracker.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PointerTracker.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/PointerTracker.java b/java/src/com/android/inputmethod/latin/PointerTracker.java index c8976a372..10f51bd48 100644 --- a/java/src/com/android/inputmethod/latin/PointerTracker.java +++ b/java/src/com/android/inputmethod/latin/PointerTracker.java @@ -21,9 +21,13 @@ import com.android.inputmethod.latin.LatinKeyboardBaseView.UIHandler; import android.inputmethodservice.Keyboard; import android.inputmethodservice.Keyboard.Key; +import android.util.Log; import android.view.ViewConfiguration; public class PointerTracker { + private static final String TAG = "PointerTracker"; + private static final boolean DEBUG = false; + public interface UIProxy { public void invalidateKey(Key key); public void showPreview(int keyIndex, PointerTracker tracker); @@ -108,6 +112,15 @@ public class PointerTracker { return isValidKeyIndex(keyIndex) ? mKeys[keyIndex] : null; } + public boolean isModifier() { + Key key = getKey(mCurrentKey); + if (key == null) + return false; + int primaryCode = key.codes[0]; + // TODO: KEYCODE_MODE_CHANGE (symbol) will be also a modifier key + return primaryCode == Keyboard.KEYCODE_SHIFT; + } + public void updateKey(int keyIndex) { int oldKeyIndex = mPreviousKey; mPreviousKey = keyIndex; @@ -146,6 +159,8 @@ public class PointerTracker { } showKeyPreviewAndUpdateKey(keyIndex); updateMoveDebouncing(touchX, touchY); + if (DEBUG) + Log.d(TAG, "onDownEvent: [" + mPointerId + "] modifier=" + isModifier()); } public void onMoveEvent(int touchX, int touchY, long eventTime) { @@ -178,6 +193,8 @@ public class PointerTracker { } public void onUpEvent(int touchX, int touchY, long eventTime) { + if (DEBUG) + Log.d(TAG, "onUpEvent: [" + mPointerId + "] modifier=" + isModifier()); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null); boolean wasInKeyRepeat = mHandler.isInKeyRepeat(); mHandler.cancelKeyTimers(); @@ -204,6 +221,8 @@ public class PointerTracker { } public void onCancelEvent(int touchX, int touchY, long eventTime) { + if (DEBUG) + Log.d(TAG, "onCancelEvent: [" + mPointerId + "]"); mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); mProxy.dismissPopupKeyboard(); @@ -305,7 +324,8 @@ public class PointerTracker { private void showKeyPreviewAndUpdateKey(int keyIndex) { updateKey(keyIndex); - mProxy.showPreview(keyIndex, this); + if (!isModifier()) + mProxy.showPreview(keyIndex, this); } private void detectAndSendKey(int index, int x, int y, long eventTime) { |