diff options
author | Tadashi G. Takaoka <takaoka@google.com> | 2014-07-21 22:24:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-21 15:42:19 +0000 |
commit | 40aeac90f10c7ab6bd52e7200513b2eda7129904 (patch) | |
tree | fb106e27c7dd200e9b8b0b9f45f9e469fb86b976 /src/com/android | |
parent | fca31ca418ec9c8d09efd18d7616b816a3e9f94a (diff) | |
parent | 229ed1a784a78a713908a0f452238c7345920aaf (diff) | |
download | packages_apps_Settings-40aeac90f10c7ab6bd52e7200513b2eda7129904.tar.gz packages_apps_Settings-40aeac90f10c7ab6bd52e7200513b2eda7129904.tar.bz2 packages_apps_Settings-40aeac90f10c7ab6bd52e7200513b2eda7129904.zip |
Merge "Remove unused and unnecessary code from subtype enabler" into lmp-dev
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java index d14d08b56..4019bb4ed 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java +++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeEnabler.java @@ -16,9 +16,7 @@ package com.android.settings.inputmethod; -import android.app.AlertDialog; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; @@ -32,7 +30,6 @@ import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodSubtype; -import com.android.internal.inputmethod.InputMethodUtils; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; @@ -52,7 +49,6 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { // TODO: Change mInputMethodInfoList to Map private List<InputMethodInfo> mInputMethodInfoList; private Collator mCollator; - private AlertDialog mDialog = null; @Override public void onCreate(final Bundle icicle) { @@ -142,82 +138,15 @@ public class InputMethodAndSubtypeEnabler extends SettingsPreferenceFragment { } } - final String id = chkPref.getKey(); // Turns off a subtype. if (!chkPref.isChecked()) { - // TODO: Because no preference on this screen has {@link InputMethodInfo} id as a key, - // the following setSubtypesPreferenceEnabled call is effectively no-operation and - // can be removed. - InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( - this, mInputMethodInfoList, id, false); updateAutoSelectionPreferences(); return super.onPreferenceTreeClick(preferenceScreen, preference); } - // Turns on a subtype. - final InputMethodInfo imi = getInputMethodInfoById(id); - // TODO: Because no preference on this screen has {@link InputMethodInfo} id as a key, - // <code>imi</code> is always null and the following code can be removed. - if (imi == null) { - return super.onPreferenceTreeClick(preferenceScreen, preference); - } - // Turns on a system IME's subtype. - if (InputMethodUtils.isSystemIme(imi)) { - InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( - this, mInputMethodInfoList, id, true); - // This is a built-in IME, so no need to warn. - return super.onPreferenceTreeClick(preferenceScreen, preference); - } - // Turns on a 3rd party IME's subtype. - // Turns off a subtype before showing a security warning dialog. - chkPref.setChecked(false); - if (mDialog != null && mDialog.isShowing()) { - mDialog.dismiss(); - } - final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder.setCancelable(true); - builder.setTitle(android.R.string.dialog_alert_title); - final CharSequence label = imi.getServiceInfo().applicationInfo - .loadLabel(getPackageManager()); - builder.setMessage(getString(R.string.ime_security_warning, label)); - builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) { - // The user explicitly enable the subtype. - chkPref.setChecked(true); - InputMethodAndSubtypeUtil.setSubtypesPreferenceEnabled( - InputMethodAndSubtypeEnabler.this, mInputMethodInfoList, id, true); - } - }); - builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { - @Override - public void onClick(final DialogInterface dialog, final int which) {} - }); - mDialog = builder.create(); - mDialog.show(); return super.onPreferenceTreeClick(preferenceScreen, preference); } - private InputMethodInfo getInputMethodInfoById(final String imiId) { - final int imiCount = mInputMethodInfoList.size(); - for (int index = 0; index < imiCount; ++index) { - final InputMethodInfo imi = mInputMethodInfoList.get(index); - if (imi.getId().equals(imiId)) { - return imi; - } - } - return null; - } - - @Override - public void onDestroy() { - super.onDestroy(); - if (mDialog != null) { - mDialog.dismiss(); - mDialog = null; - } - } - private void addInputMethodSubtypePreferences(final InputMethodInfo imi, final PreferenceScreen root) { final Context context = getActivity(); |