Add TODO comments to Language & input settings

Bug: 16115751
Change-Id: I7bc426b95af214374db98c35314f4893dabfb2d4
This commit is contained in:
Tadashi G. Takaoka
2014-07-09 14:59:19 +09:00
parent 7804a40d86
commit d2dd7d33c9
10 changed files with 56 additions and 74 deletions

View File

@@ -238,11 +238,6 @@
<item name="android:singleLine">true</item> <item name="android:singleLine">true</item>
</style> </style>
<style name="InputMethodPreferenceStyle">
<item name="android:layout">@layout/preference_inputmethod</item>
<item name="android:widgetLayout">@layout/preference_inputmethod_widget</item>
</style>
<style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Material.Small"> <style name="TextAppearance.PagerTabs" parent="@android:style/TextAppearance.Material.Small">
<item name="android:textAllCaps">true</item> <item name="android:textAllCaps">true</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>

View File

@@ -29,7 +29,8 @@ import android.view.View.OnClickListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
public class CheckBoxAndSettingsPreference extends CheckBoxPreference { // TODO: Make this non-persistent.
class CheckBoxAndSettingsPreference extends CheckBoxPreference {
private SettingsPreferenceFragment mFragment; private SettingsPreferenceFragment mFragment;
private TextView mTitleText; private TextView mTitleText;

View File

@@ -70,7 +70,6 @@ import java.util.TreeSet;
public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
implements Preference.OnPreferenceChangeListener, InputManager.InputDeviceListener, implements Preference.OnPreferenceChangeListener, InputManager.InputDeviceListener,
KeyboardLayoutDialogFragment.OnSetupKeyboardLayoutsListener, Indexable { KeyboardLayoutDialogFragment.OnSetupKeyboardLayoutsListener, Indexable {
private static final String KEY_PHONE_LANGUAGE = "phone_language"; private static final String KEY_PHONE_LANGUAGE = "phone_language";
private static final String KEY_CURRENT_INPUT_METHOD = "current_input_method"; private static final String KEY_CURRENT_INPUT_METHOD = "current_input_method";
private static final String KEY_INPUT_METHOD_SELECTOR = "input_method_selector"; private static final String KEY_INPUT_METHOD_SELECTOR = "input_method_selector";
@@ -92,10 +91,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
private PreferenceCategory mHardKeyboardCategory; private PreferenceCategory mHardKeyboardCategory;
private PreferenceCategory mGameControllerCategory; private PreferenceCategory mGameControllerCategory;
private Preference mLanguagePref; private Preference mLanguagePref;
private final ArrayList<InputMethodPreference> mInputMethodPreferenceList = private final ArrayList<InputMethodPreference> mInputMethodPreferenceList = new ArrayList<>();
new ArrayList<InputMethodPreference>(); private final ArrayList<PreferenceScreen> mHardKeyboardPreferenceList = new ArrayList<>();
private final ArrayList<PreferenceScreen> mHardKeyboardPreferenceList =
new ArrayList<PreferenceScreen>();
private InputManager mIm; private InputManager mIm;
private InputMethodManager mImm; private InputMethodManager mImm;
private boolean mIsOnlyImeSettings; private boolean mIsOnlyImeSettings;
@@ -467,7 +464,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
final CharSequence curIme = final CharSequence curIme =
mInputMethodSettingValues.getCurrentInputMethodName(context); mInputMethodSettingValues.getCurrentInputMethodName(context);
if (!TextUtils.isEmpty(curIme)) { if (!TextUtils.isEmpty(curIme)) {
synchronized(this) { synchronized (this) {
curPref.setSummary(curIme); curPref.setSummary(curIme);
} }
} }
@@ -488,8 +485,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
} }
// Add a check box for enabling/disabling IME // Add a check box for enabling/disabling IME
final InputMethodPreference pref = final InputMethodPreference pref = new InputMethodPreference(this, intent, mImm, imi);
new InputMethodPreference(this, intent, mImm, imi);
pref.setKey(imi.getId()); pref.setKey(imi.getId());
pref.setTitle(label); pref.setTitle(label);
return pref; return pref;
@@ -557,8 +553,8 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
} }
private void showKeyboardLayoutDialog(InputDeviceIdentifier inputDeviceIdentifier) { private void showKeyboardLayoutDialog(InputDeviceIdentifier inputDeviceIdentifier) {
KeyboardLayoutDialogFragment fragment = KeyboardLayoutDialogFragment fragment = new KeyboardLayoutDialogFragment(
new KeyboardLayoutDialogFragment(inputDeviceIdentifier); inputDeviceIdentifier);
fragment.setTargetFragment(this, 0); fragment.setTargetFragment(this, 0);
fragment.show(getActivity().getFragmentManager(), "keyboardLayout"); fragment.show(getActivity().getFragmentManager(), "keyboardLayout");
} }
@@ -638,7 +634,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment
new BaseSearchIndexProvider() { new BaseSearchIndexProvider() {
@Override @Override
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) { public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
List<SearchIndexableRaw> indexables = new ArrayList<SearchIndexableRaw>(); List<SearchIndexableRaw> indexables = new ArrayList<>();
Resources resources = context.getResources(); Resources resources = context.getResources();
String screenTitle = context.getString(R.string.language_keyboard_settings_title); String screenTitle = context.getString(R.string.language_keyboard_settings_title);

View File

@@ -40,7 +40,6 @@ import android.view.inputmethod.InputMethodSubtype;
import java.text.Collator; import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@@ -50,9 +49,8 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
private AlertDialog mDialog = null; private AlertDialog mDialog = null;
private boolean mHaveHardKeyboard; private boolean mHaveHardKeyboard;
final private HashMap<String, List<Preference>> mInputMethodAndSubtypePrefsMap = final private HashMap<String, List<Preference>> mInputMethodAndSubtypePrefsMap =
new HashMap<String, List<Preference>>(); new HashMap<>();
final private HashMap<String, CheckBoxPreference> mSubtypeAutoSelectionCBMap = final private HashMap<String, CheckBoxPreference> mSubtypeAutoSelectionCBMap = new HashMap<>();
new HashMap<String, CheckBoxPreference>();
private InputMethodManager mImm; private InputMethodManager mImm;
private List<InputMethodInfo> mInputMethodProperties; private List<InputMethodInfo> mInputMethodProperties;
private String mInputMethodId; private String mInputMethodId;
@@ -256,7 +254,7 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment {
boolean isAutoSubtype = false; boolean isAutoSubtype = false;
CharSequence autoSubtypeLabel = null; CharSequence autoSubtypeLabel = null;
final ArrayList<Preference> subtypePreferences = new ArrayList<Preference>(); final ArrayList<Preference> subtypePreferences = new ArrayList<>();
if (subtypeCount > 0) { if (subtypeCount > 0) {
for (int j = 0; j < subtypeCount; ++j) { for (int j = 0; j < subtypeCount; ++j) {
final InputMethodSubtype subtype = imi.getSubtypeAt(j); final InputMethodSubtype subtype = imi.getSubtypeAt(j);

View File

@@ -20,19 +20,19 @@ import android.content.Intent;
import com.android.settings.SettingsActivity; import com.android.settings.SettingsActivity;
public class InputMethodAndSubtypeEnablerActivity extends SettingsActivity { public class InputMethodAndSubtypeEnablerActivity extends SettingsActivity {
private static final String FRAGMENT_NAME = InputMethodAndSubtypeEnabler.class.getName();
@Override @Override
public Intent getIntent() { public Intent getIntent() {
final Intent modIntent = new Intent(super.getIntent()); final Intent modIntent = new Intent(super.getIntent());
if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) { if (!modIntent.hasExtra(EXTRA_SHOW_FRAGMENT)) {
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, InputMethodAndSubtypeEnabler.class.getName()); modIntent.putExtra(EXTRA_SHOW_FRAGMENT, FRAGMENT_NAME);
} }
return modIntent; return modIntent;
} }
@Override @Override
protected boolean isValidFragment(String fragmentName) { protected boolean isValidFragment(String fragmentName) {
if (InputMethodAndSubtypeEnabler.class.getName().equals(fragmentName)) return true; return FRAGMENT_NAME.equals(fragmentName);
return false;
} }
} }

View File

@@ -35,7 +35,8 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class InputMethodAndSubtypeUtil { // TODO: Consolidate this with {@link InputMethodSettingValuesWrapper}.
class InputMethodAndSubtypeUtil {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
static final String TAG = "InputMethdAndSubtypeUtil"; static final String TAG = "InputMethdAndSubtypeUtil";
@@ -50,8 +51,8 @@ public class InputMethodAndSubtypeUtil {
private static final TextUtils.SimpleStringSplitter sStringInputMethodSubtypeSplitter private static final TextUtils.SimpleStringSplitter sStringInputMethodSubtypeSplitter
= new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATER); = new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATER);
private static void buildEnabledInputMethodsString( private static void buildEnabledInputMethodsString(StringBuilder builder, String imi,
StringBuilder builder, String imi, HashSet<String> subtypes) { HashSet<String> subtypes) {
builder.append(imi); builder.append(imi);
// Inputmethod and subtypes are saved in the settings as follows: // Inputmethod and subtypes are saved in the settings as follows:
// ime0;subtype0;subtype1:ime1;subtype0:ime2:ime3;subtype0;subtype1 // ime0;subtype0;subtype1:ime1;subtype0:ime2:ime3;subtype0;subtype1
@@ -60,8 +61,8 @@ public class InputMethodAndSubtypeUtil {
} }
} }
public static void buildInputMethodsAndSubtypesString( private static void buildInputMethodsAndSubtypesString(StringBuilder builder,
StringBuilder builder, HashMap<String, HashSet<String>> imsList) { HashMap<String, HashSet<String>> imsList) {
boolean needsAppendSeparator = false; boolean needsAppendSeparator = false;
for (String imi: imsList.keySet()) { for (String imi: imsList.keySet()) {
if (needsAppendSeparator) { if (needsAppendSeparator) {
@@ -73,8 +74,8 @@ public class InputMethodAndSubtypeUtil {
} }
} }
public static void buildDisabledSystemInputMethods( private static void buildDisabledSystemInputMethods(StringBuilder builder,
StringBuilder builder, HashSet<String> imes) { HashSet<String> imes) {
boolean needsAppendSeparator = false; boolean needsAppendSeparator = false;
for (String ime: imes) { for (String ime: imes) {
if (needsAppendSeparator) { if (needsAppendSeparator) {
@@ -108,8 +109,7 @@ public class InputMethodAndSubtypeUtil {
ContentResolver resolver) { ContentResolver resolver) {
final String enabledInputMethodsStr = Settings.Secure.getString( final String enabledInputMethodsStr = Settings.Secure.getString(
resolver, Settings.Secure.ENABLED_INPUT_METHODS); resolver, Settings.Secure.ENABLED_INPUT_METHODS);
HashMap<String, HashSet<String>> imsList HashMap<String, HashSet<String>> imsList = new HashMap<>();
= new HashMap<String, HashSet<String>>();
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "--- Load enabled input methods: " + enabledInputMethodsStr); Log.d(TAG, "--- Load enabled input methods: " + enabledInputMethodsStr);
} }
@@ -122,7 +122,7 @@ public class InputMethodAndSubtypeUtil {
String nextImsStr = sStringInputMethodSplitter.next(); String nextImsStr = sStringInputMethodSplitter.next();
sStringInputMethodSubtypeSplitter.setString(nextImsStr); sStringInputMethodSubtypeSplitter.setString(nextImsStr);
if (sStringInputMethodSubtypeSplitter.hasNext()) { if (sStringInputMethodSubtypeSplitter.hasNext()) {
HashSet<String> subtypeHashes = new HashSet<String>(); HashSet<String> subtypeHashes = new HashSet<>();
// The first element is ime id. // The first element is ime id.
String imeId = sStringInputMethodSubtypeSplitter.next(); String imeId = sStringInputMethodSubtypeSplitter.next();
while (sStringInputMethodSubtypeSplitter.hasNext()) { while (sStringInputMethodSubtypeSplitter.hasNext()) {
@@ -135,7 +135,7 @@ public class InputMethodAndSubtypeUtil {
} }
private static HashSet<String> getDisabledSystemIMEs(ContentResolver resolver) { private static HashSet<String> getDisabledSystemIMEs(ContentResolver resolver) {
HashSet<String> set = new HashSet<String>(); HashSet<String> set = new HashSet<>();
String disabledIMEsStr = Settings.Secure.getString( String disabledIMEsStr = Settings.Secure.getString(
resolver, Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS); resolver, Settings.Secure.DISABLED_SYSTEM_INPUT_METHODS);
if (TextUtils.isEmpty(disabledIMEsStr)) { if (TextUtils.isEmpty(disabledIMEsStr)) {
@@ -148,7 +148,7 @@ public class InputMethodAndSubtypeUtil {
return set; return set;
} }
public static void saveInputMethodSubtypeList(SettingsPreferenceFragment context, static void saveInputMethodSubtypeList(SettingsPreferenceFragment context,
ContentResolver resolver, List<InputMethodInfo> inputMethodInfos, ContentResolver resolver, List<InputMethodInfo> inputMethodInfos,
boolean hasHardKeyboard) { boolean hasHardKeyboard) {
String currentInputMethodId = Settings.Secure.getString(resolver, String currentInputMethodId = Settings.Secure.getString(resolver,
@@ -158,7 +158,6 @@ public class InputMethodAndSubtypeUtil {
getEnabledInputMethodsAndSubtypeList(resolver); getEnabledInputMethodsAndSubtypeList(resolver);
HashSet<String> disabledSystemIMEs = getDisabledSystemIMEs(resolver); HashSet<String> disabledSystemIMEs = getDisabledSystemIMEs(resolver);
final int imiCount = inputMethodInfos.size();
boolean needsToResetSelectedSubtype = false; boolean needsToResetSelectedSubtype = false;
for (InputMethodInfo imi : inputMethodInfos) { for (InputMethodInfo imi : inputMethodInfos) {
final String imiId = imi.getId(); final String imiId = imi.getId();
@@ -273,9 +272,8 @@ public class InputMethodAndSubtypeUtil {
currentInputMethodId != null ? currentInputMethodId : ""); currentInputMethodId != null ? currentInputMethodId : "");
} }
public static void loadInputMethodSubtypeList( static void loadInputMethodSubtypeList(SettingsPreferenceFragment context,
SettingsPreferenceFragment context, ContentResolver resolver, ContentResolver resolver, List<InputMethodInfo> inputMethodInfos,
List<InputMethodInfo> inputMethodInfos,
final Map<String, List<Preference>> inputMethodPrefsMap) { final Map<String, List<Preference>> inputMethodPrefsMap) {
HashMap<String, HashSet<String>> enabledSubtypes = HashMap<String, HashSet<String>> enabledSubtypes =
getEnabledInputMethodsAndSubtypeList(resolver); getEnabledInputMethodsAndSubtypeList(resolver);
@@ -298,7 +296,7 @@ public class InputMethodAndSubtypeUtil {
updateSubtypesPreferenceChecked(context, inputMethodInfos, enabledSubtypes); updateSubtypesPreferenceChecked(context, inputMethodInfos, enabledSubtypes);
} }
public static void setSubtypesPreferenceEnabled(SettingsPreferenceFragment context, static void setSubtypesPreferenceEnabled(SettingsPreferenceFragment context,
List<InputMethodInfo> inputMethodProperties, String id, boolean enabled) { List<InputMethodInfo> inputMethodProperties, String id, boolean enabled) {
PreferenceScreen preferenceScreen = context.getPreferenceScreen(); PreferenceScreen preferenceScreen = context.getPreferenceScreen();
for (InputMethodInfo imi : inputMethodProperties) { for (InputMethodInfo imi : inputMethodProperties) {
@@ -316,7 +314,7 @@ public class InputMethodAndSubtypeUtil {
} }
} }
public static void updateSubtypesPreferenceChecked(SettingsPreferenceFragment context, private static void updateSubtypesPreferenceChecked(SettingsPreferenceFragment context,
List<InputMethodInfo> inputMethodProperties, List<InputMethodInfo> inputMethodProperties,
HashMap<String, HashSet<String>> enabledSubtypes) { HashMap<String, HashSet<String>> enabledSubtypes) {
PreferenceScreen preferenceScreen = context.getPreferenceScreen(); PreferenceScreen preferenceScreen = context.getPreferenceScreen();

View File

@@ -47,7 +47,8 @@ import android.widget.Toast;
import java.text.Collator; import java.text.Collator;
import java.util.List; import java.util.List;
public class InputMethodPreference extends CheckBoxPreference { // TODO: Make this non-persistent.
class InputMethodPreference extends CheckBoxPreference {
private static final String TAG = InputMethodPreference.class.getSimpleName(); private static final String TAG = InputMethodPreference.class.getSimpleName();
private final SettingsPreferenceFragment mFragment; private final SettingsPreferenceFragment mFragment;
private final InputMethodInfo mImi; private final InputMethodInfo mImi;
@@ -84,7 +85,7 @@ public class InputMethodPreference extends CheckBoxPreference {
public InputMethodPreference(SettingsPreferenceFragment fragment, Intent settingsIntent, public InputMethodPreference(SettingsPreferenceFragment fragment, Intent settingsIntent,
InputMethodManager imm, InputMethodInfo imi) { InputMethodManager imm, InputMethodInfo imi) {
super(fragment.getActivity(), null, R.style.InputMethodPreferenceStyle); super(fragment.getActivity());
setLayoutResource(R.layout.preference_inputmethod); setLayoutResource(R.layout.preference_inputmethod);
setWidgetLayoutResource(R.layout.preference_inputmethod_widget); setWidgetLayoutResource(R.layout.preference_inputmethod_widget);
mFragment = fragment; mFragment = fragment;

View File

@@ -39,22 +39,20 @@ import java.util.Locale;
* manually on some events when "InputMethodInfo"s and "InputMethodSubtype"s can be * manually on some events when "InputMethodInfo"s and "InputMethodSubtype"s can be
* changed. * changed.
*/ */
public class InputMethodSettingValuesWrapper { // TODO: Consolidate this with {@link InputMethodAndSubtypeUtil}.
class InputMethodSettingValuesWrapper {
private static final String TAG = InputMethodSettingValuesWrapper.class.getSimpleName(); private static final String TAG = InputMethodSettingValuesWrapper.class.getSimpleName();
private static final Locale ENGLISH_LOCALE = new Locale("en");
private static volatile InputMethodSettingValuesWrapper sInstance; private static volatile InputMethodSettingValuesWrapper sInstance;
private final ArrayList<InputMethodInfo> mMethodList = new ArrayList<InputMethodInfo>(); private final ArrayList<InputMethodInfo> mMethodList = new ArrayList<>();
private final HashMap<String, InputMethodInfo> mMethodMap = private final HashMap<String, InputMethodInfo> mMethodMap = new HashMap<>();
new HashMap<String, InputMethodInfo>();
private final InputMethodSettings mSettings; private final InputMethodSettings mSettings;
private final InputMethodManager mImm; private final InputMethodManager mImm;
private final HashSet<InputMethodInfo> mAsciiCapableEnabledImis = private final HashSet<InputMethodInfo> mAsciiCapableEnabledImis = new HashSet<>();
new HashSet<InputMethodInfo>();
public static InputMethodSettingValuesWrapper getInstance(Context context) { static InputMethodSettingValuesWrapper getInstance(Context context) {
if (sInstance == null) { if (sInstance == null) {
synchronized(TAG) { synchronized (TAG) {
if (sInstance == null) { if (sInstance == null) {
sInstance = new InputMethodSettingValuesWrapper(context); sInstance = new InputMethodSettingValuesWrapper(context);
} }
@@ -74,14 +72,13 @@ public class InputMethodSettingValuesWrapper {
// Ensure singleton // Ensure singleton
private InputMethodSettingValuesWrapper(Context context) { private InputMethodSettingValuesWrapper(Context context) {
mSettings = mSettings = new InputMethodSettings(context.getResources(), context.getContentResolver(),
new InputMethodSettings(context.getResources(), context.getContentResolver(), mMethodMap, mMethodList, getDefaultCurrentUserId());
mMethodMap, mMethodList, getDefaultCurrentUserId());
mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
refreshAllInputMethodAndSubtypes(); refreshAllInputMethodAndSubtypes();
} }
public void refreshAllInputMethodAndSubtypes() { void refreshAllInputMethodAndSubtypes() {
synchronized (mMethodMap) { synchronized (mMethodMap) {
mMethodList.clear(); mMethodList.clear();
mMethodMap.clear(); mMethodMap.clear();
@@ -113,13 +110,13 @@ public class InputMethodSettingValuesWrapper {
} }
} }
public List<InputMethodInfo> getInputMethodList() { List<InputMethodInfo> getInputMethodList() {
synchronized (mMethodMap) { synchronized (mMethodMap) {
return mMethodList; return mMethodList;
} }
} }
public CharSequence getCurrentInputMethodName(Context context) { CharSequence getCurrentInputMethodName(Context context) {
synchronized (mMethodMap) { synchronized (mMethodMap) {
final InputMethodInfo imi = mMethodMap.get(mSettings.getSelectedInputMethod()); final InputMethodInfo imi = mMethodMap.get(mSettings.getSelectedInputMethod());
if (imi == null) { if (imi == null) {
@@ -131,7 +128,7 @@ public class InputMethodSettingValuesWrapper {
} }
} }
public boolean isAlwaysCheckedIme(InputMethodInfo imi, Context context) { boolean isAlwaysCheckedIme(InputMethodInfo imi, Context context) {
final boolean isEnabled = isEnabledImi(imi); final boolean isEnabled = isEnabledImi(imi);
synchronized (mMethodMap) { synchronized (mMethodMap) {
if (mSettings.getEnabledInputMethodListLocked().size() <= 1 && isEnabled) { if (mSettings.getEnabledInputMethodListLocked().size() <= 1 && isEnabled) {
@@ -158,7 +155,7 @@ public class InputMethodSettingValuesWrapper {
private int getEnabledValidSystemNonAuxAsciiCapableImeCount(Context context) { private int getEnabledValidSystemNonAuxAsciiCapableImeCount(Context context) {
int count = 0; int count = 0;
final List<InputMethodInfo> enabledImis; final List<InputMethodInfo> enabledImis;
synchronized(mMethodMap) { synchronized (mMethodMap) {
enabledImis = mSettings.getEnabledInputMethodListLocked(); enabledImis = mSettings.getEnabledInputMethodListLocked();
} }
for (final InputMethodInfo imi : enabledImis) { for (final InputMethodInfo imi : enabledImis) {
@@ -174,7 +171,7 @@ public class InputMethodSettingValuesWrapper {
private boolean isEnabledImi(InputMethodInfo imi) { private boolean isEnabledImi(InputMethodInfo imi) {
final List<InputMethodInfo> enabledImis; final List<InputMethodInfo> enabledImis;
synchronized(mMethodMap) { synchronized (mMethodMap) {
enabledImis = mSettings.getEnabledInputMethodListLocked(); enabledImis = mSettings.getEnabledInputMethodListLocked();
} }
for (final InputMethodInfo tempImi : enabledImis) { for (final InputMethodInfo tempImi : enabledImis) {
@@ -185,8 +182,7 @@ public class InputMethodSettingValuesWrapper {
return false; return false;
} }
public boolean isValidSystemNonAuxAsciiCapableIme(InputMethodInfo imi, boolean isValidSystemNonAuxAsciiCapableIme(InputMethodInfo imi, Context context) {
Context context) {
if (imi.isAuxiliaryIme()) { if (imi.isAuxiliaryIme()) {
return false; return false;
} }
@@ -196,7 +192,7 @@ public class InputMethodSettingValuesWrapper {
if (mAsciiCapableEnabledImis.isEmpty()) { if (mAsciiCapableEnabledImis.isEmpty()) {
Log.w(TAG, "ascii capable subtype enabled imi not found. Fall back to English" Log.w(TAG, "ascii capable subtype enabled imi not found. Fall back to English"
+ " Keyboard subtype."); + " Keyboard subtype.");
return InputMethodUtils.containsSubtypeOf(imi, ENGLISH_LOCALE.getLanguage(), return InputMethodUtils.containsSubtypeOf(imi, Locale.ENGLISH.getLanguage(),
InputMethodUtils.SUBTYPE_MODE_KEYBOARD); InputMethodUtils.SUBTYPE_MODE_KEYBOARD);
} }
return mAsciiCapableEnabledImis.contains(imi); return mAsciiCapableEnabledImis.contains(imi);

View File

@@ -34,10 +34,10 @@ import android.view.textservice.SpellCheckerSubtype;
import android.view.textservice.TextServicesManager; import android.view.textservice.TextServicesManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
public class SingleSpellCheckerPreference extends Preference { // TODO: Make this non-persistent.
class SingleSpellCheckerPreference extends Preference {
private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName(); private static final String TAG = SingleSpellCheckerPreference.class.getSimpleName();
private static final boolean DBG = false; private static final boolean DBG = false;
@@ -47,8 +47,6 @@ public class SingleSpellCheckerPreference extends Preference {
private final Resources mRes; private final Resources mRes;
private final TextServicesManager mTsm; private final TextServicesManager mTsm;
private AlertDialog mDialog = null; private AlertDialog mDialog = null;
private TextView mTitleText;
private TextView mSummaryText;
private View mPrefAll; private View mPrefAll;
private RadioButton mRadioButton; private RadioButton mRadioButton;
private View mPrefLeftButton; private View mPrefLeftButton;
@@ -88,8 +86,6 @@ public class SingleSpellCheckerPreference extends Preference {
onLeftButtonClicked(arg0); onLeftButtonClicked(arg0);
} }
}); });
mTitleText = (TextView)view.findViewById(android.R.id.title);
mSummaryText = (TextView)view.findViewById(android.R.id.summary);
mSubtypeButton = (ImageView)view.findViewById(R.id.pref_right_button2); mSubtypeButton = (ImageView)view.findViewById(R.id.pref_right_button2);
mSubtypeButton.setOnClickListener( mSubtypeButton.setOnClickListener(
new OnClickListener() { new OnClickListener() {

View File

@@ -20,7 +20,8 @@ import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.textservice.TextServicesManager; import android.view.textservice.TextServicesManager;
public class SpellCheckersPreference extends CheckBoxAndSettingsPreference { // TODO: Make this non-persistent.
class SpellCheckersPreference extends CheckBoxAndSettingsPreference {
private TextServicesManager mTsm; private TextServicesManager mTsm;
public SpellCheckersPreference(Context context) { public SpellCheckersPreference(Context context) {