Fix automatic temporary upper case mode behaviour
This change is a followup of I948ef26f Automatic Temporary Upper Case mode acts like Normal mode until shift key is pressed. However, after shift key is pressed, it acts like Manual Temporary Upper Case mode. Bug: 3193390 Change-Id: Id3d7a38a1f5905322cd46ded36b1db26576d49afmain
parent
75fde64890
commit
6769c67987
|
@ -499,26 +499,26 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
if (isShiftLocked()) {
|
||||
// Shift key is pressed while caps lock state, we will treat this state as shifted
|
||||
// caps lock state and mark as if shift key pressed while normal state.
|
||||
setManualTemporaryUpperCase(true);
|
||||
shiftKeyState.onPress();
|
||||
setManualTemporaryUpperCase(true);
|
||||
} else if (isAutomaticTemporaryUpperCase()) {
|
||||
// Shift key is pressed while automatic temporary upper case, we have to move to
|
||||
// manual temporary upper case.
|
||||
shiftKeyState.onPress();
|
||||
setManualTemporaryUpperCase(true);
|
||||
shiftKeyState.onPressOnShifted();
|
||||
} else if (isShiftedOrShiftLocked()) {
|
||||
// In manual upper case state, we just record shift key has been pressing while
|
||||
// shifted state.
|
||||
shiftKeyState.onPressOnShifted();
|
||||
} else {
|
||||
// In base layout, chording or manual temporary upper case mode is started.
|
||||
toggleShift();
|
||||
shiftKeyState.onPress();
|
||||
toggleShift();
|
||||
}
|
||||
} else {
|
||||
// In symbol mode, just toggle symbol and symbol more keyboard.
|
||||
toggleShift();
|
||||
shiftKeyState.onPress();
|
||||
toggleShift();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ModifierKeyState {
|
|||
|
||||
public void onOtherKeyPressed() {
|
||||
final int oldState = mState;
|
||||
if (mState == PRESSING)
|
||||
if (oldState == PRESSING)
|
||||
mState = MOMENTARY;
|
||||
if (DEBUG)
|
||||
Log.d(TAG, mName + ".onOtherKeyPressed: " + toString(oldState) + " > " + this);
|
||||
|
@ -64,7 +64,7 @@ public class ModifierKeyState {
|
|||
return toString(mState);
|
||||
}
|
||||
|
||||
protected static String toString(int state) {
|
||||
protected String toString(int state) {
|
||||
switch (state) {
|
||||
case RELEASING: return "RELEASING";
|
||||
case PRESSING: return "PRESSING";
|
||||
|
|
|
@ -29,9 +29,9 @@ public class ShiftKeyState extends ModifierKeyState {
|
|||
@Override
|
||||
public void onOtherKeyPressed() {
|
||||
int oldState = mState;
|
||||
if (mState == PRESSING) {
|
||||
if (oldState == PRESSING) {
|
||||
mState = MOMENTARY;
|
||||
} else if (mState == PRESSING_ON_SHIFTED) {
|
||||
} else if (oldState == PRESSING_ON_SHIFTED) {
|
||||
mState = IGNORING;
|
||||
}
|
||||
if (DEBUG)
|
||||
|
@ -58,11 +58,12 @@ public class ShiftKeyState extends ModifierKeyState {
|
|||
return toString(mState);
|
||||
}
|
||||
|
||||
protected static String toString(int state) {
|
||||
@Override
|
||||
protected String toString(int state) {
|
||||
switch (state) {
|
||||
case PRESSING_ON_SHIFTED: return "PRESSING_ON_SHIFTED";
|
||||
case IGNORING: return "IGNORING";
|
||||
default: return ModifierKeyState.toString(state);
|
||||
default: return super.toString(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue