aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-09-02 01:35:24 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-09-02 16:03:46 +0900
commit40a05f62edc6cdedb4365a722b48a72826ef2bf6 (patch)
tree0ad4f8c12541831bdb60d5d9b85f168174a57bf5 /java/src/com/android/inputmethod/latin/LatinIME.java
parentf7d71c338f2585810ca2da95e7aee5c166b06ac2 (diff)
downloadlatinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.tar.gz
latinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.tar.xz
latinime-40a05f62edc6cdedb4365a722b48a72826ef2bf6.zip
Queuing PointerTracker to support n-key roll-over and shift modifier.
Bug: 2910379 Change-Id: I5cfae33e72a406585137842a2260310813cee07f
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java29
1 files changed, 26 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 76f774c96..7afee3fad 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -227,6 +227,9 @@ public class LatinIME extends InputMethodService
private int mDeleteCount;
private long mLastKeyTime;
+ // Shift modifier key state
+ private ModifierKeyState mShiftKeyState = new ModifierKeyState();
+
private Tutorial mTutorial;
private AudioManager mAudioManager;
@@ -976,7 +979,8 @@ public class LatinIME extends InputMethodService
public void updateShiftKeyState(EditorInfo attr) {
InputConnection ic = getCurrentInputConnection();
if (ic != null && attr != null && mKeyboardSwitcher.isAlphabetMode()) {
- mKeyboardSwitcher.setShifted(mCapsLock || getCursorCapsMode(ic, attr) != 0);
+ mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock
+ || getCursorCapsMode(ic, attr) != 0);
}
}
@@ -1233,12 +1237,20 @@ public class LatinIME extends InputMethodService
ic.endBatchEdit();
}
+ private void resetShift() {
+ handleShiftInternal(true);
+ }
+
private void handleShift() {
+ handleShiftInternal(false);
+ }
+
+ private void handleShiftInternal(boolean forceNormal) {
mHandler.removeMessages(MSG_UPDATE_SHIFT_STATE);
KeyboardSwitcher switcher = mKeyboardSwitcher;
LatinKeyboardView inputView = switcher.getInputView();
if (switcher.isAlphabetMode()) {
- if (mCapsLock) {
+ if (mCapsLock || forceNormal) {
mCapsLock = false;
switcher.setShifted(false);
} else if (inputView != null) {
@@ -2146,15 +2158,26 @@ public class LatinIME extends InputMethodService
vibrate();
playKeyClick(primaryCode);
if (primaryCode == Keyboard.KEYCODE_SHIFT) {
+ mShiftKeyState.onPress();
handleShift();
+ } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
+ // TODO: We should handle KEYCODE_MODE_CHANGE (symbol) here as well.
+ } else {
+ mShiftKeyState.onOtherKeyPressed();
}
- // TODO: We should handle KEYCODE_MODE_CHANGE (symbol) here as well.
}
public void onRelease(int primaryCode) {
// Reset any drag flags in the keyboard
((LatinKeyboard) mKeyboardSwitcher.getInputView().getKeyboard()).keyReleased();
//vibrate();
+ if (primaryCode == Keyboard.KEYCODE_SHIFT) {
+ if (mShiftKeyState.isMomentary())
+ resetShift();
+ mShiftKeyState.onRelease();
+ } else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE) {
+ // TODO: We should handle KEYCODE_MODE_CHANGE (symbol) here as well.
+ }
}
private FieldContext makeFieldContext() {