diff options
Diffstat (limited to 'src/com/android/settings/inputmethod')
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index 182c1eb..c2ff0d9 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -225,6 +225,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment public void onResume() { super.onResume(); + mSettingsObserver.resume(); mIm.registerInputDeviceListener(this, null); if (!mIsOnlyImeSettings) { @@ -279,6 +280,7 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment super.onPause(); mIm.unregisterInputDeviceListener(this); + mSettingsObserver.pause(); if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) { mShowInputMethodSelectorPref.setOnPreferenceChangeListener(null); @@ -537,17 +539,27 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment } private class SettingsObserver extends ContentObserver { + private Context mContext; + public SettingsObserver(Handler handler, Context context) { super(handler); - final ContentResolver cr = context.getContentResolver(); + mContext = context; + } + + @Override public void onChange(boolean selfChange) { + updateCurrentImeName(); + } + + public void resume() { + final ContentResolver cr = mContext.getContentResolver(); cr.registerContentObserver( Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD), false, this); cr.registerContentObserver(Settings.Secure.getUriFor( Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE), false, this); } - @Override public void onChange(boolean selfChange) { - updateCurrentImeName(); + public void pause() { + mContext.getContentResolver().unregisterContentObserver(this); } } } |