diff options
author | 2014-04-29 11:34:28 -0700 | |
---|---|---|
committer | 2014-04-29 11:34:28 -0700 | |
commit | 2debf168920bb852b1583446fc336743f98b3c04 (patch) | |
tree | 7324a335fb65fcc585695d7d061b04aeba64be10 /java/src/com/android/inputmethod/latin/settings/SettingsFragment.java | |
parent | 5c36065b74852857b3cc520d7be5df9413937cd9 (diff) | |
parent | 5df8b42709662b0e599019e4fd17c4e153ff6b47 (diff) | |
download | latinime-2debf168920bb852b1583446fc336743f98b3c04.tar.gz latinime-2debf168920bb852b1583446fc336743f98b3c04.tar.xz latinime-2debf168920bb852b1583446fc336743f98b3c04.zip |
Merge commit '5df8b42709662b0e599019e4fd17c4e153ff6b47' into HEAD
Diffstat (limited to 'java/src/com/android/inputmethod/latin/settings/SettingsFragment.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/settings/SettingsFragment.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java index cb7dda655..5c60a7350 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java @@ -255,6 +255,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment } updateShowCorrectionSuggestionsSummary(); updateKeyPreviewPopupDelaySummary(); + updateColorSchemeSummary(prefs, getResources()); updateCustomInputStylesSummary(); } @@ -288,6 +289,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment ensureConsistencyOfAutoCorrectionSettings(); updateShowCorrectionSuggestionsSummary(); updateKeyPreviewPopupDelaySummary(); + updateColorSchemeSummary(prefs, res); refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, getResources()); } @@ -305,6 +307,25 @@ public final class SettingsFragment extends InputMethodSettingsFragment mShowCorrectionSuggestionsPreference.getValue())]); } + private void updateColorSchemeSummary(final SharedPreferences prefs, final Resources res) { + // Because the "%s" summary trick of {@link ListPreference} doesn't work properly before + // KitKat, we need to update the summary by code. + final Preference preference = findPreference(Settings.PREF_KEYBOARD_LAYOUT); + if (!(preference instanceof ListPreference)) { + Log.w(TAG, "Can't find Keyboard Color Scheme preference"); + return; + } + final ListPreference colorSchemePreference = (ListPreference)preference; + final int themeIndex = Settings.readKeyboardThemeIndex(prefs, res); + int entryIndex = colorSchemePreference.findIndexOfValue(Integer.toString(themeIndex)); + if (entryIndex < 0) { + final int defaultThemeIndex = Settings.resetAndGetDefaultKeyboardThemeIndex(prefs, res); + entryIndex = colorSchemePreference.findIndexOfValue( + Integer.toString(defaultThemeIndex)); + } + colorSchemePreference.setSummary(colorSchemePreference.getEntries()[entryIndex]); + } + private void updateCustomInputStylesSummary() { final PreferenceScreen customInputStyles = (PreferenceScreen)findPreference(Settings.PREF_CUSTOM_INPUT_STYLES); |