am 747ed9e9: For get the symbols shifted state when switch back from alphabet layout

* commit '747ed9e99a6a83e54d97d96aa3cbb1abd11eaf0f':
  For get the symbols shifted state when switch back from alphabet layout
main
Tadashi G. Takaoka 2012-01-24 00:52:06 -08:00 committed by Android Git Automerger
commit 55a1bc7e59
2 changed files with 27 additions and 25 deletions

View File

@ -302,8 +302,7 @@ public class KeyboardState {
if (code == Keyboard.CODE_SHIFT) {
onReleaseShift(withSliding);
} else if (code == Keyboard.CODE_SWITCH_ALPHA_SYMBOL) {
// TODO: Make use of withSliding instead of relying on mSwitchState.
onReleaseSymbol();
onReleaseSymbol(withSliding);
}
}
@ -313,11 +312,16 @@ public class KeyboardState {
mSwitchState = SWITCH_STATE_MOMENTARY_ALPHA_AND_SYMBOL;
}
private void onReleaseSymbol() {
private void onReleaseSymbol(boolean withSliding) {
if (mSwitchState == SWITCH_STATE_CHORDING_ALPHA) {
// Switch back to the previous keyboard mode if the user chords the mode change key and
// another key, then releases the mode change key.
if (mSwitchState == SWITCH_STATE_CHORDING_ALPHA) {
toggleAlphabetAndSymbols();
} else if (!withSliding) {
// If the mode change key is being released without sliding, we should forget the
// previous symbols keyboard shift state and simply switch back to symbols layout
// (never symbols shifted) next time the mode gets changed to symbols layout.
mPrevSymbolsKeyboardWasShifted = false;
}
mSymbolKeyState.onRelease();
}

View File

@ -61,9 +61,8 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, back to alphabet.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// // TODO: This test failed due to bug.
// // Press/release "?123" key, back to symbols (not symbols shifted).
// pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "?123" key, back to symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Switching between alphabet shifted and symbols.
@ -93,18 +92,17 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, back to alphabet shift locked (not alphabet).
// Press/release "ABC" key, back to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "=\<" key, enter into symbols shifted.
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// // TODO: This test fails due to bug.
// // Press/release "ABC" key, back to alphabet shift locked (not alphabet).
// pressAndReleaseKey(CODE_SYMBOL, ALPHABET_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// // Press/release "?123" key, back to symbols (not symbols shifted).
// pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, back to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, back to symbols (not symbols shifted).
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
}
// Automatic switch back to alphabet by space key.
@ -135,7 +133,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter symbol letter.
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter space, switch back to alphabet shift locked (not alphabet).
// Enter space, switch back to alphabet shift locked.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
@ -144,7 +142,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter symbol shift letter.
pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter space, switch back to alphabet shift locked (not alphabet).
// Enter space, switch back to alphabet shift locked.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
}
@ -187,7 +185,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter symbol letter.
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter switch back letter, switch back to alphabet shift locked. (not alphabet).
// Enter switch back letter, switch back to alphabet shift locked.
pressAndReleaseKey(switchBackCode, SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
@ -196,7 +194,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter symbol shift letter.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Enter switch back letter, switch back to alphabet shift locked (not alphabet).
// Enter switch back letter, switch back to alphabet shift locked.
pressAndReleaseKey(switchBackCode, SYMBOLS_SHIFTED, ALPHABET_SHIFT_LOCKED);
}
@ -223,7 +221,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release symbol letter key, remain in symbols.
pressAndReleaseKey('1', SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press/release space, switch back to automatic shifted (not alphabet).
// Press/release space, switch back to automatic shifted.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
// Press/release "?123" key, enter into symbols.
@ -232,7 +230,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndReleaseKey(CODE_SHIFT, SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release symbol shift letter key, remain in symbols shifted.
pressAndReleaseKey('~', SYMBOLS_SHIFTED, SYMBOLS_SHIFTED);
// Press/release space, switch back to automatic shifted (not alphabet).
// Press/release space, switch back to automatic shifted.
pressAndReleaseKey(CODE_SPACE, SYMBOLS_SHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
}
@ -372,13 +370,13 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
longPressShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
// Press and slide from "123?" key, enter symbols.
pressAndSlideFromKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Enter/release into symbol letter key, switch back to alphabet shift locked (not alphabet).
// Enter/release into symbol letter key, switch back to alphabet shift locked.
pressAndReleaseKey('!', SYMBOLS_UNSHIFTED, ALPHABET_SHIFT_LOCKED);
// Alphabet shift locked -> "?123" key + letter -> alphabet shift locked.
// Press and slide from shift key, enter alphabet shifted.
pressAndSlideFromKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
// Enter/release letter key, switch back to shift locked (not alphabet).
// Enter/release letter key, switch back to shift locked.
// TODO: This test fails due to bug, though the external behavior is correct.
// pressAndReleaseKey('Z', ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
// TODO: Replace this with the above line once the bug fixed.
@ -425,11 +423,11 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
longPressShiftKey(ALPHABET_MANUAL_SHIFTED, ALPHABET_SHIFT_LOCKED);
// Press/release "?123" key, enter into symbols.
pressAndReleaseKey(CODE_SYMBOL, SYMBOLS_UNSHIFTED, SYMBOLS_UNSHIFTED);
// Press and slide from "ABC" key, enter alphabet shift locked (not alphabet).
// Press and slide from "ABC" key, enter alphabet shift locked.
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key, switch back to symbols.
pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_UNSHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked. (not alphabet).
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}
@ -483,7 +481,7 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
pressAndSlideFromKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
// Enter/release letter key, switch back to symbols shifted.
pressAndReleaseKey('A', ALPHABET_SHIFT_LOCKED, SYMBOLS_SHIFTED);
// Press/release "ABC" key, switch to alphabet shift locked. (not alphabet).
// Press/release "ABC" key, switch to alphabet shift locked.
pressAndReleaseKey(CODE_SYMBOL, ALPHABET_SHIFT_LOCKED, ALPHABET_SHIFT_LOCKED);
}