List of usage examples for android.preference CheckBoxPreference setTitle
public void setTitle(CharSequence title)
From source file:com.nttec.everychan.chans.dobrochan.DobroModule.java
private void addCaptchaPreference(PreferenceGroup group) { Context context = group.getContext(); CheckBoxPreference showCaptchaPreference = new LazyPreferences.CheckBoxPreference(context); showCaptchaPreference.setTitle(R.string.dobrochan_prefs_show_captcha); showCaptchaPreference.setSummary(R.string.dobrochan_prefs_show_captcha_summary); showCaptchaPreference.setKey(getSharedKey(PREF_KEY_SHOW_CAPTCHA)); showCaptchaPreference.setDefaultValue(false); group.addPreference(showCaptchaPreference); }
From source file:com.nttec.everychan.chans.makaba.MakabaModule.java
private void addMobileAPIPreference(PreferenceGroup group) { final Context context = group.getContext(); CheckBoxPreference mobileAPIPref = new LazyPreferences.CheckBoxPreference(context); mobileAPIPref.setTitle(R.string.makaba_prefs_mobile_api); mobileAPIPref.setSummary(R.string.pref_only_new_posts_summary); mobileAPIPref.setKey(getSharedKey(PREF_KEY_MOBILE_API)); mobileAPIPref.setDefaultValue(true); group.addPreference(mobileAPIPref);//from w ww . j av a2 s. co m }
From source file:com.nttec.everychan.chans.fourchan.FourchanModule.java
@Override public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) { Context context = preferenceGroup.getContext(); addPasscodePreference(preferenceGroup); CheckBoxPreference newRecaptchaPref = new LazyPreferences.CheckBoxPreference(context); newRecaptchaPref.setTitle(R.string.fourchan_prefs_new_recaptcha); newRecaptchaPref.setSummary(R.string.fourchan_prefs_new_recaptcha_summary); newRecaptchaPref.setKey(getSharedKey(PREF_KEY_NEW_RECAPTCHA)); newRecaptchaPref.setDefaultValue(NEW_RECAPTCHA_DEFAULT); preferenceGroup.addPreference(newRecaptchaPref); final CheckBoxPreference fallbackRecaptchaPref = new LazyPreferences.CheckBoxPreference(context); fallbackRecaptchaPref.setTitle(R.string.fourchan_prefs_new_recaptcha_fallback); fallbackRecaptchaPref.setSummary(R.string.fourchan_prefs_new_recaptcha_fallback_summary); fallbackRecaptchaPref.setKey(getSharedKey(PREF_KEY_NEW_RECAPTCHA_FALLBACK)); fallbackRecaptchaPref.setDefaultValue(false); preferenceGroup.addPreference(fallbackRecaptchaPref); fallbackRecaptchaPref.setDependency(getSharedKey(PREF_KEY_NEW_RECAPTCHA)); addPasswordPreference(preferenceGroup); addHttpsPreference(preferenceGroup, true); addProxyPreferences(preferenceGroup); final CheckBoxPreference proxyPreference = (CheckBoxPreference) preferenceGroup .findPreference(getSharedKey(PREF_KEY_USE_PROXY)); fallbackRecaptchaPref.setEnabled(!proxyPreference.isChecked()); proxyPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override/* w w w. jav a 2 s . c o m*/ public boolean onPreferenceClick(Preference preference) { fallbackRecaptchaPref.setEnabled(!proxyPreference.isChecked()); if (proxyPreference.isChecked() && !fallbackRecaptchaPref.isChecked()) fallbackRecaptchaPref.setChecked(true); return false; } }); }
From source file:com.nttec.everychan.chans.makaba.MakabaModule.java
/** ? ( .. https) */ private void addDomainPreferences(PreferenceGroup group) { Context context = group.getContext(); Preference.OnPreferenceChangeListener updateDomainListener = new Preference.OnPreferenceChangeListener() { @Override//from www . j a v a 2 s . c o m public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference.getKey().equals(getSharedKey(PREF_KEY_DOMAIN))) { updateDomain((String) newValue, preferences.getBoolean(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA), true)); return true; } else if (preference.getKey().equals(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA))) { updateDomain(preferences.getString(getSharedKey(PREF_KEY_DOMAIN), DEFAULT_DOMAIN), (boolean) newValue); return true; } return false; } }; PreferenceCategory domainCat = new PreferenceCategory(context); domainCat.setTitle(R.string.makaba_prefs_domain_category); group.addPreference(domainCat); EditTextPreference domainPref = new EditTextPreference(context); // domainPref.setTitle(R.string.pref_domain); domainPref.setDialogTitle(R.string.pref_domain); domainPref.setSummary(resources.getString(R.string.pref_domain_summary, DOMAINS_HINT)); domainPref.setKey(getSharedKey(PREF_KEY_DOMAIN)); domainPref.getEditText().setHint(DEFAULT_DOMAIN); domainPref.getEditText().setSingleLine(); domainPref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI); domainPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(domainPref); CheckBoxPreference httpsPref = new LazyPreferences.CheckBoxPreference(context); //? "? https" httpsPref.setTitle(R.string.pref_use_https); httpsPref.setSummary(R.string.pref_use_https_summary); httpsPref.setKey(getSharedKey(PREF_KEY_USE_HTTPS_MAKABA)); httpsPref.setDefaultValue(true); httpsPref.setOnPreferenceChangeListener(updateDomainListener); domainCat.addPreference(httpsPref); }
From source file:org.linphone.SettingsFragment.java
private void initAudioSettings() { PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_codecs_key)); if (codecs == null) return;// www . ja v a 2 s .c om codecs.removeAll(); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); for (final PayloadType pt : lc.getAudioCodecs()) { CheckBoxPreference codec = new CheckBoxPreference(LinphoneService.instance()); codec.setTitle(pt.getMime()); codec.setSummary(pt.getRate() + " Hz"); codec.setChecked(lc.isPayloadTypeEnabled(pt)); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; try { LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); } catch (LinphoneCoreException e) { e.printStackTrace(); } return true; } }); codecs.addPreference(codec); } CheckBoxPreference echoCancellation = (CheckBoxPreference) findPreference( getString(R.string.pref_echo_cancellation_key)); echoCancellation.setChecked(mPrefs.isEchoCancellationEnabled()); if (mPrefs.isEchoCancellationEnabled()) { Preference echoCalibration = findPreference(getString(R.string.pref_echo_canceller_calibration_key)); echoCalibration .setSummary(String.format(getString(R.string.ec_calibrated), mPrefs.getEchoCalibration())); } CheckBoxPreference adaptiveRateControl = (CheckBoxPreference) findPreference( getString(R.string.pref_adaptive_rate_control_key)); adaptiveRateControl.setChecked(mPrefs.isAdaptiveRateControlEnabled()); ListPreference adaptiveRateAlgorithm = (ListPreference) findPreference( getString(R.string.pref_adaptive_rate_algorithm_key)); adaptiveRateAlgorithm.setSummary(String.valueOf(mPrefs.getAdaptiveRateAlgorithm())); adaptiveRateAlgorithm.setValue(String.valueOf(mPrefs.getAdaptiveRateAlgorithm())); ListPreference bitrateLimit = (ListPreference) findPreference( getString(R.string.pref_codec_bitrate_limit_key)); bitrateLimit.setSummary(String.valueOf(mPrefs.getCodecBitrateLimit())); bitrateLimit.setValue(String.valueOf(mPrefs.getCodecBitrateLimit())); }
From source file:org.linphone.SettingsFragment.java
private void initVideoSettings() { initializePreferredVideoSizePreferences( (ListPreference) findPreference(getString(R.string.pref_preferred_video_size_key))); PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key)); if (codecs == null) return;// ww w .j a v a 2s. c om codecs.removeAll(); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); for (final PayloadType pt : lc.getVideoCodecs()) { CheckBoxPreference codec = new CheckBoxPreference(LinphoneService.instance()); codec.setTitle(pt.getMime()); if (!pt.getMime().equals("VP8")) { if (getResources().getBoolean(R.bool.disable_all_patented_codecs_for_markets)) { continue; } else { if (!Version.hasFastCpuWithAsmOptim() && pt.getMime().equals("H264")) { // Android without neon doesn't support H264 Log.w("CPU does not have asm optimisations available, disabling H264"); continue; } } } codec.setChecked(lc.isPayloadTypeEnabled(pt)); codec.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { boolean enable = (Boolean) newValue; try { LinphoneManager.getLcIfManagerNotDestroyedOrNull().enablePayloadType(pt, enable); } catch (LinphoneCoreException e) { e.printStackTrace(); } return true; } }); codecs.addPreference(codec); } ((CheckBoxPreference) findPreference(getString(R.string.pref_video_enable_key))) .setChecked(mPrefs.isVideoEnabled()); ((CheckBoxPreference) findPreference(getString(R.string.pref_video_use_front_camera_key))) .setChecked(mPrefs.useFrontCam()); ((CheckBoxPreference) findPreference(getString(R.string.pref_video_initiate_call_with_video_key))) .setChecked(mPrefs.shouldInitiateVideoCall()); //((CheckBoxPreference) findPreference(getString(R.string.pref_video_automatically_share_my_video_key))).setChecked(mPrefs.shouldAutomaticallyShareMyVideo()); ((CheckBoxPreference) findPreference(getString(R.string.pref_video_automatically_accept_video_key))) .setChecked(mPrefs.shouldAutomaticallyAcceptVideoRequests()); }