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);
}
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);
}
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();
}
}
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());
}
}
}
}
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));
}
Aggregations