diff options
author | 2010-09-02 04:31:57 -0700 | |
---|---|---|
committer | 2010-09-02 04:31:57 -0700 | |
commit | 6b4d521fb486f2762eee1a7ebf3c5e285d3aa83e (patch) | |
tree | e7d7fe284ecaef9cc7c0b5d818837800e699d74f /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | |
parent | 83c6069b986e11fd88caead1e5bbeb5e82d105a2 (diff) | |
parent | 3d4123fabb51a0c929401d98fca496759a5aa0d6 (diff) | |
download | latinime-6b4d521fb486f2762eee1a7ebf3c5e285d3aa83e.tar.gz latinime-6b4d521fb486f2762eee1a7ebf3c5e285d3aa83e.tar.xz latinime-6b4d521fb486f2762eee1a7ebf3c5e285d3aa83e.zip |
Merge "Add PointerTracker argument to long press related methods" into gingerbread
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 30042d8a1..14b8143a9 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -254,9 +254,11 @@ 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; + } } } @@ -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() { @@ -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(); |