aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-01-16 18:23:48 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-01-16 18:54:25 +0900
commit7bc61ca183870be983757acfdfb61e7f6aa7120b (patch)
treec2ccc666f5309f5fd02614f9fc247b85ccd9f4ac /java/src
parentd3f1caec0ed2e65fdd489e61c487f61d6f169678 (diff)
downloadlatinime-7bc61ca183870be983757acfdfb61e7f6aa7120b.tar.gz
latinime-7bc61ca183870be983757acfdfb61e7f6aa7120b.tar.xz
latinime-7bc61ca183870be983757acfdfb61e7f6aa7120b.zip
Fix double tap shift key to turn off capslock mode
Bug: 5873562 Change-Id: If1f5ae1684905c1418ae43e55df38509444d29e2
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java3
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java12
2 files changed, 12 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 54d842f09..df61689e1 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -225,12 +225,13 @@ public class KeyboardSwitcher implements KeyboardState.SwitchActions,
keyboard.setAutomaticTemporaryUpperCase();
} else {
final boolean shifted = (shiftMode == MANUAL_SHIFT);
+ // TODO: Remove duplicated logic in KeyboardState#setShifted
// On non-distinct multi touch panel device, we should also turn off the shift locked
// state when shift key is pressed to go to normal mode.
// On the other hand, on distinct multi touch panel device, turning off the shift
// locked state with shift key pressing is handled by onReleaseShift().
if (!hasDistinctMultitouch() && !shifted && mState.isShiftLocked()) {
- keyboard.setShiftLocked(false);
+ setShiftLocked(false);
}
keyboard.setShifted(shifted);
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
index 42f069c83..609593e44 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
@@ -166,21 +166,29 @@ public class KeyboardState {
if (DEBUG_STATE) {
Log.d(TAG, "setShifted: shiftMode=" + shiftModeToString(shiftMode));
}
+ // TODO: Remove this hack in conjunction with duplicated logic below.
+ boolean needsToTurnOffShiftLockedLater = false;
if (shiftMode == SwitchActions.AUTOMATIC_SHIFT) {
mKeyboardShiftState.setAutomaticTemporaryUpperCase();
} else {
- // TODO: Duplicated logic in KeyboardSwitcher#setShifted()
+ // TODO: Remove duplicated logic in KeyboardSwitcher#setShifted()
final boolean shifted = (shiftMode == SwitchActions.MANUAL_SHIFT);
// On non-distinct multi touch panel device, we should also turn off the shift locked
// state when shift key is pressed to go to normal mode.
// On the other hand, on distinct multi touch panel device, turning off the shift
// locked state with shift key pressing is handled by onReleaseShift().
if (!mHasDistinctMultitouch && !shifted && mKeyboardShiftState.isShiftLocked()) {
- mKeyboardShiftState.setShiftLocked(false);
+ // Setting shift lock state should be delayed after
+ // mSwitchActions.setShifted(shiftMode) is called, because in that call the state
+ // is referenced.
+ needsToTurnOffShiftLockedLater = true;
}
mKeyboardShiftState.setShifted(shifted);
}
mSwitchActions.setShifted(shiftMode);
+ if (needsToTurnOffShiftLockedLater) {
+ mKeyboardShiftState.setShiftLocked(false);
+ }
}
private void setShiftLocked(boolean shiftLocked) {