public static void sync(PreferenceManager preferenceManager, String key) { Preference pref = preferenceManager.findPreference(key); if (pref instanceof ListPreference) { ListPreference listPref = (ListPreference) pref; pref.setSummary(listPref.getEntry()); } }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof SeekBarPreferenceDialog) { int id = 0; if (preference.getKey().equals(Constants.KEY_NAVBAR_ALPHA)) id = R.string.pref_navbar_opacity; else if (preference.getKey().equals(Constants.KEY_NAVBAR_DELAY)) id = R.string.pref_navbar_delay; else if (preference.getKey().equals(Constants.KEY_NAVBAR_DURATION)) id = R.string.pref_listview_duration_summary; if (id != 0) preference.setSummary(getString(id, stringValue)); } else preference.setSummary(stringValue); if (!mIsLoading) XPastaHelpers.sendSettingsChanged(getActivity()); return true; }