Merge "Fix automatic temporary upper case mode behaviour"
This commit is contained in:
commit
07f903afba
3 changed files with 11 additions and 10 deletions
|
@ -499,26 +499,26 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
if (isShiftLocked()) {
|
if (isShiftLocked()) {
|
||||||
// Shift key is pressed while caps lock state, we will treat this state as shifted
|
// 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.
|
// caps lock state and mark as if shift key pressed while normal state.
|
||||||
setManualTemporaryUpperCase(true);
|
|
||||||
shiftKeyState.onPress();
|
shiftKeyState.onPress();
|
||||||
|
setManualTemporaryUpperCase(true);
|
||||||
} else if (isAutomaticTemporaryUpperCase()) {
|
} else if (isAutomaticTemporaryUpperCase()) {
|
||||||
// Shift key is pressed while automatic temporary upper case, we have to move to
|
// Shift key is pressed while automatic temporary upper case, we have to move to
|
||||||
// manual temporary upper case.
|
// manual temporary upper case.
|
||||||
|
shiftKeyState.onPress();
|
||||||
setManualTemporaryUpperCase(true);
|
setManualTemporaryUpperCase(true);
|
||||||
shiftKeyState.onPressOnShifted();
|
|
||||||
} else if (isShiftedOrShiftLocked()) {
|
} else if (isShiftedOrShiftLocked()) {
|
||||||
// In manual upper case state, we just record shift key has been pressing while
|
// In manual upper case state, we just record shift key has been pressing while
|
||||||
// shifted state.
|
// shifted state.
|
||||||
shiftKeyState.onPressOnShifted();
|
shiftKeyState.onPressOnShifted();
|
||||||
} else {
|
} else {
|
||||||
// In base layout, chording or manual temporary upper case mode is started.
|
// In base layout, chording or manual temporary upper case mode is started.
|
||||||
toggleShift();
|
|
||||||
shiftKeyState.onPress();
|
shiftKeyState.onPress();
|
||||||
|
toggleShift();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// In symbol mode, just toggle symbol and symbol more keyboard.
|
// In symbol mode, just toggle symbol and symbol more keyboard.
|
||||||
toggleShift();
|
|
||||||
shiftKeyState.onPress();
|
shiftKeyState.onPress();
|
||||||
|
toggleShift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ModifierKeyState {
|
||||||
|
|
||||||
public void onOtherKeyPressed() {
|
public void onOtherKeyPressed() {
|
||||||
final int oldState = mState;
|
final int oldState = mState;
|
||||||
if (mState == PRESSING)
|
if (oldState == PRESSING)
|
||||||
mState = MOMENTARY;
|
mState = MOMENTARY;
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
Log.d(TAG, mName + ".onOtherKeyPressed: " + toString(oldState) + " > " + this);
|
Log.d(TAG, mName + ".onOtherKeyPressed: " + toString(oldState) + " > " + this);
|
||||||
|
@ -64,7 +64,7 @@ public class ModifierKeyState {
|
||||||
return toString(mState);
|
return toString(mState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String toString(int state) {
|
protected String toString(int state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case RELEASING: return "RELEASING";
|
case RELEASING: return "RELEASING";
|
||||||
case PRESSING: return "PRESSING";
|
case PRESSING: return "PRESSING";
|
||||||
|
|
|
@ -29,9 +29,9 @@ public class ShiftKeyState extends ModifierKeyState {
|
||||||
@Override
|
@Override
|
||||||
public void onOtherKeyPressed() {
|
public void onOtherKeyPressed() {
|
||||||
int oldState = mState;
|
int oldState = mState;
|
||||||
if (mState == PRESSING) {
|
if (oldState == PRESSING) {
|
||||||
mState = MOMENTARY;
|
mState = MOMENTARY;
|
||||||
} else if (mState == PRESSING_ON_SHIFTED) {
|
} else if (oldState == PRESSING_ON_SHIFTED) {
|
||||||
mState = IGNORING;
|
mState = IGNORING;
|
||||||
}
|
}
|
||||||
if (DEBUG)
|
if (DEBUG)
|
||||||
|
@ -58,11 +58,12 @@ public class ShiftKeyState extends ModifierKeyState {
|
||||||
return toString(mState);
|
return toString(mState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String toString(int state) {
|
@Override
|
||||||
|
protected String toString(int state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case PRESSING_ON_SHIFTED: return "PRESSING_ON_SHIFTED";
|
case PRESSING_ON_SHIFTED: return "PRESSING_ON_SHIFTED";
|
||||||
case IGNORING: return "IGNORING";
|
case IGNORING: return "IGNORING";
|
||||||
default: return ModifierKeyState.toString(state);
|
default: return super.toString(state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue