Search in sources :

Example 76 with SwitchPreference

use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.

the class ZenModeAlarmsPreferenceControllerTest method updateState_AlarmsOnly.

@Test
public void updateState_AlarmsOnly() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_ALARMS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(true);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 77 with SwitchPreference

use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.

the class ZenModeAlarmsPreferenceControllerTest method updateState_TotalSilence.

@Test
public void updateState_TotalSilence() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_NO_INTERRUPTIONS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 78 with SwitchPreference

use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.

the class ZenModeEventsPreferenceControllerTest method updateState_AlarmsOnly.

@Test
public void updateState_AlarmsOnly() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_ALARMS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 79 with SwitchPreference

use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.

the class ZenModeMediaPreferenceControllerTest method updateState_TotalSilence.

@Test
public void updateState_TotalSilence() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_NO_INTERRUPTIONS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Example 80 with SwitchPreference

use of androidx.preference.SwitchPreference in project android_packages_apps_Settings by omnirom.

the class ZenModeRemindersPreferenceControllerTest method updateState_AlarmsOnly.

@Test
public void updateState_AlarmsOnly() {
    Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_ALARMS);
    final SwitchPreference mockPref = mock(SwitchPreference.class);
    mController.updateState(mockPref);
    verify(mockPref).setEnabled(false);
    verify(mockPref).setChecked(false);
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Test(org.junit.Test)

Aggregations

SwitchPreference (androidx.preference.SwitchPreference)299 Test (org.junit.Test)125 Before (org.junit.Before)68 Intent (android.content.Intent)17 Preference (androidx.preference.Preference)17 ComponentName (android.content.ComponentName)10 A2dpProfile (com.android.settingslib.bluetooth.A2dpProfile)10 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)8 PbapServerProfile (com.android.settingslib.bluetooth.PbapServerProfile)8 ListPreference (androidx.preference.ListPreference)7 PreferenceScreen (androidx.preference.PreferenceScreen)7 RemoteException (android.os.RemoteException)6 PreferenceCategory (androidx.preference.PreferenceCategory)6 HashSet (java.util.HashSet)6 Context (android.content.Context)5 Parcel (android.os.Parcel)5 VisibleForTesting (androidx.annotation.VisibleForTesting)5 BluetoothDevice (android.bluetooth.BluetoothDevice)4 ChangeConfig (android.compat.Compatibility.ChangeConfig)4 ServiceInfo (android.content.pm.ServiceInfo)4