Search in sources :

Example 6 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class ZenModePrioritySendersPreferenceControllerTest method clickSameOptionMultipleTimes.

@Test
public void clickSameOptionMultipleTimes() {
    // GIVEN current priority message senders are ANY
    when(mZenBackend.getPriorityMessageSenders()).thenReturn(PRIORITY_SENDERS_ANY);
    // WHEN user clicks the any senders option multiple times again
    RadioButtonPreference anySenders = getButton(KEY_ANY);
    anySenders.onClick();
    anySenders.onClick();
    anySenders.onClick();
    // THEN no senders are saved because this setting is already in effect
    verify(mZenBackend, never()).saveSenders(PRIORITY_CATEGORY_MESSAGES, PRIORITY_SENDERS_ANY);
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Example 7 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class ZenModePrioritySendersPreferenceControllerTest method clickNoSenders.

@Test
public void clickNoSenders() {
    // GIVEN current priority message senders are ANY
    when(mZenBackend.getPriorityMessageSenders()).thenReturn(PRIORITY_SENDERS_ANY);
    // WHEN user clicks the no senders option
    RadioButtonPreference noSenders = getButton(KEY_NONE);
    noSenders.onClick();
    // THEN no senders gets saved as priority senders for messages
    verify(mZenBackend).saveSenders(PRIORITY_CATEGORY_MESSAGES, ZenModeBackend.SOURCE_NONE);
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Example 8 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class OneHandedActionPullDownPrefControllerTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    mUtils = new OneHandedSettingsUtils(mContext);
    mController = new OneHandedActionPullDownPrefController(mContext, KEY);
    mPreference = new RadioButtonPreference(mContext);
    OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Before(org.junit.Before)

Example 9 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class OneHandedActionShowNotificationPrefControllerTest method setUp.

@Before
public void setUp() {
    mContext = RuntimeEnvironment.application;
    mUtils = new OneHandedSettingsUtils(mContext);
    mController = new OneHandedActionShowNotificationPrefController(mContext, KEY);
    mPreference = new RadioButtonPreference(mContext);
    OneHandedSettingsUtils.setUserId(UserHandle.myUserId());
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Before(org.junit.Before)

Example 10 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class PreventRingingGesturePreferenceControllerTest method testRadioButtonClicked_vibrate.

@Test
public void testRadioButtonClicked_vibrate() {
    RadioButtonPreference rbPref = new RadioButtonPreference(mContext);
    rbPref.setKey(PreventRingingGesturePreferenceController.KEY_VIBRATE);
    Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_OFF);
    mController.onRadioButtonClicked(rbPref);
    assertThat(Settings.Secure.VOLUME_HUSH_VIBRATE).isEqualTo(Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_OFF));
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Aggregations

RadioButtonPreference (com.android.settingslib.widget.RadioButtonPreference)52 Test (org.junit.Test)27 Before (org.junit.Before)8 DefaultAppInfo (com.android.settingslib.applications.DefaultAppInfo)6 PreferenceScreen (androidx.preference.PreferenceScreen)5 CandidateInfo (com.android.settingslib.widget.CandidateInfo)3 Preference (androidx.preference.Preference)2 PreferenceCategory (androidx.preference.PreferenceCategory)2 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)2 FooterPreference (com.android.settingslib.widget.FooterPreference)2 AppOpsManager (android.app.AppOpsManager)1 SettingsEnums (android.app.settings.SettingsEnums)1 Context (android.content.Context)1 Intent (android.content.Intent)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1 Resources (android.content.res.Resources)1 Drawable (android.graphics.drawable.Drawable)1 BatteryStats (android.os.BatteryStats)1 Bundle (android.os.Bundle)1