Loading java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +10 −9 Original line number Diff line number Diff line Loading @@ -254,11 +254,13 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, startKeyRepeatTimer(REPEAT_INTERVAL, msg.arg1, tracker); break; } case MSG_LONGPRESS_KEY: openPopupIfRequired(msg.arg1); case MSG_LONGPRESS_KEY: { final PointerTracker tracker = (PointerTracker)msg.obj; openPopupIfRequired(msg.arg1, tracker); break; } } } public void popupPreview(long delay, int keyIndex, PointerTracker tracker) { removeMessages(MSG_POPUP_PREVIEW); Loading Loading @@ -299,9 +301,9 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, return mInKeyRepeat; } public void startLongPressTimer(int keyIndex, long delay) { public void startLongPressTimer(long delay, int keyIndex, PointerTracker tracker) { removeMessages(MSG_LONGPRESS_KEY); sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0), delay); sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0, tracker), delay); } public void cancelLongPressTimer() { Loading Loading @@ -962,16 +964,15 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop()); } private boolean openPopupIfRequired(int keyIndex) { private boolean openPopupIfRequired(int keyIndex, PointerTracker tracker) { // Check if we have a popup layout specified first. if (mPopupLayout == 0) { return false; } if (keyIndex < 0 || keyIndex >= mKeys.length) { return false; } Key popupKey = mKeys[keyIndex]; Key popupKey = tracker.getKey(keyIndex); if (popupKey == null) return false; boolean result = onLongPress(popupKey); if (result) { dismissKeyPreview(); Loading java/src/com/android/inputmethod/latin/PointerTracker.java +23 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.ViewConfiguration; public class PointerTracker { private static final String TAG = "PointerTracker"; private static final boolean DEBUG = false; private static final boolean DEBUG_MOVE = true && DEBUG; public interface UIProxy { public void invalidateKey(Key key); Loading Loading @@ -155,12 +156,12 @@ public class PointerTracker { repeatKey(keyIndex); mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex, this); } mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } showKeyPreviewAndUpdateKey(keyIndex); updateMoveDebouncing(touchX, touchY); if (DEBUG) Log.d(TAG, "onDownEvent: [" + mPointerId + "] modifier=" + isModifier()); debugLog("onDownEvent:", touchX, touchY); } public void onMoveEvent(int touchX, int touchY, long eventTime) { Loading @@ -169,7 +170,7 @@ public class PointerTracker { if (mCurrentKey == NOT_A_KEY) { updateTimeDebouncing(eventTime); mCurrentKey = keyIndex; mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } else if (isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) { updateTimeDebouncing(eventTime); } else { Loading @@ -177,7 +178,7 @@ public class PointerTracker { resetTimeDebouncing(eventTime, mCurrentKey); resetMoveDebouncing(); mCurrentKey = keyIndex; mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } } else { mHandler.cancelLongPressTimer(); Loading @@ -190,11 +191,13 @@ public class PointerTracker { */ showKeyPreviewAndUpdateKey(isMinorTimeBounce() ? mLastKey : mCurrentKey); updateMoveDebouncing(touchX, touchY); if (DEBUG_MOVE) debugLog("onMoveEvent:", touchX, touchY); } public void onUpEvent(int touchX, int touchY, long eventTime) { if (DEBUG) Log.d(TAG, "onUpEvent: [" + mPointerId + "] modifier=" + isModifier()); debugLog("onUpEvent :", touchX, touchY); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null); boolean wasInKeyRepeat = mHandler.isInKeyRepeat(); mHandler.cancelKeyTimers(); Loading Loading @@ -222,7 +225,7 @@ public class PointerTracker { public void onCancelEvent(int touchX, int touchY, long eventTime) { if (DEBUG) Log.d(TAG, "onCancelEvent: [" + mPointerId + "]"); debugLog("onCancelEvt:", touchX, touchY); mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); mProxy.dismissPopupKeyboard(); Loading Loading @@ -412,4 +415,18 @@ public class PointerTracker { resetMultiTap(); } } private void debugLog(String title, int x, int y) { Key key = getKey(mCurrentKey); final String code; if (key == null) { code = "----"; } else { int primaryCode = key.codes[0]; code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode); } Log.d(TAG, String.format("%s [%d] %d,%d %s %s", title, mPointerId, x, y, code, isModifier() ? "modifier" : "")); } } No newline at end of file Loading
java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +10 −9 Original line number Diff line number Diff line Loading @@ -254,11 +254,13 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, startKeyRepeatTimer(REPEAT_INTERVAL, msg.arg1, tracker); break; } case MSG_LONGPRESS_KEY: openPopupIfRequired(msg.arg1); case MSG_LONGPRESS_KEY: { final PointerTracker tracker = (PointerTracker)msg.obj; openPopupIfRequired(msg.arg1, tracker); break; } } } public void popupPreview(long delay, int keyIndex, PointerTracker tracker) { removeMessages(MSG_POPUP_PREVIEW); Loading Loading @@ -299,9 +301,9 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, return mInKeyRepeat; } public void startLongPressTimer(int keyIndex, long delay) { public void startLongPressTimer(long delay, int keyIndex, PointerTracker tracker) { removeMessages(MSG_LONGPRESS_KEY); sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0), delay); sendMessageDelayed(obtainMessage(MSG_LONGPRESS_KEY, keyIndex, 0, tracker), delay); } public void cancelLongPressTimer() { Loading Loading @@ -962,16 +964,15 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener, key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop()); } private boolean openPopupIfRequired(int keyIndex) { private boolean openPopupIfRequired(int keyIndex, PointerTracker tracker) { // Check if we have a popup layout specified first. if (mPopupLayout == 0) { return false; } if (keyIndex < 0 || keyIndex >= mKeys.length) { return false; } Key popupKey = mKeys[keyIndex]; Key popupKey = tracker.getKey(keyIndex); if (popupKey == null) return false; boolean result = onLongPress(popupKey); if (result) { dismissKeyPreview(); Loading
java/src/com/android/inputmethod/latin/PointerTracker.java +23 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.ViewConfiguration; public class PointerTracker { private static final String TAG = "PointerTracker"; private static final boolean DEBUG = false; private static final boolean DEBUG_MOVE = true && DEBUG; public interface UIProxy { public void invalidateKey(Key key); Loading Loading @@ -155,12 +156,12 @@ public class PointerTracker { repeatKey(keyIndex); mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex, this); } mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } showKeyPreviewAndUpdateKey(keyIndex); updateMoveDebouncing(touchX, touchY); if (DEBUG) Log.d(TAG, "onDownEvent: [" + mPointerId + "] modifier=" + isModifier()); debugLog("onDownEvent:", touchX, touchY); } public void onMoveEvent(int touchX, int touchY, long eventTime) { Loading @@ -169,7 +170,7 @@ public class PointerTracker { if (mCurrentKey == NOT_A_KEY) { updateTimeDebouncing(eventTime); mCurrentKey = keyIndex; mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } else if (isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) { updateTimeDebouncing(eventTime); } else { Loading @@ -177,7 +178,7 @@ public class PointerTracker { resetTimeDebouncing(eventTime, mCurrentKey); resetMoveDebouncing(); mCurrentKey = keyIndex; mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); mHandler.startLongPressTimer(LONGPRESS_TIMEOUT, keyIndex, this); } } else { mHandler.cancelLongPressTimer(); Loading @@ -190,11 +191,13 @@ public class PointerTracker { */ showKeyPreviewAndUpdateKey(isMinorTimeBounce() ? mLastKey : mCurrentKey); updateMoveDebouncing(touchX, touchY); if (DEBUG_MOVE) debugLog("onMoveEvent:", touchX, touchY); } public void onUpEvent(int touchX, int touchY, long eventTime) { if (DEBUG) Log.d(TAG, "onUpEvent: [" + mPointerId + "] modifier=" + isModifier()); debugLog("onUpEvent :", touchX, touchY); int keyIndex = mKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null); boolean wasInKeyRepeat = mHandler.isInKeyRepeat(); mHandler.cancelKeyTimers(); Loading Loading @@ -222,7 +225,7 @@ public class PointerTracker { public void onCancelEvent(int touchX, int touchY, long eventTime) { if (DEBUG) Log.d(TAG, "onCancelEvent: [" + mPointerId + "]"); debugLog("onCancelEvt:", touchX, touchY); mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); mProxy.dismissPopupKeyboard(); Loading Loading @@ -412,4 +415,18 @@ public class PointerTracker { resetMultiTap(); } } private void debugLog(String title, int x, int y) { Key key = getKey(mCurrentKey); final String code; if (key == null) { code = "----"; } else { int primaryCode = key.codes[0]; code = String.format((primaryCode < 0) ? "%4d" : "0x%02x", primaryCode); } Log.d(TAG, String.format("%s [%d] %d,%d %s %s", title, mPointerId, x, y, code, isModifier() ? "modifier" : "")); } } No newline at end of file