Search in sources :

Example 46 with RadioButtonPreference

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

the class ZenModePrioritySendersPreferenceControllerTest method clickContactsSenders.

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

Example 47 with RadioButtonPreference

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

the class ZenModePrioritySendersPreferenceControllerTest method clickAnySenders.

@Test
public void clickAnySenders() {
    // GIVEN current priority message senders are STARRED
    when(mZenBackend.getPriorityMessageSenders()).thenReturn(PRIORITY_SENDERS_STARRED);
    // WHEN user clicks the any senders option
    RadioButtonPreference allSendersRb = getButton(KEY_ANY);
    allSendersRb.onClick();
    // THEN any senders gets saved as priority senders for messages
    verify(mZenBackend).saveSenders(PRIORITY_CATEGORY_MESSAGES, PRIORITY_SENDERS_ANY);
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Example 48 with RadioButtonPreference

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

the class WebViewAppPickerTest method testEnabledPackageShowsEmptySummary.

@Test
public void testEnabledPackageShowsEmptySummary() {
    DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), null);
    RadioButtonPreference preference = mock(RadioButtonPreference.class);
    mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
    mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
    verify(preference, never()).setSummary(any());
}
Also used : DefaultAppInfo(com.android.settingslib.applications.DefaultAppInfo) RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Example 49 with RadioButtonPreference

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

the class PreventRingingGesturePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mResources = mock(Resources.class);
    when(mContext.getResources()).thenReturn(mResources);
    when(mResources.getBoolean(com.android.internal.R.bool.config_volumeHushGestureEnabled)).thenReturn(true);
    mController = new PreventRingingGesturePreferenceController(mContext, null);
    mController.mPreferenceCategory = new PreferenceCategory(mContext);
    mController.mVibratePref = new RadioButtonPreference(mContext);
    mController.mMutePref = new RadioButtonPreference(mContext);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) Resources(android.content.res.Resources) RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Before(org.junit.Before)

Example 50 with RadioButtonPreference

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

the class PreventRingingGesturePreferenceControllerTest method testRadioButtonClicked_mute.

@Test
public void testRadioButtonClicked_mute() {
    RadioButtonPreference rbPref = new RadioButtonPreference(mContext);
    rbPref.setKey(PreventRingingGesturePreferenceController.KEY_MUTE);
    Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.VOLUME_HUSH_GESTURE, Settings.Secure.VOLUME_HUSH_OFF);
    mController.onRadioButtonClicked(rbPref);
    assertThat(Settings.Secure.VOLUME_HUSH_MUTE).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