Search in sources :

Example 56 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

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.settings.widget.RadioButtonPreference) Before(org.junit.Before)

Example 57 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FaceStatusPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    PreferenceCategory category = screen.findPreference(PREF_KEY_SECURITY_CATEGORY);
    mPreference = category.findPreference(KEY_FACE_SETTINGS);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory)

Example 58 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChannelListPreferenceController method populateList.

private void populateList() {
    // TODO: if preference has children, compare with newly loaded list
    mPreference.removeAll();
    if (mChannelGroupList.isEmpty()) {
        PreferenceCategory groupCategory = new PreferenceCategory(mContext);
        groupCategory.setTitle(R.string.notification_channels);
        groupCategory.setKey(KEY_GENERAL_CATEGORY);
        mPreference.addPreference(groupCategory);
        Preference empty = new Preference(mContext);
        empty.setTitle(R.string.no_channels);
        empty.setEnabled(false);
        groupCategory.addPreference(empty);
    } else {
        populateGroupList();
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) MasterSwitchPreference(com.android.settings.widget.MasterSwitchPreference)

Example 59 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChannelListPreferenceController method populateGroupList.

private void populateGroupList() {
    for (NotificationChannelGroup group : mChannelGroupList) {
        PreferenceCategory groupCategory = new PreferenceCategory(mContext);
        groupCategory.setOrderingAsAdded(true);
        mPreference.addPreference(groupCategory);
        if (group.getId() == null) {
            if (mChannelGroupList.size() > 1) {
                groupCategory.setTitle(R.string.notification_channels_other);
            }
            groupCategory.setKey(KEY_GENERAL_CATEGORY);
        } else {
            groupCategory.setTitle(group.getName());
            groupCategory.setKey(group.getId());
            populateGroupToggle(groupCategory, group);
        }
        if (!group.isBlocked()) {
            final List<NotificationChannel> channels = group.getChannels();
            Collections.sort(channels, mChannelComparator);
            int N = channels.size();
            for (int i = 0; i < N; i++) {
                final NotificationChannel channel = channels.get(i);
                populateSingleChannelPrefs(groupCategory, channel, group.isBlocked());
            }
        }
    }
}
Also used : NotificationChannel(android.app.NotificationChannel) NotificationChannelGroup(android.app.NotificationChannelGroup) PreferenceCategory(androidx.preference.PreferenceCategory)

Example 60 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class RestrictedAppDetailsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mRestrictedAppDetails = spy(new RestrictedAppDetails());
    mAppInfo = new AppInfo.Builder().setPackageName(PACKAGE_NAME).setUid(UID).build();
    mPreferenceManager = new PreferenceManager(mContext);
    doReturn(mPreferenceManager).when(mRestrictedAppDetails).getPreferenceManager();
    doReturn(mContext).when(mFragment).getContext();
    doReturn(mContext).when(mRestrictedAppDetails).getContext();
    mRestrictedAppDetails.mPackageManager = mPackageManager;
    mRestrictedAppDetails.mIconDrawableFactory = mIconDrawableFactory;
    mRestrictedAppDetails.mAppInfos = new ArrayList<>();
    mRestrictedAppDetails.mAppInfos.add(mAppInfo);
    mRestrictedAppDetails.mRestrictedAppListGroup = spy(new PreferenceCategory(mContext));
    mRestrictedAppDetails.mBatteryUtils = spy(new BatteryUtils(mContext));
    mRestrictedAppDetails.mBatteryDatabaseManager = mBatteryDatabaseManager;
    doReturn(mPreferenceManager).when(mRestrictedAppDetails.mRestrictedAppListGroup).getPreferenceManager();
    mCheckBoxPreference = new CheckBoxPreference(mContext);
    mCheckBoxPreference.setKey(mRestrictedAppDetails.getKeyFromAppInfo(mAppInfo));
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) CheckBoxPreference(androidx.preference.CheckBoxPreference) PreferenceManager(androidx.preference.PreferenceManager) Before(org.junit.Before)

Aggregations

PreferenceCategory (androidx.preference.PreferenceCategory)111 Preference (androidx.preference.Preference)38 PreferenceManager (androidx.preference.PreferenceManager)24 Before (org.junit.Before)24 PreferenceScreen (androidx.preference.PreferenceScreen)22 Test (org.junit.Test)19 SwitchPreference (androidx.preference.SwitchPreference)13 NotificationChannel (android.app.NotificationChannel)11 ArrayList (java.util.ArrayList)11 NotificationChannelGroup (android.app.NotificationChannelGroup)9 ShortcutInfo (android.content.pm.ShortcutInfo)9 Context (android.content.Context)8 ConversationChannel (android.app.people.ConversationChannel)7 View (android.view.View)7 PreferenceViewHolder (androidx.preference.PreferenceViewHolder)7 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)7 ListPreference (androidx.preference.ListPreference)6 ComponentName (android.content.ComponentName)5 ContentResolver (android.content.ContentResolver)5 Bundle (android.os.Bundle)5