Java Code Examples for android.preference.CheckBoxPreference#setSummaryOff()
The following examples show how to use
android.preference.CheckBoxPreference#setSummaryOff() .
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: Preferences.java From xDrip with GNU General Public License v3.0 | 6 votes |
private void update_nfc_expiry_preferences(Boolean show_age) { try { ; final PreferenceScreen nfcScreen = (PreferenceScreen) findPreference("xdrip_plus_nfc_settings"); final String nfc_expiry_days_string = AllPrefsFragment.this.prefs.getString("nfc_expiry_days", "14.5"); final CheckBoxPreference nfc_show_age = (CheckBoxPreference) findPreference("nfc_show_age"); nfc_show_age.setSummaryOff("Show the sensor expiry time based on " + nfc_expiry_days_string + " days"); if (show_age == null) show_age = nfc_show_age.isChecked(); if (show_age) { nfcScreen.removePreference(nfc_expiry_days); } else { nfc_expiry_days.setOrder(3); nfcScreen.addPreference(nfc_expiry_days); } } catch (NullPointerException e) { // } }
Example 2
Source File: Preferences.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
private void update_nfc_expiry_preferences(Boolean show_age) { try { ; final PreferenceScreen nfcScreen = (PreferenceScreen) findPreference("xdrip_plus_nfc_settings"); final String nfc_expiry_days_string = AllPrefsFragment.this.prefs.getString("nfc_expiry_days", "14.5"); final CheckBoxPreference nfc_show_age = (CheckBoxPreference) findPreference("nfc_show_age"); nfc_show_age.setSummaryOff("Show the sensor expiry time based on " + nfc_expiry_days_string + " days"); if (show_age == null) show_age = nfc_show_age.isChecked(); if (show_age) { nfcScreen.removePreference(nfc_expiry_days); } else { nfc_expiry_days.setOrder(3); nfcScreen.addPreference(nfc_expiry_days); } } catch (NullPointerException e) { // } }
Example 3
Source File: PreferencesActivity.java From crazyflie-android-client with GNU General Public License v2.0 | 6 votes |
private void checkGyroSensors() { //Test the available sensors SensorManager sensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); CheckBoxPreference pref = (CheckBoxPreference) findPreference(KEY_PREF_USE_GYRO_BOOL); if (sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR) == null && sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER) == null) { pref.setEnabled(false); pref.setChecked(false); resetPreference(KEY_PREF_USE_GYRO_BOOL, false); mNoGyroSensor = true; pref.setSummaryOff("No gyro or accelerometer sensors found"); Log.i(LOG_TAG, "No gyro or accelerometer sensors found"); } else { pref.setEnabled(true); mNoGyroSensor = false; } }
Example 4
Source File: NotifySettingsActivity.java From AndroidPNClient with Apache License 2.0 | 4 votes |
private PreferenceScreen createPreferenceHierarchy() { Log.d(LOGTAG, "createSettingsPreferenceScreen()..."); PreferenceManager preferenceManager = getPreferenceManager(); preferenceManager .setSharedPreferencesName(Constants.SHARED_PREFERENCE_NAME); preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE); PreferenceScreen root = preferenceManager.createPreferenceScreen(this); // PreferenceCategory prefCat = new PreferenceCategory(this); // // inlinePrefCat.setTitle(""); // root.addPreference(prefCat); CheckBoxPreference notifyPref = new CheckBoxPreference(this); notifyPref.setKey(Constants.SETTINGS_NOTIFICATION_ENABLED); notifyPref.setTitle(R.string.notifications_enabled); notifyPref.setSummaryOn(R.string.receive_push_messages); notifyPref.setSummaryOff(R.string.do_not_receive_push_messages); notifyPref.setDefaultValue(Boolean.TRUE); notifyPref .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean checked = Boolean.valueOf(newValue.toString()); if (checked) { preference.setTitle(R.string.notifications_enabled); } else { preference.setTitle(R.string.notifications_disabled); } return true; } }); CheckBoxPreference soundPref = new CheckBoxPreference(this); soundPref.setKey(Constants.SETTINGS_SOUND_ENABLED); soundPref.setTitle(R.string.sound); soundPref.setSummary(R.string.play_sound_for_notifications); soundPref.setDefaultValue(Boolean.TRUE); // soundPref.setDependency(Constants.SETTINGS_NOTIFICATION_ENABLED); CheckBoxPreference vibratePref = new CheckBoxPreference(this); vibratePref.setKey(Constants.SETTINGS_VIBRATE_ENABLED); vibratePref.setTitle(R.string.vibrate); vibratePref.setSummary(R.string.vibrate_the_phone_for_notifications); vibratePref.setDefaultValue(Boolean.TRUE); // vibratePref.setDependency(Constants.SETTINGS_NOTIFICATION_ENABLED); root.addPreference(notifyPref); root.addPreference(soundPref); root.addPreference(vibratePref); // prefCat.addPreference(notifyPref); // prefCat.addPreference(soundPref); // prefCat.addPreference(vibratePref); // root.addPreference(prefCat); return root; }
Example 5
Source File: NotificationSettingsActivity.java From AndroidPNClient with Apache License 2.0 | 4 votes |
private PreferenceScreen createPreferenceHierarchy() { Log.d(LOGTAG, "createSettingsPreferenceScreen()..."); PreferenceManager preferenceManager = getPreferenceManager(); preferenceManager .setSharedPreferencesName(Constants.SHARED_PREFERENCE_NAME); preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE); PreferenceScreen root = preferenceManager.createPreferenceScreen(this); CheckBoxPreference notifyPref = new CheckBoxPreference(this); notifyPref.setKey(Constants.SETTINGS_NOTIFICATION_ENABLED); notifyPref.setTitle("Notifications Enabled"); notifyPref.setSummaryOn("Receive push messages"); notifyPref.setSummaryOff("Do not receive push messages"); notifyPref.setDefaultValue(Boolean.TRUE); notifyPref .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean checked = Boolean.valueOf(newValue.toString()); if (checked) { preference.setTitle("Notifications Enabled"); } else { preference.setTitle("Notifications Disabled"); } return true; } }); CheckBoxPreference soundPref = new CheckBoxPreference(this); soundPref.setKey(Constants.SETTINGS_SOUND_ENABLED); soundPref.setTitle("Sound"); soundPref.setSummary("Play a sound for notifications"); soundPref.setDefaultValue(Boolean.TRUE); CheckBoxPreference vibratePref = new CheckBoxPreference(this); vibratePref.setKey(Constants.SETTINGS_VIBRATE_ENABLED); vibratePref.setTitle("Vibrate"); vibratePref.setSummary("Vibrate the phone for notifications"); vibratePref.setDefaultValue(Boolean.TRUE); root.addPreference(notifyPref); root.addPreference(soundPref); root.addPreference(vibratePref); return root; }
Example 6
Source File: NotificationSettingsActivity.java From android-demo-xmpp-androidpn with Apache License 2.0 | 4 votes |
private PreferenceScreen createPreferenceHierarchy() { Log.d(LOGTAG, "createSettingsPreferenceScreen()..."); PreferenceManager preferenceManager = getPreferenceManager(); preferenceManager .setSharedPreferencesName(Constants.SHARED_PREFERENCE_NAME); preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE); PreferenceScreen root = preferenceManager.createPreferenceScreen(this); // PreferenceCategory prefCat = new PreferenceCategory(this); // // inlinePrefCat.setTitle(""); // root.addPreference(prefCat); CheckBoxPreference notifyPref = new CheckBoxPreference(this); notifyPref.setKey(Constants.SETTINGS_NOTIFICATION_ENABLED); notifyPref.setTitle("Notifications Enabled"); notifyPref.setSummaryOn("Receive push messages"); notifyPref.setSummaryOff("Do not receive push messages"); notifyPref.setDefaultValue(Boolean.TRUE); notifyPref .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { boolean checked = Boolean.valueOf(newValue.toString()); if (checked) { preference.setTitle("Notifications Enabled"); } else { preference.setTitle("Notifications Disabled"); } return true; } }); CheckBoxPreference soundPref = new CheckBoxPreference(this); soundPref.setKey(Constants.SETTINGS_SOUND_ENABLED); soundPref.setTitle("Sound"); soundPref.setSummary("Play a sound for notifications"); soundPref.setDefaultValue(Boolean.TRUE); // soundPref.setDependency(Constants.SETTINGS_NOTIFICATION_ENABLED); CheckBoxPreference vibratePref = new CheckBoxPreference(this); vibratePref.setKey(Constants.SETTINGS_VIBRATE_ENABLED); vibratePref.setTitle("Vibrate"); vibratePref.setSummary("Vibrate the phone for notifications"); vibratePref.setDefaultValue(Boolean.TRUE); // vibratePref.setDependency(Constants.SETTINGS_NOTIFICATION_ENABLED); root.addPreference(notifyPref); root.addPreference(soundPref); root.addPreference(vibratePref); // prefCat.addPreference(notifyPref); // prefCat.addPreference(soundPref); // prefCat.addPreference(vibratePref); // root.addPreference(prefCat); return root; }