Back to project page Freebloks-Android.
The source code is released under:
GNU General Public License
If you think the Android project Freebloks-Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.saschahlusiak.freebloks.preferences; //w w w . j a v a 2 s . co m import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Bundle; import android.preference.ListPreference; import android.preference.PreferenceFragment; import de.saschahlusiak.freebloks.R; public class DisplayFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences_display); } @Override public void onResume() { SharedPreferences prefs = getPreferenceScreen().getSharedPreferences(); onSharedPreferenceChanged(prefs, "theme"); onSharedPreferenceChanged(prefs, "animations"); prefs.registerOnSharedPreferenceChangeListener(this); super.onResume(); } @Override public void onPause() { getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); super.onPause(); } @Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if (key.equals("theme") || key.equals("animations")) { ListPreference pref = (ListPreference)findPreference(key); pref.setSummary(pref.getEntry()); } } }