aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-05-08 12:04:36 +0900
committerTadashi G. Takaoka <takaoka@google.com>2014-05-09 16:21:02 +0900
commit19688b584bb903192559196a0e3836bc4c957696 (patch)
tree3feaea37a1a86cfc56373366b1c670bebe00a347 /java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
parent28ebe2db237b5e0b5989ebcca644f469ecda66e3 (diff)
downloadlatinime-19688b584bb903192559196a0e3836bc4c957696.tar.gz
latinime-19688b584bb903192559196a0e3836bc4c957696.tar.xz
latinime-19688b584bb903192559196a0e3836bc4c957696.zip
Refactor KeyboardTheme
This CL introduces two preference keys in addition to the existing one. - pref_keyboard_theme: The new preference key that is used only in the preference settings. - pref_keyboard_layout_20110916: The previous preference key that holds keyboard color scheme settings. This is superseded by the next key. - pref_keyboard_theme_20140509: The new preference key that holds keyboard theme settings. This value is forcibly reset to LMP theme on a LMP device. On a KitKat and previous device, the settings of the pref_keyboard_layout_20110916 is carried on into this preference. This CL must be checked in together with Ifcedeabbec. Change-Id: Ibe75146e2c1c7eebf964ca86550baf244fedb79a
Diffstat (limited to 'java/src/com/android/inputmethod/latin/settings/SettingsFragment.java')
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsFragment.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
index 22cbd204c..e1d38e7c4 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java
@@ -37,6 +37,7 @@ import android.util.Log;
import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.dictionarypack.DictionarySettingsActivity;
+import com.android.inputmethod.keyboard.KeyboardTheme;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher;
@@ -253,11 +254,31 @@ public final class SettingsFragment extends InputMethodSettingsFragment
}
updateListPreferenceSummaryToCurrentValue(Settings.PREF_SHOW_SUGGESTIONS_SETTING);
updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
- updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_LAYOUT);
+ final ListPreference keyboardThemePref = (ListPreference)findPreference(
+ Settings.PREF_KEYBOARD_THEME);
+ if (keyboardThemePref != null) {
+ final KeyboardTheme keyboardTheme = KeyboardTheme.getKeyboardTheme(prefs);
+ final String value = Integer.toString(keyboardTheme.mThemeId);
+ final CharSequence entries[] = keyboardThemePref.getEntries();
+ final int entryIndex = keyboardThemePref.findIndexOfValue(value);
+ keyboardThemePref.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
+ keyboardThemePref.setValue(value);
+ }
updateCustomInputStylesSummary(prefs, res);
}
@Override
+ public void onPause() {
+ super.onPause();
+ final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
+ final ListPreference keyboardThemePref = (ListPreference)findPreference(
+ Settings.PREF_KEYBOARD_THEME);
+ if (keyboardThemePref != null) {
+ KeyboardTheme.saveKeyboardThemeId(keyboardThemePref.getValue(), prefs);
+ }
+ }
+
+ @Override
public void onDestroy() {
getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(
this);
@@ -287,7 +308,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
ensureConsistencyOfAutoCorrectionSettings();
updateListPreferenceSummaryToCurrentValue(Settings.PREF_SHOW_SUGGESTIONS_SETTING);
updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
- updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_LAYOUT);
+ updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEYBOARD_THEME);
refreshEnablingsOfKeypressSoundAndVibrationSettings(prefs, getResources());
}