Call showInputMethodPicker instead of showInputMethodSubtypePicker
- because showInputMethodSubtypePicker will be removed.
Change-Id: I255f9bbff77de24ce067f35ee101d368e36edd45
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index 5db6e63..58958b6 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -23,6 +23,7 @@
import android.util.Log;
import android.view.InflateException;
import android.view.inputmethod.EditorInfo;
+import android.view.inputmethod.InputMethodManager;
import java.lang.ref.SoftReference;
import java.util.Arrays;
@@ -746,7 +747,9 @@
// 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system
if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))
|| (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO))
- && LatinIMEUtil.hasMultipleEnabledIMEs(context))) {
+ && LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(
+ ((InputMethodManager) context.getSystemService(
+ Context.INPUT_METHOD_SERVICE))))) {
return true;
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index d069e00..8a0d146 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -134,6 +134,7 @@
private AlertDialog mOptionsDialog;
+ private InputMethodManager mImm;
private KeyboardSwitcher mKeyboardSwitcher;
private SubtypeSwitcher mSubtypeSwitcher;
private VoiceIMEConnector mVoiceConnector;
@@ -147,9 +148,8 @@
private final StringBuilder mComposing = new StringBuilder();
private WordComposer mWord = new WordComposer();
- private int mCommittedLength;
- private boolean mPredicting;
private CharSequence mBestWord;
+ private boolean mPredicting;
private boolean mPredictionOn;
private boolean mCompletionOn;
private boolean mHasDictionary;
@@ -164,13 +164,14 @@
private boolean mPopupOn;
private boolean mAutoCap;
private boolean mQuickFixes;
- private int mCorrectionMode;
- private int mOrientation;
- private List<CharSequence> mSuggestPuncList;
+ private int mCorrectionMode;
+ private int mCommittedLength;
+ private int mOrientation;
// Keep track of the last selection range to decide if we need to show word alternatives
- private int mLastSelectionStart;
- private int mLastSelectionEnd;
+ private int mLastSelectionStart;
+ private int mLastSelectionEnd;
+ private List<CharSequence> mSuggestPuncList;
// Input type is such that we should not auto-correct
private boolean mInputTypeNoAutoCorrect;
@@ -337,6 +338,7 @@
super.onCreate();
//setStatusIcon(R.drawable.ime_qwerty);
mResources = getResources();
+ mImm = ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE));
final Configuration conf = mResources.getConfiguration();
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
@@ -1041,14 +1043,9 @@
}
}
- private void showInputMethodSubtypePicker() {
- ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
- .showInputMethodSubtypePicker();
- }
-
private void onOptionKeyPressed() {
if (!isShowingOptionDialog()) {
- if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) {
+ if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
showOptionsMenu();
} else {
launchSettings();
@@ -1058,8 +1055,8 @@
private void onOptionKeyLongPressed() {
if (!isShowingOptionDialog()) {
- if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) {
- showInputMethodSubtypePicker();
+ if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
+ mImm.showInputMethodPicker();
} else {
launchSettings();
}
@@ -2177,7 +2174,7 @@
launchSettings();
break;
case POS_METHOD:
- showInputMethodSubtypePicker();
+ mImm.showInputMethodPicker();
break;
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java
index e392bfd..4db1ec5 100644
--- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java
+++ b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java
@@ -91,9 +91,11 @@
}
}
- public static boolean hasMultipleEnabledIMEs(Context context) {
- return ((InputMethodManager) context.getSystemService(
- Context.INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1;
+ public static boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManager imm) {
+ return imm.getEnabledInputMethodList().size() > 1
+ // imm.getEnabledInputMethodSubtypeList(null) will return the current IME's enabled input
+ // method subtype (The current IME should be LatinIME.)
+ || imm.getEnabledInputMethodSubtypeList(null).size() > 1;
}
/* package */ static class RingCharBuffer {