Cancel long press timer when sliding key input is not allowed

This change also fixes auto snap back behavior of key which has output
text, such as smiley key.

Bug: 3297825
Change-Id: Ia06e1abc0fbdff2a26504ddcce1dc7f933b45453
main
Tadashi G. Takaoka 2010-12-19 20:27:11 +09:00
parent cc0e41222d
commit 5ef421b58a
3 changed files with 7 additions and 5 deletions

View File

@ -576,7 +576,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
break;
case AUTO_MODE_SWITCH_STATE_SYMBOL_BEGIN:
if (key != Keyboard.CODE_SPACE && key != Keyboard.CODE_ENTER && key > 0) {
if (key != Keyboard.CODE_SPACE && key != Keyboard.CODE_ENTER && key >= 0) {
mAutoModeSwitchState = AUTO_MODE_SWITCH_STATE_SYMBOL;
}
break;

View File

@ -296,6 +296,7 @@ public class PointerTracker {
// onRelease() first to notify that the previous key has been released, then call
// onPress() to notify that the new key is being pressed.
callListenerOnRelease(oldKey.mCodes[0]);
mHandler.cancelLongPressTimers();
if (mIsAllowedSlidingKeyInput) {
resetMultiTap();
callListenerOnPress(getKey(keyIndex).mCodes[0]);
@ -312,10 +313,10 @@ public class PointerTracker {
// The pointer has been slid out from the previous key, we must call onRelease() to
// notify that the previous key has been released.
callListenerOnRelease(oldKey.mCodes[0]);
mHandler.cancelLongPressTimers();
if (mIsAllowedSlidingKeyInput) {
resetMultiTap();
keyState.onMoveToNewKey(keyIndex, x ,y);
mHandler.cancelLongPressTimers();
} else {
setAlreadyProcessed();
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
@ -332,10 +333,10 @@ public class PointerTracker {
if (DEBUG_EVENT)
printTouchEvent("onUpEvent :", x, y, eventTime);
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
if (mKeyAlreadyProcessed)
return;
mHandler.cancelKeyTimers();
mHandler.cancelPopupPreview();
if (mKeyAlreadyProcessed)
return;
final PointerTrackerKeyState keyState = mKeyState;
int keyIndex = keyState.onUpKey(x, y);
if (isMinorMoveBounce(x, y, keyIndex)) {
@ -438,7 +439,7 @@ public class PointerTracker {
}
if (key.mOutputText != null) {
callListenerOnText(key.mOutputText);
callListenerOnRelease(NOT_A_KEY);
callListenerOnRelease(key.mCodes[0]);
} else {
int code = key.mCodes[0];
final int[] codes = mKeyDetector.newCodeArray();

View File

@ -1128,6 +1128,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
ic.commitText(text, 1);
ic.endBatchEdit();
mKeyboardSwitcher.updateShiftState();
mKeyboardSwitcher.onKey(0); // dummy key code.
mJustReverted = false;
mJustAddedAutoSpace = false;
mEnteredText = text;