android.support.v7.preference.CheckBoxPreference Java Examples
The following examples show how to use
android.support.v7.preference.CheckBoxPreference.
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 |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #2
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #3
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #4
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #5
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #6
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #7
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #8
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #9
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #10
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #11
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #12
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #13
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add visualizer preferences, defined in the XML file in res->xml->pref_visualizer addPreferencesFromResource(R.xml.pref_visualizer); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); // Go through all of the preferences, and set up their preference summary. for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); // You don't need to set up preference summaries for checkbox preferences because // they are already set up in xml using summaryOff and summary On if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } // COMPLETED (3) Add the OnPreferenceChangeListener specifically to the EditTextPreference Preference preference = findPreference(getString(R.string.pref_size_key)); preference.setOnPreferenceChangeListener(this); }
Example #14
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #15
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #16
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #17
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #18
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { /* Add 'general' preferences, defined in the XML file */ addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #19
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #20
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #21
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #22
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #23
Source File: BeaconEventPageFragment.java From beaconloc with Apache License 2.0 | 6 votes |
@Override protected void setData() { switch (mActionBeacon.getEventType()) { case EVENT_ENTERS_REGION: ((CheckBoxPreference) findPreference("be_event_enter_region")).setChecked(true); ((CheckBoxPreference) findPreference("be_event_leaves_region")).setChecked(false); ((CheckBoxPreference) findPreference("be_event_near_you")).setChecked(false); break; case EVENT_LEAVES_REGION: ((CheckBoxPreference) findPreference("be_event_leaves_region")).setChecked(true); ((CheckBoxPreference) findPreference("be_event_enter_region")).setChecked(false); ((CheckBoxPreference) findPreference("be_event_near_you")).setChecked(false); break; default: ((CheckBoxPreference) findPreference("be_event_near_you")).setChecked(true); ((CheckBoxPreference) findPreference("be_event_leaves_region")).setChecked(false); ((CheckBoxPreference) findPreference("be_event_enter_region")).setChecked(false); } }
Example #24
Source File: AppProtectionPreferenceFragment.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"); disablePassphrase = (CheckBoxPreference) this.findPreference("pref_enable_passphrase_temporary"); this.findPreference(SilencePreferences.CHANGE_PASSPHRASE_PREF) .setOnPreferenceClickListener(new ChangePassphraseClickListener()); this.findPreference(SilencePreferences.PASSPHRASE_TIMEOUT_INTERVAL_PREF) .setOnPreferenceClickListener(new PassphraseIntervalClickListener()); this.findPreference(PREFERENCE_CATEGORY_BLOCKED) .setOnPreferenceClickListener(new BlockedContactsClickListener()); disablePassphrase .setOnPreferenceChangeListener(new DisablePassphraseClickListener()); }
Example #25
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #26
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add visualizer preferences, defined in the XML file in res->xml->pref_visualizer addPreferencesFromResource(R.xml.pref_visualizer); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); // Go through all of the preferences, and set up their preference summary. for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); // You don't need to set up preference summaries for checkbox preferences because // they are already set up in xml using summaryOff and summary On if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #27
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add visualizer preferences, defined in the XML file in res->xml->pref_visualizer addPreferencesFromResource(R.xml.pref_visualizer); // COMPLETED (3) Get the preference screen, get the number of preferences and iterate through // all of the preferences if it is not a checkbox preference, call the setSummary method // passing in a preference and the value of the preference SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen preferenceScreen = getPreferenceScreen(); int count = preferenceScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference pref = preferenceScreen.getPreference(i); if (!(pref instanceof CheckBoxPreference)) { setPreferenceSummary(pref, sharedPreferences.getString(pref.getKey(), "")); } } }
Example #28
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onCreatePreferences(Bundle bundle, String s) { // Add 'general' preferences, defined in the XML file addPreferencesFromResource(R.xml.pref_general); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); PreferenceScreen prefScreen = getPreferenceScreen(); int count = prefScreen.getPreferenceCount(); for (int i = 0; i < count; i++) { Preference p = prefScreen.getPreference(i); if (!(p instanceof CheckBoxPreference)) { String value = sharedPreferences.getString(p.getKey(), ""); setPreferenceSummary(p, value); } } }
Example #29
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }
Example #30
Source File: SettingsFragment.java From android-dev-challenge with Apache License 2.0 | 6 votes |
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Activity activity = getActivity(); if (key.equals(getString(R.string.pref_location_key))) { // we've changed the location // Wipe out any potential PlacePicker latlng values so that we can use this text entry. SunshinePreferences.resetLocationCoordinates(activity); SunshineSyncUtils.startImmediateSync(activity); } else if (key.equals(getString(R.string.pref_units_key))) { // units have changed. update lists of weather entries accordingly activity.getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } Preference preference = findPreference(key); if (null != preference) { if (!(preference instanceof CheckBoxPreference)) { setPreferenceSummary(preference, sharedPreferences.getString(key, "")); } } }