Merge "Fix automatic temporary upper case mode behaviour"

main
Tadashi G. Takaoka 2010-11-19 17:21:55 -08:00 committed by Android (Google) Code Review
commit 07f903afba
3 changed files with 11 additions and 10 deletions

View File

@ -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();
}
}

View File

@ -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";

View File

@ -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);
}
}
}