Example usage for android.preference CheckBoxPreference setDisableDependentsState

List of usage examples for android.preference CheckBoxPreference setDisableDependentsState

Introduction

In this page you can find the example usage for android.preference CheckBoxPreference setDisableDependentsState.

Prototype

public void setDisableDependentsState(boolean disableDependentsState) 

Source Link

Document

Sets whether dependents are disabled when this preference is on ( true ) or when this preference is off ( false ).

Usage

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 2s .c o m*/
    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.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);//w ww  .j a  va2 s .co  m
    onionPref.setDisableDependentsState(true);
    preferenceGroup.addPreference(onionPref);
    httpsPref.setDependency(getSharedKey(PREF_KEY_USE_ONION));
    addProxyPreferences(preferenceGroup);
}