@Override @SuppressWarnings("unchecked") public boolean onPreferenceChange(Preference preference, Object newValue) { Set<String> appListToBeExcluded = (HashSet<String>) newValue; prefs.edit().putStringSet("excluded-apps-from-history", appListToBeExcluded).apply(); loadExcludedFromHistoryAppsToPreference(multiPreference); if (hasNoExcludedFromHistoryApps()) { multiPreference.setDialogMessage(R.string.ui_excluded_apps_not_found); } return false; } });
@Override @SuppressWarnings("unchecked") public boolean onPreferenceChange(Preference preference, Object newValue) { // Duplicate then save to make sure we're not editing in place // (can't be done with sharedpreferences) Set<String> appListToBeExcluded = new HashSet<>((HashSet<String>) newValue); prefs.edit().putStringSet("excluded-apps", appListToBeExcluded).apply(); loadExcludedAppsToPreference(multiPreference); if (hasNoExcludedApps()) { multiPreference.setDialogMessage(R.string.ui_excluded_apps_not_found); } final AppProvider provider = KissApplication.getApplication(SettingsActivity.this).getDataHandler().getAppProvider(); if (provider != null) { provider.reload(); } return false; } });
@SuppressWarnings("deprecation") private void addExcludedFromHistoryAppSettings(final SharedPreferences prefs) { final MultiSelectListPreference multiPreference = new MultiSelectListPreference(this); multiPreference.setTitle(R.string.ui_excluded_from_history_apps); multiPreference.setDialogTitle(R.string.ui_excluded_apps_dialog_title); multiPreference.setKey("excluded_from_history_apps_ui"); multiPreference.setOrder(15); PreferenceGroup category = (PreferenceGroup) findPreference("exclude_apps_category"); category.addPreference(multiPreference); loadExcludedFromHistoryAppsToPreference(multiPreference); multiPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override @SuppressWarnings("unchecked") public boolean onPreferenceChange(Preference preference, Object newValue) { Set<String> appListToBeExcluded = (HashSet<String>) newValue; prefs.edit().putStringSet("excluded-apps-from-history", appListToBeExcluded).apply(); loadExcludedFromHistoryAppsToPreference(multiPreference); if (hasNoExcludedFromHistoryApps()) { multiPreference.setDialogMessage(R.string.ui_excluded_apps_not_found); } return false; } }); if (hasNoExcludedFromHistoryApps()) { multiPreference.setDialogMessage(R.string.ui_excluded_apps_not_found); } }
multiPreference.setDialogMessage(R.string.ui_excluded_apps_not_found);