aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-05-29 03:28:41 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-29 03:28:41 -0700
commitc79a710445cca2a69dca9600a2c06eadcb253b62 (patch)
tree5d038d2198051c2ac4e0f4650add557231fc408b /java
parent57da84dac4618c0848af02509b42cf913376f382 (diff)
parent2959fc0f13ec29e05eda2c4a1e9a728350a80557 (diff)
downloadlatinime-c79a710445cca2a69dca9600a2c06eadcb253b62.tar.gz
latinime-c79a710445cca2a69dca9600a2c06eadcb253b62.tar.xz
latinime-c79a710445cca2a69dca9600a2c06eadcb253b62.zip
am 2959fc0f: Delay shift lock transient until long pressed shift key is released
* commit '2959fc0f13ec29e05eda2c4a1e9a728350a80557': Delay shift lock transient until long pressed shift key is released
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java17
1 files changed, 8 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
index c85122ad3..43ffb85f7 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardState.java
@@ -85,6 +85,9 @@ public class KeyboardState {
private boolean mPrevMainKeyboardWasShiftLocked;
private boolean mPrevSymbolsKeyboardWasShifted;
+ // For handling long press.
+ private boolean mLongPressShiftLockFired;
+
// For handling double tap.
private boolean mIsInAlphabetUnshiftedFromShifted;
private boolean mIsInDoubleTapShiftKey;
@@ -312,6 +315,7 @@ public class KeyboardState {
} else {
mSwitchActions.cancelDoubleTapTimer();
mSwitchActions.cancelLongPressTimer();
+ mLongPressShiftLockFired = false;
mShiftKeyState.onOtherKeyPressed();
mSymbolKeyState.onOtherKeyPressed();
// It is required to reset the auto caps state when all of the following conditions
@@ -375,15 +379,7 @@ public class KeyboardState {
ResearchLogger.keyboardState_onLongPressTimeout(code, this);
}
if (mIsAlphabetMode && code == Keyboard.CODE_SHIFT) {
- if (mAlphabetShiftState.isShiftLocked()) {
- setShiftLocked(false);
- // Shift key is long pressed while shift locked state, we will toggle back to normal
- // state. And mark as if shift key is released.
- mShiftKeyState.onRelease();
- } else {
- // Shift key is long pressed while shift unlocked state.
- setShiftLocked(true);
- }
+ mLongPressShiftLockFired = true;
mSwitchActions.hapticAndAudioFeedback(code);
}
}
@@ -413,6 +409,7 @@ public class KeyboardState {
}
private void onPressShift() {
+ mLongPressShiftLockFired = false;
if (mIsAlphabetMode) {
mIsInDoubleTapShiftKey = mSwitchActions.isInDoubleTapTimeout();
if (!mIsInDoubleTapShiftKey) {
@@ -466,6 +463,8 @@ public class KeyboardState {
// Double tap shift key has been handled in {@link #onPressShift}, so that just
// ignore this release shift key here.
mIsInDoubleTapShiftKey = false;
+ } else if (mLongPressShiftLockFired) {
+ setShiftLocked(!mAlphabetShiftState.isShiftLocked());
} else if (mShiftKeyState.isChording()) {
if (mAlphabetShiftState.isShiftLockShifted()) {
// After chording input while shift locked state.