Search in sources :

Example 51 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project platform_packages_apps_Settings by BlissRoms.

the class GesturePreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingIsOn.

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

Example 52 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project platform_packages_apps_Settings by BlissRoms.

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)

Example 53 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project platform_packages_apps_Settings by BlissRoms.

the class PulseNotificationPreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingIsOn.

@Test
public void updateState_preferenceSetCheckedWhenSettingIsOn() {
    final TwoStatePreference preference = mock(TwoStatePreference.class);
    final Context context = ShadowApplication.getInstance().getApplicationContext();
    Settings.System.putInt(context.getContentResolver(), NOTIFICATION_LIGHT_PULSE, 1);
    mController = new PulseNotificationPreferenceController(context);
    mController.updateState(preference);
    verify(preference).setChecked(true);
}
Also used : Context(android.content.Context) TwoStatePreference(android.support.v7.preference.TwoStatePreference) Test(org.junit.Test)

Example 54 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project platform_packages_apps_Settings by BlissRoms.

the class VibrateWhenRingPreferenceControllerTest method updateState_settingIsOn_preferenceShouldBeChecked.

@Test
public void updateState_settingIsOn_preferenceShouldBeChecked() {
    final TwoStatePreference preference = mock(TwoStatePreference.class);
    final Context context = ShadowApplication.getInstance().getApplicationContext();
    Settings.System.putInt(context.getContentResolver(), VIBRATE_WHEN_RINGING, 1);
    mController = new VibrateWhenRingPreferenceController(context);
    mController.updateState(preference);
    verify(preference).setChecked(true);
}
Also used : Context(android.content.Context) TwoStatePreference(android.support.v7.preference.TwoStatePreference) Test(org.junit.Test)

Example 55 with TwoStatePreference

use of android.support.v7.preference.TwoStatePreference in project sms-backup-plus by jberkel.

the class MainSettings method updateConnected.

private TwoStatePreference updateConnected() {
    TwoStatePreference connected = (TwoStatePreference) findPreference(CONNECTED.key);
    connected.setEnabled(authPreferences.useXOAuth());
    connected.setChecked(authPreferences.hasOAuth2Tokens());
    final String summary = getConnectedSummary(connected);
    if (connected.isChecked()) {
        connected.setSummary(summary);
    } else {
        connected.setSummaryOff(summary);
    }
    return connected;
}
Also used : TwoStatePreference(android.support.v7.preference.TwoStatePreference)

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