diff options
author | Amith Yamasani <yamasani@google.com> | 2012-05-07 18:11:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-07 18:11:28 -0700 |
commit | 184ae2c3f2339fdbf7c5e538855c0e1afbf58e9e (patch) | |
tree | d58458d384665bedbe6a2e6e0c2a1fe59f71281d | |
parent | 63f7f5cda5481f613cf4fc32bf3c3531d731fa59 (diff) | |
parent | f6d8961843f5b977640146dd5dc8872eaab60ce7 (diff) | |
download | packages_apps_settings-184ae2c3f2339fdbf7c5e538855c0e1afbf58e9e.zip packages_apps_settings-184ae2c3f2339fdbf7c5e538855c0e1afbf58e9e.tar.gz packages_apps_settings-184ae2c3f2339fdbf7c5e538855c0e1afbf58e9e.tar.bz2 |
Merge "Reduce the amount of I/O done on the UI thread." into jb-dev
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodPreference.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java index 90eef85..6402dff 100644 --- a/src/com/android/settings/inputmethod/InputMethodPreference.java +++ b/src/com/android/settings/inputmethod/InputMethodPreference.java @@ -66,10 +66,10 @@ public class InputMethodPreference extends CheckBoxPreference return; } if (isChecked()) { - setChecked(false); + setChecked(false, true /* save */); } else { if (mAlwaysChecked) { - setChecked(true); + setChecked(true, true /* save */); } else { showSecurityWarnDialog(mImi, InputMethodPreference.this); } @@ -222,14 +222,25 @@ public class InputMethodPreference extends CheckBoxPreference setSummary(summary); } - @Override - public void setChecked(boolean checked) { + /** + * Sets the checkbox state and optionally saves the settings. + * @param checked whether to check the box + * @param save whether to save IME settings + */ + public void setChecked(boolean checked, boolean save) { super.setChecked(checked); - saveImeSettings(); + if (save) { + saveImeSettings(); + } updateSummary(); } - private void showSecurityWarnDialog(InputMethodInfo imi, final CheckBoxPreference chkPref) { + @Override + public void setChecked(boolean checked) { + setChecked(checked, false); + } + + private void showSecurityWarnDialog(InputMethodInfo imi, final InputMethodPreference chkPref) { if (mDialog != null && mDialog.isShowing()) { mDialog.dismiss(); } @@ -241,7 +252,7 @@ public class InputMethodPreference extends CheckBoxPreference new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - chkPref.setChecked(true); + chkPref.setChecked(true, true); } }) .setNegativeButton(android.R.string.cancel, |