diff options
author | 2010-08-30 20:18:55 +0900 | |
---|---|---|
committer | 2010-08-31 00:43:40 +0900 | |
commit | ba9b24edffa15cf664acfddd1abd86ef8dddb021 (patch) | |
tree | 7cc82f1c1f889a5390d2077e8ebf2e34c39a747c /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | |
parent | 06123e56912b5dcd7aca3d0c18c7ceb1f1cde573 (diff) | |
download | latinime-ba9b24edffa15cf664acfddd1abd86ef8dddb021.tar.gz latinime-ba9b24edffa15cf664acfddd1abd86ef8dddb021.tar.xz latinime-ba9b24edffa15cf664acfddd1abd86ef8dddb021.zip |
Remove mAbortKey flag completely
These three conditions assign true to the mAbortKey flag.
1. setKeyboard() sets the new keyboard layout.
2. long press shows the pop-up mini keyboard.
3. ACTION_CANCEL event is occurred.
In the case 1, in LatinIME so far, only "symbol key" and "language
switch" cause keyboard layout change. In both cases, the event is
occurred in onUpEvent(), so we do not need to worry about aborting
event.
In the case 2, long press is used only to pop-up mini-keyboard and at that
time mMiniKeyboardOnScreen could be used as a flag.
In the case 3, though I'm not sure when this case occurs, in
onCancelEvent() all the things that should be canceled are canceled
in onCancelEvent().
Bug: 2910379
Change-Id: I12377c5f3e808f1c017ce980e12b1513895047bc
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 95794f7cc..d9fa9f2a2 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -212,8 +212,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener private final ProximityKeyDetector mProximityKeyDetector = new ProximityKeyDetector(); - private boolean mAbortKey; - // For multi-tap private int mLastSentIndex; private int mTapCount; @@ -628,10 +626,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener invalidateAllKeys(); computeProximityThreshold(keyboard); mMiniKeyboardCache.clear(); - // Not really necessary to do every time, but will free up views - // Switching to a different keyboard should abort any pending keys so that the key up - // doesn't get delivered to the old or new keyboard - mAbortKey = true; // Until the next ACTION_DOWN } /** @@ -1124,7 +1118,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener Key popupKey = mKeys[keyIndex]; boolean result = onLongPress(popupKey); if (result) { - mAbortKey = true; showPreview(NOT_A_KEY); } return result; @@ -1239,13 +1232,8 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener // Track the last few movements to look for spurious swipes. mSwipeTracker.addMovement(me); - // Ignore all motion events until a DOWN. - if (mAbortKey - && action != MotionEvent.ACTION_DOWN && action != MotionEvent.ACTION_CANCEL) { - return true; - } - - if (mGestureDetector.onTouchEvent(me)) { + // We must disable gesture detector while mini-keyboard is on the screen. + if (!mMiniKeyboardOnScreen && mGestureDetector.onTouchEvent(me)) { showPreview(NOT_A_KEY); mHandler.cancelKeyTimers(); return true; @@ -1315,7 +1303,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener private void onDownEvent(int touchX, int touchY, long eventTime) { int keyIndex = mProximityKeyDetector.getKeyIndexAndNearbyCodes(touchX, touchY, null); - mAbortKey = false; mCurrentKey = keyIndex; mStartX = touchX; mStartY = touchY; @@ -1326,11 +1313,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener if (keyIndex >= 0 && mKeys[keyIndex].repeatable) { repeatKey(keyIndex); mHandler.startKeyRepeatTimer(REPEAT_START_DELAY, keyIndex); - // Delivering the key could have caused an abort - if (mAbortKey) { - mHandler.cancelKeyRepeatTimer(); - return; - } } if (keyIndex != NOT_A_KEY) { mHandler.startLongPressTimer(keyIndex, LONGPRESS_TIMEOUT); @@ -1387,7 +1369,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener } showPreview(NOT_A_KEY); // If we're not on a repeating key (which sends on a DOWN event) - if (!wasInKeyRepeat && !mMiniKeyboardOnScreen && !mAbortKey) { + if (!wasInKeyRepeat && !mMiniKeyboardOnScreen) { detectAndSendKey(mCurrentKey, touchX, touchY, eventTime); } invalidateKey(keyIndex); @@ -1397,7 +1379,6 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener mHandler.cancelKeyTimers(); mHandler.cancelPopupPreview(); dismissPopupKeyboard(); - mAbortKey = true; showPreview(NOT_A_KEY); invalidateKey(mCurrentKey); } |