aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2012-05-29 15:47:57 +0900
committerTadashi G. Takaoka <takaoka@google.com>2012-05-29 18:14:11 +0900
commit2959fc0f13ec29e05eda2c4a1e9a728350a80557 (patch)
tree3497d87cefecd1ae47cb132574041f407edfd036 /java/src
parentfb0a4ba8fd7291e1bed0ec61bb7d2b5c8f93c1ad (diff)
downloadlatinime-2959fc0f13ec29e05eda2c4a1e9a728350a80557.tar.gz
latinime-2959fc0f13ec29e05eda2c4a1e9a728350a80557.tar.xz
latinime-2959fc0f13ec29e05eda2c4a1e9a728350a80557.zip
Delay shift lock transient until long pressed shift key is released
Bug: 5424586 Change-Id: Ib602af1b38b1b109bdac9cb0c53132169556db2f
Diffstat (limited to 'java/src')
-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.