private void fixSummaries(SharedPreferences prefs) { int historyLength = KissApplication.getDataHandler(this).getHistoryLength(this); if (historyLength > 5) { findPreference("reset") .setSummary(getString(R.string.reset_desc) + " (" + historyLength + " items)"); } }
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (requireRestartSettings.contains(key)) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean("require-layout-update", true).commit(); // Restart current activity to refresh view, since some // preferences // require using a new UI Intent intent = new Intent(this, getClass()); intent.addFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION); finish(); overridePendingTransition(0, 0); startActivity(intent); overridePendingTransition(0, 0); return; } if (!safeSettings.contains(key)) { // Reload the DataHandler since Providers preferences have changed KissApplication.resetDataHandler(this); } }