diff options
author | 2010-09-07 01:31:04 -0700 | |
---|---|---|
committer | 2010-09-07 01:31:04 -0700 | |
commit | 26aff8c62f61f18b1b9a40ce647984284a41c895 (patch) | |
tree | aa945aff353d7910bba92305ac9dbdb296dc8c87 /java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | |
parent | 0723056043adee17bc9b49b06a5ca7a81a804d16 (diff) | |
parent | 6252f468bc1306f71c9933f65b116dbbb5530de8 (diff) | |
download | latinime-26aff8c62f61f18b1b9a40ce647984284a41c895.tar.gz latinime-26aff8c62f61f18b1b9a40ce647984284a41c895.tar.xz latinime-26aff8c62f61f18b1b9a40ce647984284a41c895.zip |
Merge "Fixed extra periods when chording with shift and space" into gingerbread
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java index 1e95e8ac4..a0366c273 100644 --- a/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java +++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java @@ -1120,7 +1120,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx public boolean onTouchEvent(MotionEvent me) { final int pointerCount = me.getPointerCount(); final int action = me.getActionMasked(); - final long eventTime = me.getEventTime(); // TODO: cleanup this code into a multi-touch to single-touch event converter class? // If the device does not have distinct multi-touch support panel, ignore all multi-touch @@ -1139,24 +1138,32 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx return true; } + final long eventTime = me.getEventTime(); + final int index = me.getActionIndex(); + final int id = me.getPointerId(index); + final int x = (int)me.getX(index); + final int y = (int)me.getY(index); + // Needs to be called after the gesture detector gets a turn, as it may have // displayed the mini keyboard if (mMiniKeyboard != null) { - MotionEvent translated = generateMiniKeyboardMotionEvent(action, (int)me.getX(), - (int)me.getY(), eventTime); + MotionEvent translated = generateMiniKeyboardMotionEvent(action, x, y, eventTime); mMiniKeyboard.onTouchEvent(translated); translated.recycle(); return true; } if (mHandler.isInKeyRepeat()) { - // It'll be canceled if 2 or more keys are in action. Otherwise it will keep being in - // the key repeating mode while the key is being pressed. - if (pointerCount > 1) { - mHandler.cancelKeyRepeatTimer(); - } else if (action == MotionEvent.ACTION_MOVE) { + // It will keep being in the key repeating mode while the key is being pressed. + if (action == MotionEvent.ACTION_MOVE) { return true; } + final PointerTracker tracker = getPointerTracker(id); + // Key repeating timer will be canceled if 2 or more keys are in action, and current + // event (UP or DOWN) is non-modifier key. + if (pointerCount > 1 && !tracker.isModifier()) { + mHandler.cancelKeyRepeatTimer(); + } // Up event will pass through. } @@ -1166,9 +1173,6 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx if (!mHasDistinctMultitouch) { // Use only main (id=0) pointer tracker. PointerTracker tracker = getPointerTracker(0); - int index = me.getActionIndex(); - int x = (int)me.getX(index); - int y = (int)me.getY(index); int oldPointerCount = mOldPointerCount; if (pointerCount == 1 && oldPointerCount == 2) { // Multi-touch to single touch transition. @@ -1189,18 +1193,11 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx } if (action == MotionEvent.ACTION_MOVE) { - for (int index = 0; index < pointerCount; index++) { - int x = (int)me.getX(index); - int y = (int)me.getY(index); - int id = me.getPointerId(index); - PointerTracker tracker = getPointerTracker(id); - tracker.onMoveEvent(x, y, eventTime); + for (int i = 0; i < pointerCount; i++) { + PointerTracker tracker = getPointerTracker(me.getPointerId(i)); + tracker.onMoveEvent((int)me.getX(i), (int)me.getY(i), eventTime); } } else { - int index = me.getActionIndex(); - int x = (int)me.getX(index); - int y = (int)me.getY(index); - int id = me.getPointerId(index); PointerTracker tracker = getPointerTracker(id); switch (action) { case MotionEvent.ACTION_DOWN: |