Search in sources :

Example 86 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project apps-android-wikipedia by wikimedia.

the class DeveloperSettingsPreferenceLoader method setUseRestBasePreference.

private void setUseRestBasePreference(boolean manualMode) {
    RbSwitch.INSTANCE.update();
    TwoStatePreference useRestBasePref = getUseRestBasePreference();
    useRestBasePref.setEnabled(manualMode);
    useRestBasePref.setChecked(RbSwitch.INSTANCE.isRestBaseEnabled());
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference)

Example 87 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project apps-android-wikipedia by wikimedia.

the class DeveloperSettingsPreferenceLoader method setUpMediaWikiSettings.

private void setUpMediaWikiSettings() {
    Preference uriPreference = findPreference(context.getString(R.string.preference_key_mediawiki_base_uri));
    uriPreference.setOnPreferenceChangeListener(setMediaWikiBaseUriChangeListener);
    TwoStatePreference multiLangPreference = (TwoStatePreference) findPreference(context.getString(R.string.preference_key_mediawiki_base_uri_supports_lang_code));
    multiLangPreference.setOnPreferenceChangeListener(setMediaWikiMultiLangSupportChangeListener);
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference) TwoStatePreference(android.support.v7.preference.TwoStatePreference) Preference(android.support.v7.preference.Preference)

Example 88 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project apps-android-wikipedia by wikimedia.

the class DeveloperSettingsPreferenceLoader method setUpRestBaseCheckboxes.

private void setUpRestBaseCheckboxes() {
    TwoStatePreference manualPreference = (TwoStatePreference) findPreference(getManualKey());
    manualPreference.setOnPreferenceChangeListener(setRestBaseManuallyChangeListener);
    setUseRestBasePreference(manualPreference.isChecked());
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference)

Example 89 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project android_packages_apps_Settings by SudaMod.

the class AssistFlashScreenPreferenceController method updatePreference.

private void updatePreference() {
    if (mPreference == null || !(mPreference instanceof TwoStatePreference)) {
        return;
    }
    if (isAvailable()) {
        if (mScreen.findPreference(getPreferenceKey()) == null) {
            // add it if it's not on scree
            mScreen.addPreference(mPreference);
        }
    } else {
        mScreen.removePreference(mPreference);
    }
    ComponentName assistant = getCurrentAssist();
    boolean isContextChecked = AssistContextPreferenceController.isChecked(mContext);
    mPreference.setEnabled(isContextChecked && isPreInstalledAssistant(assistant));
    ((TwoStatePreference) mPreference).setChecked(willShowFlash(assistant));
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference) ComponentName(android.content.ComponentName)

Example 90 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project android_packages_apps_Settings by SudaMod.

the class GesturePreferenceControllerTest method updateState_preferenceSetUncheckedWhenSettingIsOff.

@Test
public void updateState_preferenceSetUncheckedWhenSettingIsOff() {
    // Mock a TwoStatePreference
    final TwoStatePreference preference = mock(TwoStatePreference.class);
    // Set the setting to be disabled.
    mController.mIsPrefEnabled = false;
    // Run through updateState
    mController.updateState(preference);
    // Verify pref is unchecked (as setting is disabled).
    verify(preference).setChecked(false);
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference) Test(org.junit.Test)

Aggregations

TwoStatePreference (android.support.v7.preference.TwoStatePreference)94 Context (android.content.Context)50 Test (org.junit.Test)48 Preference (android.support.v7.preference.Preference)26 ComponentName (android.content.ComponentName)7 OnPreferenceChangeListener (android.support.v7.preference.Preference.OnPreferenceChangeListener)7 DropDownPreference (android.support.v7.preference.DropDownPreference)6 DefaultRingtonePreference (com.android.settings.DefaultRingtonePreference)6 Calendar (java.util.Calendar)6 Date (java.util.Date)6 InputMethodInfo (android.view.inputmethod.InputMethodInfo)5 ConfigKey (cx.ring.model.ConfigKey)5 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)4 EditTextPreference (android.support.v7.preference.EditTextPreference)3 PreferenceScreen (android.support.v7.preference.PreferenceScreen)3 File (java.io.File)3 PackageManager (android.content.pm.PackageManager)2 CheckBoxPreference (android.support.v7.preference.CheckBoxPreference)2 ListPreference (android.support.v7.preference.ListPreference)2 SwitchPreferenceCompat (android.support.v7.preference.SwitchPreferenceCompat)2