Merge "Fix KeyboardState switching back from alphabet-chording input correctly"

main
Tadashi G. Takaoka 2012-01-19 02:14:20 -08:00 committed by Android (Google) Code Review
commit 0ef9bfe593
2 changed files with 19 additions and 10 deletions

View File

@ -78,6 +78,7 @@ public class KeyboardState {
private KeyboardShiftState mAlphabetShiftState = new KeyboardShiftState();
private boolean mIsSymbolShifted;
private boolean mPrevMainKeyboardWasShiftLocked;
private boolean mPrevSymbolsKeyboardWasShifted;
private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState();
@ -100,6 +101,7 @@ public class KeyboardState {
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mPrevMainKeyboardWasShiftLocked = false;
mPrevSymbolsKeyboardWasShifted = false;
mShiftKeyState.onRelease();
mSymbolKeyState.onRelease();
onRestoreKeyboardState();
@ -202,6 +204,7 @@ public class KeyboardState {
if (DEBUG_ACTION) {
Log.d(TAG, "setAlphabetKeyboard");
}
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
mSwitchActions.setAlphabetKeyboard();
mIsAlphabetMode = true;
mIsSymbolShifted = false;
@ -214,6 +217,11 @@ public class KeyboardState {
// TODO: Make this method private
public void setSymbolsKeyboard() {
mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked();
if (mPrevSymbolsKeyboardWasShifted) {
setSymbolsShiftedKeyboard();
return;
}
if (DEBUG_ACTION) {
Log.d(TAG, "setSymbolsKeyboard");
}
@ -222,6 +230,7 @@ public class KeyboardState {
mIsSymbolShifted = false;
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mPrevSymbolsKeyboardWasShifted = false;
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
}
@ -234,6 +243,7 @@ public class KeyboardState {
mIsSymbolShifted = true;
// Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false);
mPrevSymbolsKeyboardWasShifted = false;
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
}

View File

@ -109,16 +109,15 @@ public class KeyboardStateMultiTouchTests extends KeyboardStateTestsBase {
// Release shift key, switch back to symbols shifted state.
releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// TODO: This test fails due to bug.
// // Press "ABC" key and hold, enter into choring alphabet state.
// pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
//
// // Press/release letter keys.
// chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
//
// // Release "ABC" key, switch back to symbols.
// releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
// Press "ABC" key and hold, enter into choring alphabet state.
pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// Press/release letter keys.
chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// Release "ABC" key, switch back to symbols.
releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
}
// Chording shift key in automatic upper case.