diff options
author | Takazumi Matsumoto <tdr@taksmon.com> | 2012-11-28 08:28:21 -0500 |
---|---|---|
committer | Rick C <rickfitsnugly@gmail.com> | 2012-11-28 08:30:37 -0500 |
commit | 0bc27b8810f848bd2a5d2a36727b9cca4a606472 (patch) | |
tree | f84f9638c020ab2f8e676923267c9b9def8ee583 /src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | |
parent | c5bfd98fb06de146ef1b06d9b19b1a8fcc0e86d5 (diff) | |
download | packages_apps_settings-0bc27b8810f848bd2a5d2a36727b9cca4a606472.zip packages_apps_settings-0bc27b8810f848bd2a5d2a36727b9cca4a606472.tar.gz packages_apps_settings-0bc27b8810f848bd2a5d2a36727b9cca4a606472.tar.bz2 |
Settings: Fix NPE when CM IME switcher is disabled
Change-Id: I8c1dc5874accc6d1340dc46a58867d97f708aeb7
Diffstat (limited to 'src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java')
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index e5c308e..102c703 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -171,7 +171,15 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment mIm = (InputManager)getActivity().getSystemService(Context.INPUT_SERVICE); updateInputDevices(); - mStatusBarImeSwitcher = (CheckBoxPreference) findPreference(KEY_IME_SWITCHER); + // Enable or disable mStatusBarImeSwitcher based on boolean value: config_show_cmIMESwitcher + final Preference keyImeSwitcherPref = findPreference(KEY_IME_SWITCHER); + if (keyImeSwitcherPref != null) { + if (!getResources().getBoolean(com.android.internal.R.bool.config_show_cmIMESwitcher)) { + getPreferenceScreen().removePreference(keyImeSwitcherPref); + } else { + mStatusBarImeSwitcher = (CheckBoxPreference) keyImeSwitcherPref; + } + } // Spell Checker final Intent intent = new Intent(Intent.ACTION_MAIN); @@ -261,8 +269,10 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment } } - mStatusBarImeSwitcher.setChecked(Settings.System.getInt(getActivity().getContentResolver(), - Settings.System.STATUS_BAR_IME_SWITCHER, 1) != 0); + if (mStatusBarImeSwitcher != null) { + mStatusBarImeSwitcher.setChecked(Settings.System.getInt(getActivity().getContentResolver(), + Settings.System.STATUS_BAR_IME_SWITCHER, 1) != 0); + } // Hard keyboard if (!mHardKeyboardPreferenceList.isEmpty()) { |