diff options
author | 2010-12-19 19:06:44 +0900 | |
---|---|---|
committer | 2011-01-01 01:24:04 +0900 | |
commit | 7aedc8a054aca41e6c80d8faf0ed2dd47f9815c4 (patch) | |
tree | 4e639fff893190f3f1af8c4bcbee848e519c122b /java/src/com/android/inputmethod/latin/LatinIME.java | |
parent | 82496fa100b38ad73910545c6a0e9244cf0ee6e0 (diff) | |
download | latinime-7aedc8a054aca41e6c80d8faf0ed2dd47f9815c4.tar.gz latinime-7aedc8a054aca41e6c80d8faf0ed2dd47f9815c4.tar.xz latinime-7aedc8a054aca41e6c80d8faf0ed2dd47f9815c4.zip |
Automaticaly snap back to the previous mode from sliding input (DO NOT MERGE)
This change is back porting of the following changes from Honeycomb.
- I48ea1346: Automaticaly snap back to the previous mode from sliding symbol input
- I9507a98c: Suppress haptic feedback while sliding key input
- Ia06e1abc: Cancel long press timer when sliding key input is not allowed
- I15127929: Fix checking of sliding off from key
- I2518dd1d: Fix potential keyboard layout change bug
- Iffaad1eb: Snap back to the previous keyboard when sliding input is canceled
- Id74bddef: Longer long-press timeout in sliding input
Bug: 3280151
Change-Id: If20b34e8773ebf081c2274d136be4f8ad07ca4fa
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index ffca22e45..b1689f886 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -342,6 +342,7 @@ public class LatinIME extends InputMethodService @Override public void onCreate() { LatinImeLogger.init(this); + KeyboardSwitcher.init(this); super.onCreate(); //setStatusIcon(R.drawable.ime_qwerty); mResources = getResources(); @@ -349,7 +350,7 @@ public class LatinIME extends InputMethodService final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); mLanguageSwitcher = new LanguageSwitcher(this); mLanguageSwitcher.loadLocales(prefs); - mKeyboardSwitcher = new KeyboardSwitcher(this); + mKeyboardSwitcher = KeyboardSwitcher.getInstance(); mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher); mSystemLocale = conf.locale.toString(); mLanguageSwitcher.setSystemLocale(conf.locale); @@ -1247,9 +1248,7 @@ public class LatinIME extends InputMethodService // Cancel the just reverted state mJustRevertedSeparator = null; } - if (mKeyboardSwitcher.onKey(primaryCode)) { - changeKeyboardMode(); - } + mKeyboardSwitcher.onKey(primaryCode); // Reset after any single keystroke mEnteredText = null; } @@ -1269,6 +1268,7 @@ public class LatinIME extends InputMethodService ic.commitText(text, 1); ic.endBatchEdit(); updateShiftKeyState(getCurrentInputEditorInfo()); + mKeyboardSwitcher.onKey(0); // dummy key code. mJustRevertedSeparator = null; mJustAddedAutoSpace = false; mEnteredText = text; @@ -1276,6 +1276,7 @@ public class LatinIME extends InputMethodService public void onCancel() { // User released a finger outside any key + mKeyboardSwitcher.onCancelInput(); } private void handleBackspace() { @@ -2283,15 +2284,18 @@ public class LatinIME extends InputMethodService } public void onPress(int primaryCode) { - vibrate(); - playKeyClick(primaryCode); + if (mKeyboardSwitcher.isVibrateAndSoundFeedbackRequired()) { + vibrate(); + playKeyClick(primaryCode); + } final boolean distinctMultiTouch = mKeyboardSwitcher.hasDistinctMultitouch(); if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_SHIFT) { mShiftKeyState.onPress(); handleShift(); } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) { - mSymbolKeyState.onPress(); changeKeyboardMode(); + mSymbolKeyState.onPress(); + mKeyboardSwitcher.setAutoModeSwitchStateMomentary(); } else { mShiftKeyState.onOtherKeyPressed(); mSymbolKeyState.onOtherKeyPressed(); @@ -2308,7 +2312,9 @@ public class LatinIME extends InputMethodService resetShift(); mShiftKeyState.onRelease(); } else if (distinctMultiTouch && primaryCode == Keyboard.KEYCODE_MODE_CHANGE) { - if (mSymbolKeyState.isMomentary()) + // Snap back to the previous keyboard mode if the user chords the mode change key and + // other key, then released the mode change key. + if (mKeyboardSwitcher.isInChordingAutoModeSwitchState()) changeKeyboardMode(); mSymbolKeyState.onRelease(); } @@ -2562,7 +2568,7 @@ public class LatinIME extends InputMethodService mOptionsDialog.show(); } - private void changeKeyboardMode() { + public void changeKeyboardMode() { mKeyboardSwitcher.toggleSymbols(); if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) { mKeyboardSwitcher.setShiftLocked(mCapsLock); |