Call showInputMethodPicker instead of showInputMethodSubtypePicker
- because showInputMethodSubtypePicker will be removed. Change-Id: I255f9bbff77de24ce067f35ee101d368e36edd45main
parent
1fb28137f4
commit
79efbed76f
|
@ -23,6 +23,7 @@ import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.InflateException;
|
import android.view.InflateException;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -746,7 +747,9 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
// 2) SETTINGS_KEY_MODE_AUTO and there are two or more enabled IMEs on the system
|
// 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))
|
if (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_ALWAYS_SHOW))
|
||||||
|| (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO))
|
|| (settingsKeyMode.equals(resources.getString(SETTINGS_KEY_MODE_AUTO))
|
||||||
&& LatinIMEUtil.hasMultipleEnabledIMEs(context))) {
|
&& LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(
|
||||||
|
((InputMethodManager) context.getSystemService(
|
||||||
|
Context.INPUT_METHOD_SERVICE))))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
private AlertDialog mOptionsDialog;
|
private AlertDialog mOptionsDialog;
|
||||||
|
|
||||||
|
private InputMethodManager mImm;
|
||||||
private KeyboardSwitcher mKeyboardSwitcher;
|
private KeyboardSwitcher mKeyboardSwitcher;
|
||||||
private SubtypeSwitcher mSubtypeSwitcher;
|
private SubtypeSwitcher mSubtypeSwitcher;
|
||||||
private VoiceIMEConnector mVoiceConnector;
|
private VoiceIMEConnector mVoiceConnector;
|
||||||
|
@ -147,9 +148,8 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
private final StringBuilder mComposing = new StringBuilder();
|
private final StringBuilder mComposing = new StringBuilder();
|
||||||
private WordComposer mWord = new WordComposer();
|
private WordComposer mWord = new WordComposer();
|
||||||
private int mCommittedLength;
|
|
||||||
private boolean mPredicting;
|
|
||||||
private CharSequence mBestWord;
|
private CharSequence mBestWord;
|
||||||
|
private boolean mPredicting;
|
||||||
private boolean mPredictionOn;
|
private boolean mPredictionOn;
|
||||||
private boolean mCompletionOn;
|
private boolean mCompletionOn;
|
||||||
private boolean mHasDictionary;
|
private boolean mHasDictionary;
|
||||||
|
@ -164,13 +164,14 @@ public class LatinIME extends InputMethodService
|
||||||
private boolean mPopupOn;
|
private boolean mPopupOn;
|
||||||
private boolean mAutoCap;
|
private boolean mAutoCap;
|
||||||
private boolean mQuickFixes;
|
private boolean mQuickFixes;
|
||||||
private int mCorrectionMode;
|
|
||||||
|
|
||||||
|
private int mCorrectionMode;
|
||||||
|
private int mCommittedLength;
|
||||||
private int mOrientation;
|
private int mOrientation;
|
||||||
private List<CharSequence> mSuggestPuncList;
|
|
||||||
// Keep track of the last selection range to decide if we need to show word alternatives
|
// Keep track of the last selection range to decide if we need to show word alternatives
|
||||||
private int mLastSelectionStart;
|
private int mLastSelectionStart;
|
||||||
private int mLastSelectionEnd;
|
private int mLastSelectionEnd;
|
||||||
|
private List<CharSequence> mSuggestPuncList;
|
||||||
|
|
||||||
// Input type is such that we should not auto-correct
|
// Input type is such that we should not auto-correct
|
||||||
private boolean mInputTypeNoAutoCorrect;
|
private boolean mInputTypeNoAutoCorrect;
|
||||||
|
@ -337,6 +338,7 @@ public class LatinIME extends InputMethodService
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
//setStatusIcon(R.drawable.ime_qwerty);
|
//setStatusIcon(R.drawable.ime_qwerty);
|
||||||
mResources = getResources();
|
mResources = getResources();
|
||||||
|
mImm = ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE));
|
||||||
final Configuration conf = mResources.getConfiguration();
|
final Configuration conf = mResources.getConfiguration();
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
mSubtypeSwitcher = SubtypeSwitcher.getInstance();
|
||||||
|
@ -1041,14 +1043,9 @@ public class LatinIME extends InputMethodService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showInputMethodSubtypePicker() {
|
|
||||||
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
|
|
||||||
.showInputMethodSubtypePicker();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onOptionKeyPressed() {
|
private void onOptionKeyPressed() {
|
||||||
if (!isShowingOptionDialog()) {
|
if (!isShowingOptionDialog()) {
|
||||||
if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) {
|
if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
|
||||||
showOptionsMenu();
|
showOptionsMenu();
|
||||||
} else {
|
} else {
|
||||||
launchSettings();
|
launchSettings();
|
||||||
|
@ -1058,8 +1055,8 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
private void onOptionKeyLongPressed() {
|
private void onOptionKeyLongPressed() {
|
||||||
if (!isShowingOptionDialog()) {
|
if (!isShowingOptionDialog()) {
|
||||||
if (LatinIMEUtil.hasMultipleEnabledIMEs(this)) {
|
if (LatinIMEUtil.hasMultipleEnabledIMEsOrSubtypes(mImm)) {
|
||||||
showInputMethodSubtypePicker();
|
mImm.showInputMethodPicker();
|
||||||
} else {
|
} else {
|
||||||
launchSettings();
|
launchSettings();
|
||||||
}
|
}
|
||||||
|
@ -2177,7 +2174,7 @@ public class LatinIME extends InputMethodService
|
||||||
launchSettings();
|
launchSettings();
|
||||||
break;
|
break;
|
||||||
case POS_METHOD:
|
case POS_METHOD:
|
||||||
showInputMethodSubtypePicker();
|
mImm.showInputMethodPicker();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,11 @@ public class LatinIMEUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasMultipleEnabledIMEs(Context context) {
|
public static boolean hasMultipleEnabledIMEsOrSubtypes(InputMethodManager imm) {
|
||||||
return ((InputMethodManager) context.getSystemService(
|
return imm.getEnabledInputMethodList().size() > 1
|
||||||
Context.INPUT_METHOD_SERVICE)).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 {
|
/* package */ static class RingCharBuffer {
|
||||||
|
|
Loading…
Reference in New Issue