diff options
author | Jean Chalard <jchalard@google.com> | 2011-07-21 18:33:20 +0900 |
---|---|---|
committer | Jean Chalard <jchalard@google.com> | 2011-07-21 20:30:17 +0900 |
commit | 410e75b15bd7ecfcb8985c4368fec5e355e2c099 (patch) | |
tree | 4b95caf44924cd116bdc897fe748de2fbd1edbf3 /src/com/android | |
parent | 212aa744edf10ba0acc1427d8e64b0bf55de6980 (diff) | |
download | packages_apps_settings-410e75b15bd7ecfcb8985c4368fec5e355e2c099.zip packages_apps_settings-410e75b15bd7ecfcb8985c4368fec5e355e2c099.tar.gz packages_apps_settings-410e75b15bd7ecfcb8985c4368fec5e355e2c099.tar.bz2 |
Remove the "user dictionary" settings entry if none
When the user dictionary service is not present or disabled,
the settings application should not be showing an entry to use it.
Bug: 5024166
Change-Id: Ic57d67eb03cf54e2c411fb0909c2a5d23d3e1fd7
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java | 7 | ||||
-rw-r--r-- | src/com/android/settings/inputmethod/UserDictionaryList.java | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java index 4ccebf0..e966ec7 100644 --- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java +++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java @@ -126,7 +126,12 @@ public class InputMethodAndLanguageSettings extends SettingsPreferenceFragment private void updateUserDictionaryPreference(Preference userDictionaryPreference) { final Activity activity = getActivity(); final Set<String> localeList = UserDictionaryList.getUserDictionaryLocalesList(activity); - if (localeList.size() <= 1) { + if (null == localeList) { + // The locale list is null if and only if the user dictionary service is + // not present or disabled. In this case we need to remove the preference. + ((PreferenceGroup)findPreference("language_settings_category")).removePreference( + userDictionaryPreference); + } else if (localeList.size() <= 1) { userDictionaryPreference.setTitle(R.string.user_dict_single_settings_title); userDictionaryPreference.setFragment(UserDictionarySettings.class.getName()); // If the size of localeList is 0, we don't set the locale parameter in the diff --git a/src/com/android/settings/inputmethod/UserDictionaryList.java b/src/com/android/settings/inputmethod/UserDictionaryList.java index c9a7ef9..e0afe48 100644 --- a/src/com/android/settings/inputmethod/UserDictionaryList.java +++ b/src/com/android/settings/inputmethod/UserDictionaryList.java @@ -49,7 +49,10 @@ public class UserDictionaryList extends SettingsPreferenceFragment { new String[] { UserDictionary.Words.LOCALE }, null, null, null); final Set<String> localeList = new TreeSet<String>(); - if (null != cursor && cursor.moveToFirst()) { + if (null == cursor) { + // The user dictionary service is not present or disabled. Return null. + return null; + } else if (cursor.moveToFirst()) { final int columnIndex = cursor.getColumnIndex(UserDictionary.Words.LOCALE); do { String locale = cursor.getString(columnIndex); |