diff options
author | 2010-09-06 14:50:50 +0900 | |
---|---|---|
committer | 2010-09-06 22:25:49 +0900 | |
commit | 12659d4c0ce04aaf3d8479e44f9230881b964000 (patch) | |
tree | ebbf67ae464ba361e5a747f6f1e949c4645ee828 /java/src/com/android/inputmethod/latin/KeyboardSwitcher.java | |
parent | f02e42080bba22201077f6582a48d38e564f053e (diff) | |
download | latinime-12659d4c0ce04aaf3d8479e44f9230881b964000.tar.gz latinime-12659d4c0ce04aaf3d8479e44f9230881b964000.tar.xz latinime-12659d4c0ce04aaf3d8479e44f9230881b964000.zip |
Fix ALT key light behavior
This change also cleanups some imports, unnecessary cast and null check.
Bug: 2977256
Change-Id: I81b9e539ff8a13ae0cc1eb5c4fb2246732cca3e9
Diffstat (limited to 'java/src/com/android/inputmethod/latin/KeyboardSwitcher.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/KeyboardSwitcher.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java index 3fb74b238..284b29305 100644 --- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java +++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java @@ -16,10 +16,6 @@ package com.android.inputmethod.latin; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - import android.content.Context; import android.content.SharedPreferences; import android.content.res.Configuration; @@ -27,6 +23,10 @@ import android.content.res.Resources; import android.preference.PreferenceManager; import android.view.InflateException; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener { public static final int MODE_NONE = 0; @@ -197,8 +197,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha } mHasVoice = enableVoice; mVoiceOnPrimary = voiceOnPrimary; - setKeyboardMode(mMode, mImeOptions, mHasVoice, - mIsSymbols); + setKeyboardMode(mMode, mImeOptions, mHasVoice, mIsSymbols); } boolean hasVoiceButton(boolean isSymbols) { @@ -338,19 +337,23 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha void toggleShift() { if (mCurrentId.equals(mSymbolsId)) { - LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId); LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId); - symbolsKeyboard.setShifted(true); mCurrentId = mSymbolsShiftedId; mInputView.setKeyboard(symbolsShiftedKeyboard); - symbolsShiftedKeyboard.setShifted(true); + // Symbol shifted keyboard has an ALT key that has a caps lock style indicator. To + // enable the indicator, we need to call enableShiftLock() and setShiftLocked(true). + // Thus we can keep the ALT key's Key.on value true while LatinKey.onRelease() is + // called. + symbolsShiftedKeyboard.enableShiftLock(); + symbolsShiftedKeyboard.setShiftLocked(true); symbolsShiftedKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions); } else if (mCurrentId.equals(mSymbolsShiftedId)) { LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId); - LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId); - symbolsShiftedKeyboard.setShifted(false); mCurrentId = mSymbolsId; mInputView.setKeyboard(symbolsKeyboard); + // Symbol keyboard has an ALT key that has a caps lock style indicator. To disable the + // indicator, we need to call enableShiftLock() and setShiftLocked(false). + symbolsKeyboard.enableShiftLock(); symbolsKeyboard.setShifted(false); symbolsKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions); } |