aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-10-10 17:14:19 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-10 17:14:19 -0700
commite56e2d85dfe95a6dc67fd1bb6ac5514bd2719f81 (patch)
tree72dd94417ae809dbea8e2ff904c0c8a8fb019f54 /java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
parentf156f30614aa5b3336f39d02da3e4ed0c46de9ed (diff)
parent02b8d91b2dbe4290d4b09d93a22efbc5552326db (diff)
downloadlatinime-e56e2d85dfe95a6dc67fd1bb6ac5514bd2719f81.tar.gz
latinime-e56e2d85dfe95a6dc67fd1bb6ac5514bd2719f81.tar.xz
latinime-e56e2d85dfe95a6dc67fd1bb6ac5514bd2719f81.zip
am 02b8d91b: am 7e1f5a2d: Make sure to set symbol keyboard shifted
Merge commit '02b8d91b2dbe4290d4b09d93a22efbc5552326db' * commit '02b8d91b2dbe4290d4b09d93a22efbc5552326db': Make sure to set symbol keyboard shifted
Diffstat (limited to 'java/src/com/android/inputmethod/latin/KeyboardSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index ebf2f4e60..86dbf1f60 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -23,9 +23,9 @@ import android.preference.PreferenceManager;
import android.view.InflateException;
import java.lang.ref.SoftReference;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Locale;
-import java.util.Map;
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
@@ -105,7 +105,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private KeyboardId mSymbolsShiftedId;
private KeyboardId mCurrentId;
- private final Map<KeyboardId, SoftReference<LatinKeyboard>> mKeyboards;
+ private final HashMap<KeyboardId, SoftReference<LatinKeyboard>> mKeyboards;
private int mMode = MODE_NONE; /** One of the MODE_XXX values */
private int mImeOptions;
@@ -194,11 +194,17 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
public final boolean mEnableShiftLock;
public final boolean mHasVoice;
+ private final int mHashCode;
+
public KeyboardId(int xml, int mode, boolean enableShiftLock, boolean hasVoice) {
this.mXml = xml;
this.mKeyboardMode = mode;
this.mEnableShiftLock = enableShiftLock;
this.mHasVoice = hasVoice;
+
+ this.mHashCode = Arrays.hashCode(new Object[] {
+ xml, mode, enableShiftLock, hasVoice
+ });
}
public KeyboardId(int xml, boolean hasVoice) {
@@ -219,8 +225,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
@Override
public int hashCode() {
- return (mXml + 1) * (mKeyboardMode + 1) * (mEnableShiftLock ? 2 : 1)
- * (mHasVoice ? 4 : 8);
+ return mHashCode;
}
}
@@ -378,7 +383,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
public void toggleShift() {
- if (mCurrentId.equals(mSymbolsId)) {
+ if (isAlphabetMode())
+ return;
+ if (mCurrentId.equals(mSymbolsId) || !mCurrentId.equals(mSymbolsShiftedId)) {
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
mCurrentId = mSymbolsShiftedId;
mInputView.setKeyboard(symbolsShiftedKeyboard);
@@ -390,7 +397,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
symbolsShiftedKeyboard.setShiftLocked(true);
symbolsShiftedKeyboard.setImeOptions(mInputMethodService.getResources(),
mMode, mImeOptions);
- } else if (mCurrentId.equals(mSymbolsShiftedId)) {
+ } else {
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
mCurrentId = mSymbolsId;
mInputView.setKeyboard(symbolsKeyboard);