androidx.preference.MultiSelectListPreference Java Examples
The following examples show how to use
androidx.preference.MultiSelectListPreference.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SettingsFragment.java From Intra with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { if (savedInstanceState != null) { // Restore the app list state. appList = savedInstanceState.getParcelableArrayList(APPS_KEY); } // Load the preferences from an XML resource addPreferencesFromResource(R.xml.preferences); appPref = (MultiSelectListPreference)findPreference(PersistentState.APPS_KEY); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { // App exclusion relies on VpnService.Builder.addDisallowedApplication, which was added in L. appPref.setEnabled(false); appPref.setSummary(R.string.old_android); } }
Example #2
Source File: ReminderPreferences.java From openScale with GNU General Public License v3.0 | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.reminder_preferences, rootKey); setHasOptionsMenu(true); reminderEnable = (CheckBoxPreference) findPreference(PREFERENCE_KEY_REMINDER_ENABLE); final MultiSelectListPreference prefDays = findPreference("reminderWeekdays"); prefDays.setSummaryProvider(new Preference.SummaryProvider<MultiSelectListPreference>() { @Override public CharSequence provideSummary(MultiSelectListPreference preference) { return preference.getValues().toString(); } }); updateAlarmPreferences(); }
Example #3
Source File: BaseSettingFragment.java From hipda with GNU General Public License v2.0 | 5 votes |
protected static void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. if (preference == null) return; preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener); // Trigger the listener immediately with the preference's // current value. if (preference instanceof CheckBoxPreference) { sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getBoolean(preference.getKey(), false)); } else if (preference instanceof SwitchPreference) { sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getBoolean(preference.getKey(), false)); } else if (preference instanceof MultiSelectListPreference) { sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getStringSet(preference.getKey(), new HashSet<String>())); } else { sBindPreferenceSummaryToValueListener.onPreferenceChange( preference, PreferenceManager.getDefaultSharedPreferences( preference.getContext()).getString(preference.getKey(), "")); } }