am 0ef9bfe5: Merge "Fix KeyboardState switching back from alphabet-chording input correctly"

* commit '0ef9bfe5932cb1b099809b4622bf45427f0430dd':
  Fix KeyboardState switching back from alphabet-chording input correctly
This commit is contained in:
Tadashi G. Takaoka 2012-01-19 02:15:29 -08:00 committed by Android Git Automerger
commit 6d6c960136
2 changed files with 19 additions and 10 deletions

View file

@ -78,6 +78,7 @@ public class KeyboardState {
private KeyboardShiftState mAlphabetShiftState = new KeyboardShiftState(); private KeyboardShiftState mAlphabetShiftState = new KeyboardShiftState();
private boolean mIsSymbolShifted; private boolean mIsSymbolShifted;
private boolean mPrevMainKeyboardWasShiftLocked; private boolean mPrevMainKeyboardWasShiftLocked;
private boolean mPrevSymbolsKeyboardWasShifted;
private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState(); private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState();
@ -100,6 +101,7 @@ public class KeyboardState {
// Reset alphabet shift state. // Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false); mAlphabetShiftState.setShiftLocked(false);
mPrevMainKeyboardWasShiftLocked = false; mPrevMainKeyboardWasShiftLocked = false;
mPrevSymbolsKeyboardWasShifted = false;
mShiftKeyState.onRelease(); mShiftKeyState.onRelease();
mSymbolKeyState.onRelease(); mSymbolKeyState.onRelease();
onRestoreKeyboardState(); onRestoreKeyboardState();
@ -202,6 +204,7 @@ public class KeyboardState {
if (DEBUG_ACTION) { if (DEBUG_ACTION) {
Log.d(TAG, "setAlphabetKeyboard"); Log.d(TAG, "setAlphabetKeyboard");
} }
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
mSwitchActions.setAlphabetKeyboard(); mSwitchActions.setAlphabetKeyboard();
mIsAlphabetMode = true; mIsAlphabetMode = true;
mIsSymbolShifted = false; mIsSymbolShifted = false;
@ -214,6 +217,11 @@ public class KeyboardState {
// TODO: Make this method private // TODO: Make this method private
public void setSymbolsKeyboard() { public void setSymbolsKeyboard() {
mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked(); mPrevMainKeyboardWasShiftLocked = mAlphabetShiftState.isShiftLocked();
if (mPrevSymbolsKeyboardWasShifted) {
setSymbolsShiftedKeyboard();
return;
}
if (DEBUG_ACTION) { if (DEBUG_ACTION) {
Log.d(TAG, "setSymbolsKeyboard"); Log.d(TAG, "setSymbolsKeyboard");
} }
@ -222,6 +230,7 @@ public class KeyboardState {
mIsSymbolShifted = false; mIsSymbolShifted = false;
// Reset alphabet shift state. // Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false); mAlphabetShiftState.setShiftLocked(false);
mPrevSymbolsKeyboardWasShifted = false;
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN; mSwitchState = SWITCH_STATE_SYMBOL_BEGIN;
} }
@ -234,6 +243,7 @@ public class KeyboardState {
mIsSymbolShifted = true; mIsSymbolShifted = true;
// Reset alphabet shift state. // Reset alphabet shift state.
mAlphabetShiftState.setShiftLocked(false); mAlphabetShiftState.setShiftLocked(false);
mPrevSymbolsKeyboardWasShifted = false;
mSwitchState = SWITCH_STATE_SYMBOL_BEGIN; 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. // Release shift key, switch back to symbols shifted state.
releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED); releaseKey(CODE_SHIFT, SYMBOLS_SHIFTED);
// TODO: This test fails due to bug. // Press "ABC" key and hold, enter into choring alphabet state.
// // Press "ABC" key and hold, enter into choring alphabet state. pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// pressKey(CODE_SYMBOL, ALPHABET_UNSHIFTED);
// // Press/release letter keys.
// // Press/release letter keys. chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// chordingPressAndReleaseKey('a', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED); chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// chordingPressAndReleaseKey('b', ALPHABET_UNSHIFTED, ALPHABET_UNSHIFTED);
// // Release "ABC" key, switch back to symbols.
// // Release "ABC" key, switch back to symbols. releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
// releaseKey(CODE_SYMBOL, SYMBOLS_SHIFTED);
} }
// Chording shift key in automatic upper case. // Chording shift key in automatic upper case.