Save automatic shift state while orientation changing
Bug: 8734294 Change-Id: Ib2bc262aacedf786a318c2fe1bd4420a21e7d847main
parent
9e0ffd35a5
commit
7f8dd50b8f
|
@ -95,6 +95,8 @@ public final class KeyboardState {
|
||||||
static final class SavedKeyboardState {
|
static final class SavedKeyboardState {
|
||||||
public boolean mIsValid;
|
public boolean mIsValid;
|
||||||
public boolean mIsAlphabetMode;
|
public boolean mIsAlphabetMode;
|
||||||
|
// TODO: Use <code>int</code> to represent saved shift state.
|
||||||
|
public boolean mIsAlphabetAutomaticShifted;
|
||||||
public boolean mIsAlphabetShiftLocked;
|
public boolean mIsAlphabetShiftLocked;
|
||||||
public boolean mIsShifted;
|
public boolean mIsShifted;
|
||||||
|
|
||||||
|
@ -103,7 +105,8 @@ public final class KeyboardState {
|
||||||
if (!mIsValid) return "INVALID";
|
if (!mIsValid) return "INVALID";
|
||||||
if (mIsAlphabetMode) {
|
if (mIsAlphabetMode) {
|
||||||
if (mIsAlphabetShiftLocked) return "ALPHABET_SHIFT_LOCKED";
|
if (mIsAlphabetShiftLocked) return "ALPHABET_SHIFT_LOCKED";
|
||||||
return mIsShifted ? "ALPHABET_SHIFTED" : "ALPHABET";
|
return mIsAlphabetAutomaticShifted ? "ALPHABET_AUTOMATIC_SHIFTED"
|
||||||
|
: (mIsShifted ? "ALPHABET_SHIFTED" : "ALPHABET");
|
||||||
} else {
|
} else {
|
||||||
return mIsShifted ? "SYMBOLS_SHIFTED" : "SYMBOLS";
|
return mIsShifted ? "SYMBOLS_SHIFTED" : "SYMBOLS";
|
||||||
}
|
}
|
||||||
|
@ -133,6 +136,7 @@ public final class KeyboardState {
|
||||||
state.mIsAlphabetMode = mIsAlphabetMode;
|
state.mIsAlphabetMode = mIsAlphabetMode;
|
||||||
if (mIsAlphabetMode) {
|
if (mIsAlphabetMode) {
|
||||||
state.mIsAlphabetShiftLocked = mAlphabetShiftState.isShiftLocked();
|
state.mIsAlphabetShiftLocked = mAlphabetShiftState.isShiftLocked();
|
||||||
|
state.mIsAlphabetAutomaticShifted = mAlphabetShiftState.isAutomaticShifted();
|
||||||
state.mIsShifted = !state.mIsAlphabetShiftLocked
|
state.mIsShifted = !state.mIsAlphabetShiftLocked
|
||||||
&& mAlphabetShiftState.isShiftedOrShiftLocked();
|
&& mAlphabetShiftState.isShiftedOrShiftLocked();
|
||||||
} else {
|
} else {
|
||||||
|
@ -166,7 +170,8 @@ public final class KeyboardState {
|
||||||
if (state.mIsAlphabetMode) {
|
if (state.mIsAlphabetMode) {
|
||||||
setShiftLocked(state.mIsAlphabetShiftLocked);
|
setShiftLocked(state.mIsAlphabetShiftLocked);
|
||||||
if (!state.mIsAlphabetShiftLocked) {
|
if (!state.mIsAlphabetShiftLocked) {
|
||||||
setShifted(state.mIsShifted ? MANUAL_SHIFT : UNSHIFT);
|
setShifted(state.mIsAlphabetAutomaticShifted ? AUTOMATIC_SHIFT
|
||||||
|
: (state.mIsShifted ? MANUAL_SHIFT : UNSHIFT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mPrevMainKeyboardWasShiftLocked = state.mIsAlphabetShiftLocked;
|
mPrevMainKeyboardWasShiftLocked = state.mIsAlphabetShiftLocked;
|
||||||
|
|
|
@ -597,6 +597,17 @@ public class KeyboardStateSingleTouchTests extends KeyboardStateTestsBase {
|
||||||
// Rotate device, remain in alphabet.
|
// Rotate device, remain in alphabet.
|
||||||
rotateDevice(ALPHABET_UNSHIFTED);
|
rotateDevice(ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
|
// Alphabet automatic shifted -> rotate -> automatic shifted.
|
||||||
|
// Set capitalize the first character of all words mode.
|
||||||
|
setAutoCapsMode(CAP_MODE_WORDS);
|
||||||
|
// Press/release auto caps trigger letter to enter alphabet automatic shifted.
|
||||||
|
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_UNSHIFTED, ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
// Rotate device, remain in alphabet.
|
||||||
|
rotateDevice(ALPHABET_AUTOMATIC_SHIFTED);
|
||||||
|
setAutoCapsMode(CAP_MODE_OFF);
|
||||||
|
// Press/release auto caps trigger letter to reset shift state.
|
||||||
|
pressAndReleaseKey(CODE_AUTO_CAPS_TRIGGER, ALPHABET_AUTOMATIC_SHIFTED, ALPHABET_UNSHIFTED);
|
||||||
|
|
||||||
// Alphabet shifted -> rotate -> alphabet shifted.
|
// Alphabet shifted -> rotate -> alphabet shifted.
|
||||||
// Press/release shift key, enter alphabet shifted.
|
// Press/release shift key, enter alphabet shifted.
|
||||||
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
pressAndReleaseKey(CODE_SHIFT, ALPHABET_MANUAL_SHIFTED, ALPHABET_MANUAL_SHIFTED);
|
||||||
|
|
Loading…
Reference in New Issue