Search in sources :

Example 1 with RadioButtonPreference

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

the class ZenModePrioritySendersPreferenceController method makeRadioPreference.

private RadioButtonPreference makeRadioPreference(String key, int titleId) {
    final RadioButtonPreference pref = new RadioButtonPreference(mPreferenceCategory.getContext());
    pref.setKey(key);
    pref.setTitle(titleId);
    pref.setOnClickListener(mRadioButtonClickListener);
    View.OnClickListener widgetClickListener = getWidgetClickListener(key);
    if (widgetClickListener != null) {
        pref.setExtraWidgetOnClickListener(widgetClickListener);
    }
    mPreferenceCategory.addPreference(pref);
    mRadioButtonPreferences.add(pref);
    return pref;
}
Also used : View(android.view.View) RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference)

Example 2 with RadioButtonPreference

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

the class ZenModePriorityConversationsPreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    final int currSetting = mBackend.getPriorityConversationSenders();
    for (RadioButtonPreference pref : mRadioButtonPreferences) {
        pref.setChecked(keyToSetting(pref.getKey()) == currSetting);
        pref.setSummary(getSummary(pref.getKey()));
    }
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference)

Example 3 with RadioButtonPreference

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

the class ZenModePriorityConversationsPreferenceController method makeRadioPreference.

private RadioButtonPreference makeRadioPreference(String key, int titleId) {
    final RadioButtonPreference pref = new RadioButtonPreference(mPreferenceCategory.getContext());
    if (KEY_ALL.equals(key) || KEY_IMPORTANT.equals(key)) {
        pref.setExtraWidgetOnClickListener(mConversationSettingsWidgetClickListener);
    }
    pref.setKey(key);
    pref.setTitle(titleId);
    pref.setOnClickListener(mRadioButtonClickListener);
    mPreferenceCategory.addPreference(pref);
    mRadioButtonPreferences.add(pref);
    return pref;
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference)

Example 4 with RadioButtonPreference

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

the class ZenModePriorityConversationsPreferenceControllerTest method clickImportantConversations.

@Test
public void clickImportantConversations() {
    RadioButtonPreference importantConversationsRb = getButton(KEY_IMPORTANT);
    importantConversationsRb.onClick();
    verify(mZenBackend).saveConversationSenders(CONVERSATION_SENDERS_IMPORTANT);
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Example 5 with RadioButtonPreference

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

the class ZenModePrioritySendersPreferenceControllerTest method clickStarredSenders.

@Test
public void clickStarredSenders() {
    // GIVEN current priority message senders are ANY
    when(mZenBackend.getPriorityMessageSenders()).thenReturn(PRIORITY_SENDERS_ANY);
    // WHEN user clicks the starred contacts option
    RadioButtonPreference starredRb = getButton(KEY_STARRED);
    starredRb.onClick();
    // THEN starred contacts gets saved as priority senders for messages
    verify(mZenBackend).saveSenders(PRIORITY_CATEGORY_MESSAGES, PRIORITY_SENDERS_STARRED);
}
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