break; case BOOLEAN: item = new CheckBoxPreference(this); item.setTitle(opt.getName()); item.setKey(opt.getName());
private void createNotifyPreference() { notify = new CheckBoxPreference(OptionsActivity.this); category.addPreference(notify); notify.setTitle(R.string.advanced_options_notify_title); }
private void createOnGoingPreference() { ongoing = new CheckBoxPreference(OptionsActivity.this); category.addPreference(ongoing); ongoing.setTitle(R.string.ongoing); }
private void createScrobbleEnablePreference() { scrobble = new CheckBoxPreference(OptionsActivity.this); category.addPreference(scrobble); scrobble.setTitle(R.string.scrobbling); scrobble.setSummaryOff(R.string.scrobbling_enable); }
private void createNPEnablePreference() { np = new CheckBoxPreference(OptionsActivity.this); category.addPreference(np); np.setTitle(R.string.nowplaying); np.setSummaryOff(R.string.nowplaying_enable); }
private void createAOCPreference() { also_on_complete = new CheckBoxPreference(OptionsActivity.this); category.addPreference(also_on_complete); also_on_complete .setTitle(R.string.advanced_options_also_on_complete_title); also_on_complete .setSummary(R.string.advanced_options_also_on_complete_summary); }
private void populatePreferenceScreen(Set<String> activeCalendars) { Cursor cursor = createLoadedCursor(); if (cursor == null) { return; } for (int i = 0; i < cursor.getCount(); i++) { cursor.moveToPosition(i); CheckBoxPreference checkboxPref = new CheckBoxPreference(getActivity()); checkboxPref.setTitle(cursor.getString(1)); checkboxPref.setSummary(cursor.getString(3)); checkboxPref.setIcon(createDrawable(cursor.getInt(2))); int calendarId = cursor.getInt(0); checkboxPref.getExtras().putInt(CALENDAR_ID, calendarId); checkboxPref.setChecked(activeCalendars.isEmpty() || activeCalendars.contains(String.valueOf(calendarId))); getPreferenceScreen().addPreference(checkboxPref); } }
private void createRoamingPreference() { roaming = new CheckBoxPreference(OptionsActivity.this); category.addPreference(roaming); roaming.setTitle(R.string.advanced_options_net_roaming_title); roaming .setSummaryOff(R.string.advanced_options_net_roaming_summary_off); roaming .setSummaryOn(R.string.advanced_options_net_roaming_summary_on); }
@Override protected void onCreate(Bundle icicle) { // Get the settings preferences SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); Design.updateTheme(this, sp); super.onCreate(icicle); addPreferencesFromResource(R.xml.language_prefs); mSelectedLanguages = sp.getString(KP2AKeyboard.PREF_SELECTED_LANGUAGES, ""); String[] languageList = mSelectedLanguages.split(","); //first try to get the unique locales in a strict mode (filtering most redundant layouts like English (Jamaica) etc.) mAvailableLanguages = getUniqueLocales(true); //sometimes the strict check returns only EN_US, EN_GB and ES_US. Accept more in these cases: if (mAvailableLanguages.size() < 5) { mAvailableLanguages = getUniqueLocales(false); } PreferenceGroup parent = getPreferenceScreen(); for (int i = 0; i < mAvailableLanguages.size(); i++) { CheckBoxPreference pref = new CheckBoxPreference(this); Locale locale = mAvailableLanguages.get(i).locale; pref.setTitle(LanguageSwitcher.toTitleCase(locale.getDisplayName(locale), locale)); boolean checked = isLocaleIn(locale, languageList); pref.setChecked(checked); if (hasDictionary(locale, this)) { pref.setSummary(R.string.has_dictionary); } parent.addPreference(pref); } }
private void update() { mSupportedMusicAppsList.removeAll(); mPrefsToMapisMap.clear(); mMapisToPrefsMap.clear(); MusicAPI[] mapis = MusicAPI.all(this); for (MusicAPI mapi : mapis) { CheckBoxPreference appPref = new CheckBoxPreference(this, null); appPref.setTitle(mapi.getName()); appPref.setPersistent(false); appPref.setChecked(mapi.isEnabled()); mSupportedMusicAppsList.addPreference(appPref); mPrefsToMapisMap.put(appPref, mapi); mMapisToPrefsMap.put(mapi, appPref); setSMASummary(appPref, mapi); } // explanation text, for what this screen does Preference detect = new Preference(this); if (mapis.length == 0) detect.setTitle(R.string.no_supported_mapis_title); else if (mapis.length == 1) detect.setTitle(R.string.find_supported_mapis_one_title); else detect.setTitle(getString(R.string.find_supported_mapis_many_title) .replace("%1", Integer.toString(mapis.length))); detect.setSummary(R.string.find_supported_mapis_summary); mSupportedMusicAppsList.addPreference(detect); }
String eitherKey = "either"; String orKey = "or"; CheckBoxPreference either = new CheckBoxPreference(this); either.setKey(eitherKey); either.setTitle("Either"); either.setSummary("It is either one or"); either.setDefaultValue(false); either.setDisableDependentsState(true); inlinePrefCat.addPreference(either); try { //Crossfade Time CheckBoxPreference or = new CheckBoxPreference(this); or.setKey(orKey); or.setTitle("Or"); or.setSummary("the other"); inlinePrefCat.addPreference(or); or.setDependency(eitherKey); } catch (Exception e) { }
@Override protected void onResume() { super.onResume(); List<MountPoint> mountPoints = RootMountPoint.getRootedMountPoints(this); PreferenceScreen prefs = getPreferenceScreen(); prefs.removeAll(); SharedPreferences shprefs = getSharedPreferences("ignore_list", Context.MODE_PRIVATE); Map<String, ?> ignoreList = shprefs.getAll(); Set<String> ignores = ignoreList.keySet(); for (MountPoint mountPoint: mountPoints) { CheckBoxPreference pref = new CheckBoxPreference(this); FileSystemEntry.setupStrings(this); FileSystemStats stats = new FileSystemStats(mountPoint); pref.setSummary(stats.formatUsageInfo()); pref.setTitle(mountPoint.getRoot()); pref.setChecked(!ignores.contains(mountPoint.getRoot())); prefs.addPreference(pref); } }
.findPreference(COMMANDS_SCREEN_KEY); for (ObdCommand cmd : cmds) { CheckBoxPreference cpref = new CheckBoxPreference(this); cpref.setTitle(cmd.getName()); cpref.setKey(cmd.getName());
this.setPreferenceScreen(root); isCollectData = new CheckBoxPreference(this); isCollectData.setTitle(R.string.collect_gps_data); isCollectData.setSummary(R.string.collect_gps_data_desc); root.addPreference(minBatteryLife); enableToolTips = new CheckBoxPreference(this); enableToolTips.setTitle(R.string.enable_tooltips); enableToolTips.setKey("enable_tooltips"); useMetricUnits = new CheckBoxPreference(this); useMetricUnits.setTitle(R.string.use_metric_units); useMetricUnits.setChecked(GTG.prefs.useMetric); enablePassword = new CheckBoxPreference(this); enablePassword.setTitle(R.string.enable_password); enablePassword.setKey("enable_password"); allowErrorReporting = new CheckBoxPreference(this); allowErrorReporting.setTitle(R.string.allow_error_reporting); allowErrorReporting.setSummary(R.string.allow_error_reporting_summary); writeGpsWakeLockDebugFile = new CheckBoxPreference(this); writeGpsWakeLockDebugFile.setTitle(R.string.write_to_gps_wake_lock_log); writeGpsWakeLockDebugFile.setSummary(
CheckBoxPreference checkboxPref = new CheckBoxPreference(this); checkboxPref.setKey("checkbox_preference"); checkboxPref.setTitle(R.string.title_checkbox_preference); CheckBoxPreference nextScreenCheckBoxPref = new CheckBoxPreference(this); nextScreenCheckBoxPref.setKey("next_screen_toggle_preference"); nextScreenCheckBoxPref.setTitle(R.string.title_next_screen_toggle_preference); CheckBoxPreference parentCheckBoxPref = new CheckBoxPreference(this); parentCheckBoxPref.setTitle(R.string.title_parent_preference); parentCheckBoxPref.setSummary(R.string.summary_parent_preference); CheckBoxPreference childCheckBoxPref = new CheckBoxPreference(this); childCheckBoxPref.setTitle(R.string.title_child_preference); childCheckBoxPref.setSummary(R.string.summary_child_preference);
CheckBoxPreference checkboxPref = new CheckBoxPreference(this); checkboxPref.setKey("checkbox_preference"); checkboxPref.setTitle(R.string.title_checkbox_preference); CheckBoxPreference nextScreenCheckBoxPref = new CheckBoxPreference(this); nextScreenCheckBoxPref.setKey("next_screen_toggle_preference"); nextScreenCheckBoxPref.setTitle(R.string.title_next_screen_toggle_preference); CheckBoxPreference parentCheckBoxPref = new CheckBoxPreference(this); parentCheckBoxPref.setTitle(R.string.title_parent_preference); parentCheckBoxPref.setSummary(R.string.summary_parent_preference); CheckBoxPreference childCheckBoxPref = new CheckBoxPreference(this); childCheckBoxPref.setTitle(R.string.title_child_preference); childCheckBoxPref.setSummary(R.string.summary_child_preference);
CheckBoxPreference checkbox = new CheckBoxPreference(this); checkbox.setKey(overlay.getId()); checkbox.setPersistent(true);
MeasurementViewSettings settings = getSettings(); CheckBoxPreference overview = new CheckBoxPreference(screen.getContext()); overview.setKey(settings.getInOverviewGraphKey()); overview.setTitle(R.string.label_include_in_overview_graph); final CheckBoxPreference estimate = new CheckBoxPreference(screen.getContext()); estimate.setKey(settings.getEstimationEnabledKey()); estimate.setTitle(R.string.label_estimate_measurement);