android.support.v7.preference.ListPreference Java Examples
The following examples show how to use
android.support.v7.preference.ListPreference.
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 android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #2
Source File: SettingsActivity.java From video-quickstart-android with MIT License | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.settings); setHasOptionsMenu(true); setupCodecListPreference(AudioCodec.class, PREF_AUDIO_CODEC, PREF_AUDIO_CODEC_DEFAULT, (ListPreference) findPreference(PREF_AUDIO_CODEC)); setupCodecListPreference(VideoCodec.class, PREF_VIDEO_CODEC, PREF_VIDEO_CODEC_DEFAULT, (ListPreference) findPreference(PREF_VIDEO_CODEC)); setupSenderBandwidthPreferences(PREF_SENDER_MAX_AUDIO_BITRATE, PREF_SENDER_MAX_AUDIO_BITRATE_DEFAULT, (EditTextPreference) findPreference(PREF_SENDER_MAX_AUDIO_BITRATE)); setupSenderBandwidthPreferences(PREF_SENDER_MAX_VIDEO_BITRATE, PREF_SENDER_MAX_VIDEO_BITRATE_DEFAULT, (EditTextPreference) findPreference(PREF_SENDER_MAX_VIDEO_BITRATE)); }
Example #3
Source File: NotificationsPreferenceFragment.java From Silence with GNU General Public License v3.0 | 6 votes |
@Override public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); masterSecret = getArguments().getParcelable("master_secret"); this.findPreference(SilencePreferences.LED_COLOR_PREF) .setOnPreferenceChangeListener(new ListSummaryListener()); this.findPreference(SilencePreferences.LED_BLINK_PREF) .setOnPreferenceChangeListener(new ListSummaryListener()); this.findPreference(SilencePreferences.RINGTONE_PREF) .setOnPreferenceChangeListener(new RingtoneSummaryListener()); this.findPreference(SilencePreferences.REPEAT_ALERTS_PREF) .setOnPreferenceChangeListener(new ListSummaryListener()); this.findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF) .setOnPreferenceChangeListener(new NotificationPrivacyListener()); initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_COLOR_PREF)); initializeListSummary((ListPreference) findPreference(SilencePreferences.LED_BLINK_PREF)); initializeListSummary((ListPreference) findPreference(SilencePreferences.REPEAT_ALERTS_PREF)); initializeListSummary((ListPreference) findPreference(SilencePreferences.NOTIFICATION_PRIVACY_PREF)); initializeRingtoneSummary((AdvancedRingtonePreference) findPreference(SilencePreferences.RINGTONE_PREF)); }
Example #4
Source File: USBGpsSettingsFragment.java From UsbGps4Droid with GNU General Public License v3.0 | 6 votes |
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { addPreferencesFromResource(R.xml.main_prefs); devicePreference = (ListPreference) findPreference(USBGpsProviderService.PREF_GPS_DEVICE); deviceSpeedPreference = (ListPreference) findPreference(USBGpsProviderService.PREF_GPS_DEVICE_SPEED); devicePreference.setOnPreferenceChangeListener(this); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity()); sharedPreferences.registerOnSharedPreferenceChangeListener(this); usbManager = (UsbManager) getActivity().getSystemService(Context.USB_SERVICE); activityManager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE); mainHandler = new Handler(getActivity().getMainLooper()); setupNestedPreferences(); }
Example #5
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 6 votes |
public static void initializeTheme( final Activity activity, final ListPreference theme) { if (null != theme) { theme.setSummary(theme.getEntry()); theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange( Preference preference, Object newValue) { activity.startActivity(activity.getIntent()); activity.finish(); return true; } }); } }
Example #6
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 6 votes |
public static void initializeShowStatusPanel(final ListPreference listPreference) { listPreference.setSummary(listPreference.getEntry()); listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange( Preference preference, Object newValue) { preference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue( (String) newValue)]); return true; } }); }
Example #7
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #8
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #9
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); String key = preference.getKey(); if (preference instanceof ListPreference) { /* For list preferences, look up the correct display value in */ /* the preference's 'entries' list (since they have separate labels/values). */ ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #10
Source File: PrinterDetailsFragment.java From octoandroid with GNU General Public License v3.0 | 6 votes |
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { String stringValue = newValue.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } return true; }
Example #11
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #12
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #13
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #14
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #15
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #16
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #17
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #18
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #19
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #20
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #21
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #22
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #23
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #24
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #25
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #26
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
private void setPreferenceSummary(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } }
Example #27
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 6 votes |
public static void initializeShowCurrentLocation( final ListPreference listPreference) { listPreference.setSummary(listPreference.getEntry()); listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange( Preference preference, Object newValue) { preference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue( (String) newValue)]); return true; } }); }
Example #28
Source File: SettingsFragment.java From android_gisapp with GNU General Public License v3.0 | 6 votes |
public static void initializeMapBG(final ListPreference mapBG) { mapBG.setSummary(mapBG.getEntry()); mapBG.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange( Preference preference, Object newValue) { preference.setSummary( mapBG.getEntries()[mapBG.findIndexOfValue((String) newValue)]); return true; } }); }
Example #29
Source File: SettingsFragmentView.java From FastAccess with GNU General Public License v3.0 | 6 votes |
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); setDivider(ActivityCompat.getDrawable(getActivity(), R.drawable.list_divider)); setDividerHeight(1); PreferenceGroupAdapter adapter = (PreferenceGroupAdapter) getListView().getAdapter(); for (int i = 0; i < getListView().getAdapter().getItemCount(); i++) {//lazy global setOnPreferenceClickListener Preference preference = adapter.getItem(i); if (preference != null && !InputHelper.isEmpty(preference.getKey())) { if (preference.getKey().equalsIgnoreCase("version")) { preference.setSummary(BuildConfig.VERSION_NAME); } else if (!(preference instanceof SwitchPreference) && !(preference instanceof ListPreference)) { preference.setOnPreferenceClickListener(this); } } } }
Example #30
Source File: BeaconActionPageFragment.java From beaconloc with Apache License 2.0 | 5 votes |
private void setActionType(String newValue) { final ListPreference action_list = (ListPreference) findPreference("ba_action_list"); if (newValue != null && !newValue.isEmpty()) { int index = action_list.findIndexOfValue(newValue); action_list.setSummary(index >= 0 ? action_list.getEntries()[index] : null); mActionBeacon.setActionType(ActionBeacon.ActionType.fromInt(index >= 0 ? index : 0)); } else { action_list.setSummary(action_list.getEntries()[0]); mActionBeacon.setActionType(ActionBeacon.ActionType.fromInt(0)); } }