Example usage for android.preference PreferenceGroup addPreference

List of usage examples for android.preference PreferenceGroup addPreference

Introduction

In this page you can find the example usage for android.preference PreferenceGroup addPreference.

Prototype

public boolean addPreference(Preference preference) 

Source Link

Document

Adds a Preference at the correct position based on the preference's order.

Usage

From source file:nya.miku.wishmaster.chans.incah.InachModule.java

@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    CheckBoxPreference ajaxPref = new CheckBoxPreference(context);
    ajaxPref.setTitle(R.string.inach_prefs_ajax_update);
    ajaxPref.setSummary(R.string.inach_prefs_ajax_update_summary);
    ajaxPref.setKey(getSharedKey(PREF_AJAX_UPDATE));
    ajaxPref.setDefaultValue(true);//from  www. j a v  a  2s .  c  om
    preferenceGroup.addPreference(ajaxPref);
    super.addPreferencesOnScreen(preferenceGroup);
}

From source file:nya.miku.wishmaster.api.AbstractChanModule.java

/**
 *     ( ?/ ) -? "  SSL"/*from w  ww  . j a v  a2 s .c o m*/
 * @param group ,   ??? 
 * @param dependencyKey -?? ?  ,   null
 */
protected void addUnsafeSslPreference(PreferenceGroup group, String dependencyKey) {
    final Context context = group.getContext();
    CheckBoxPreference unsafeSslPref = new CheckBoxPreference(context); //? "  SSL"
    unsafeSslPref.setTitle(R.string.pref_ignore_ssl_errors);
    unsafeSslPref.setSummary(R.string.pref_ignore_ssl_errors_summary);
    unsafeSslPref.setKey(getSharedKey(PREF_KEY_UNSAFE_SSL));
    unsafeSslPref.setDefaultValue(false);
    unsafeSslPref.setOnPreferenceChangeListener(updateHttpListener);
    group.addPreference(unsafeSslPref);
    if (dependencyKey != null)
        unsafeSslPref.setDependency(dependencyKey);
}

From source file:nya.miku.wishmaster.chans.tirech.TirechModule.java

@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    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);
    preferenceGroup.addPreference(domainPref);
    addPasswordPreference(preferenceGroup);
    addCloudflareRecaptchaFallbackPreference(preferenceGroup);
    addProxyPreferences(preferenceGroup);
}

From source file:com.nttec.everychan.chans.dvach.DvachModule.java

@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    addPasswordPreference(preferenceGroup);
    CheckBoxPreference onionPref = new LazyPreferences.CheckBoxPreference(context);
    onionPref.setTitle(R.string.pref_use_onion);
    onionPref.setSummary(R.string.pref_use_onion_summary);
    onionPref.setKey(getSharedKey(PREF_KEY_USE_ONION));
    onionPref.setDefaultValue(false);/*  w  w  w  .  j av a  2  s .c  om*/
    onionPref.setDisableDependentsState(true);
    preferenceGroup.addPreference(onionPref);
    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);
    preferenceGroup.addPreference(domainPref);
    domainPref.setDependency(getSharedKey(PREF_KEY_USE_ONION));
    addProxyPreferences(preferenceGroup);
}

From source file:com.mobiletin.inputmethod.indic.settings.CustomInputStyleSettingsFragment.java

private void setPrefSubtypes(final String prefSubtypes, final Context context) {
    final PreferenceGroup group = getPreferenceScreen();
    group.removeAll();/*  www.  j  av  a2  s.  c o m*/
    final InputMethodSubtype[] subtypesArray = AdditionalSubtypeUtils
            .createAdditionalSubtypesArray(prefSubtypes);
    for (final InputMethodSubtype subtype : subtypesArray) {
        final SubtypePreference pref = new SubtypePreference(context, subtype, mSubtypeProxy);
        group.addPreference(pref);
    }
}

From source file:nya.miku.wishmaster.api.AbstractChanModule.java

/**
 *     ( ?/ )  ? ? ? ? ?//* w ww  .j  a  v a 2s  .  c  o m*/
 * @param group ,   ??? 
 */
protected void addPasswordPreference(PreferenceGroup group) {
    final Context context = group.getContext();
    EditTextPreference passwordPref = new EditTextPreference(context); //  ?
    passwordPref.setTitle(R.string.pref_password_title);
    passwordPref.setDialogTitle(R.string.pref_password_title);
    passwordPref.setSummary(R.string.pref_password_summary);
    passwordPref.setKey(getSharedKey(PREF_KEY_PASSWORD));
    passwordPref.getEditText()
            .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    passwordPref.getEditText().setSingleLine();
    passwordPref.getEditText().setFilters(new InputFilter[] { new InputFilter.LengthFilter(255) });
    group.addPreference(passwordPref);
}

From source file:com.nttec.everychan.chans.infinity.InfinityModule.java

@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    addPasswordPreference(preferenceGroup);
    CheckBoxPreference httpsPref = addHttpsPreference(preferenceGroup, true);
    CheckBoxPreference onionPref = new LazyPreferences.CheckBoxPreference(context);
    onionPref.setTitle(R.string.pref_use_onion);
    onionPref.setSummary(R.string.pref_use_onion_summary);
    onionPref.setKey(getSharedKey(PREF_KEY_USE_ONION));
    onionPref.setDefaultValue(false);//from  w w w. j a  v  a2 s .co m
    onionPref.setDisableDependentsState(true);
    preferenceGroup.addPreference(onionPref);
    httpsPref.setDependency(getSharedKey(PREF_KEY_USE_ONION));
    addProxyPreferences(preferenceGroup);
}

From source file:com.nttec.everychan.chans.horochan.HorochanModule.java

@Override
public void addPreferencesOnScreen(PreferenceGroup preferenceGroup) {
    Context context = preferenceGroup.getContext();
    addOnlyNewPostsPreference(preferenceGroup, true);
    CheckBoxPreference fallbackRecaptchaPref = new LazyPreferences.CheckBoxPreference(context); // recaptcha fallback
    fallbackRecaptchaPref.setTitle(R.string.fourchan_prefs_new_recaptcha_fallback);
    fallbackRecaptchaPref.setSummary(R.string.fourchan_prefs_new_recaptcha_fallback_summary);
    fallbackRecaptchaPref.setKey(getSharedKey(PREF_KEY_RECAPTCHA_FALLBACK));
    fallbackRecaptchaPref.setDefaultValue(false);
    preferenceGroup.addPreference(fallbackRecaptchaPref);
    addHttpsPreference(preferenceGroup, true); //https
    addCloudflareRecaptchaFallbackPreference(preferenceGroup);
    addProxyPreferences(preferenceGroup);
}