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: Ia06e1abc0fbdff2a26504ddcce1dc7f933b45453main
parent
cc0e41222d
commit
5ef421b58a
|
@ -576,7 +576,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AUTO_MODE_SWITCH_STATE_SYMBOL_BEGIN:
|
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;
|
mAutoModeSwitchState = AUTO_MODE_SWITCH_STATE_SYMBOL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -296,6 +296,7 @@ public class PointerTracker {
|
||||||
// onRelease() first to notify that the previous key has been released, then call
|
// onRelease() first to notify that the previous key has been released, then call
|
||||||
// onPress() to notify that the new key is being pressed.
|
// onPress() to notify that the new key is being pressed.
|
||||||
callListenerOnRelease(oldKey.mCodes[0]);
|
callListenerOnRelease(oldKey.mCodes[0]);
|
||||||
|
mHandler.cancelLongPressTimers();
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedSlidingKeyInput) {
|
||||||
resetMultiTap();
|
resetMultiTap();
|
||||||
callListenerOnPress(getKey(keyIndex).mCodes[0]);
|
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
|
// The pointer has been slid out from the previous key, we must call onRelease() to
|
||||||
// notify that the previous key has been released.
|
// notify that the previous key has been released.
|
||||||
callListenerOnRelease(oldKey.mCodes[0]);
|
callListenerOnRelease(oldKey.mCodes[0]);
|
||||||
|
mHandler.cancelLongPressTimers();
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedSlidingKeyInput) {
|
||||||
resetMultiTap();
|
resetMultiTap();
|
||||||
keyState.onMoveToNewKey(keyIndex, x ,y);
|
keyState.onMoveToNewKey(keyIndex, x ,y);
|
||||||
mHandler.cancelLongPressTimers();
|
|
||||||
} else {
|
} else {
|
||||||
setAlreadyProcessed();
|
setAlreadyProcessed();
|
||||||
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
|
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
|
||||||
|
@ -332,10 +333,10 @@ public class PointerTracker {
|
||||||
if (DEBUG_EVENT)
|
if (DEBUG_EVENT)
|
||||||
printTouchEvent("onUpEvent :", x, y, eventTime);
|
printTouchEvent("onUpEvent :", x, y, eventTime);
|
||||||
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
|
showKeyPreviewAndUpdateKeyGraphics(NOT_A_KEY);
|
||||||
if (mKeyAlreadyProcessed)
|
|
||||||
return;
|
|
||||||
mHandler.cancelKeyTimers();
|
mHandler.cancelKeyTimers();
|
||||||
mHandler.cancelPopupPreview();
|
mHandler.cancelPopupPreview();
|
||||||
|
if (mKeyAlreadyProcessed)
|
||||||
|
return;
|
||||||
final PointerTrackerKeyState keyState = mKeyState;
|
final PointerTrackerKeyState keyState = mKeyState;
|
||||||
int keyIndex = keyState.onUpKey(x, y);
|
int keyIndex = keyState.onUpKey(x, y);
|
||||||
if (isMinorMoveBounce(x, y, keyIndex)) {
|
if (isMinorMoveBounce(x, y, keyIndex)) {
|
||||||
|
@ -438,7 +439,7 @@ public class PointerTracker {
|
||||||
}
|
}
|
||||||
if (key.mOutputText != null) {
|
if (key.mOutputText != null) {
|
||||||
callListenerOnText(key.mOutputText);
|
callListenerOnText(key.mOutputText);
|
||||||
callListenerOnRelease(NOT_A_KEY);
|
callListenerOnRelease(key.mCodes[0]);
|
||||||
} else {
|
} else {
|
||||||
int code = key.mCodes[0];
|
int code = key.mCodes[0];
|
||||||
final int[] codes = mKeyDetector.newCodeArray();
|
final int[] codes = mKeyDetector.newCodeArray();
|
||||||
|
|
|
@ -1128,6 +1128,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
ic.commitText(text, 1);
|
ic.commitText(text, 1);
|
||||||
ic.endBatchEdit();
|
ic.endBatchEdit();
|
||||||
mKeyboardSwitcher.updateShiftState();
|
mKeyboardSwitcher.updateShiftState();
|
||||||
|
mKeyboardSwitcher.onKey(0); // dummy key code.
|
||||||
mJustReverted = false;
|
mJustReverted = false;
|
||||||
mJustAddedAutoSpace = false;
|
mJustAddedAutoSpace = false;
|
||||||
mEnteredText = text;
|
mEnteredText = text;
|
||||||
|
|
Loading…
Reference in New Issue