Skip to content
Snippets Groups Projects
Commit 07f903af authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka Committed by Android (Google) Code Review
Browse files

Merge "Fix automatic temporary upper case mode behaviour"

parents 3757d160 6769c679
No related branches found
No related tags found
No related merge requests found
...@@ -499,26 +499,26 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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);
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment