Fix bugs in key repeat logic

Bug: 2950714
Change-Id: I3110369c085f89ee1e8f7392a9a04a6b9e377ed4
main
Tadashi G. Takaoka 2010-08-26 10:32:50 +09:00
parent d900867b37
commit 0d098c514e
1 changed files with 8 additions and 6 deletions

View File

@ -1313,13 +1313,14 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
} }
if (mHandler.isInKeyRepeat()) { if (mHandler.isInKeyRepeat()) {
// Will keep being in the key repeating mode while the key is being pressed. It'll be // It'll be canceled if 2 or more keys are in action. Otherwise it will keep being in
// canceled otherwise. // the key repeating mode while the key is being pressed.
if (pointerCount == 1 && action == MotionEvent.ACTION_MOVE) { if (pointerCount > 1) {
return true;
} else {
mHandler.cancelKeyRepeatTimer(); mHandler.cancelKeyRepeatTimer();
} else if (action == MotionEvent.ACTION_MOVE) {
return true;
} }
// Up event will pass through.
} }
if (pointerCount != mOldPointerCount) { if (pointerCount != mOldPointerCount) {
@ -1415,6 +1416,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
boolean wasInKeyRepeat = mHandler.isInKeyRepeat();
mHandler.cancelKeyTimers(); mHandler.cancelKeyTimers();
mHandler.cancelPopupPreview(); mHandler.cancelPopupPreview();
if (mDebouncer.isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) { if (mDebouncer.isMinorMoveBounce(touchX, touchY, keyIndex, mCurrentKey)) {
@ -1431,7 +1433,7 @@ public class LatinKeyboardBaseView extends View implements View.OnClickListener
} }
showPreview(NOT_A_KEY); showPreview(NOT_A_KEY);
// If we're not on a repeating key (which sends on a DOWN event) // If we're not on a repeating key (which sends on a DOWN event)
if (!mMiniKeyboardOnScreen && !mAbortKey) { if (!wasInKeyRepeat && !mMiniKeyboardOnScreen && !mAbortKey) {
detectAndSendKey(mCurrentKey, touchX, touchY, eventTime); detectAndSendKey(mCurrentKey, touchX, touchY, eventTime);
} }
invalidateKey(keyIndex); invalidateKey(keyIndex);