use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class LocationInjectedServicesForWorkPreferenceController method injectLocationServices.
@Override
protected void injectLocationServices(PreferenceScreen screen) {
final PreferenceCategory categoryLocationServices = screen.findPreference(getPreferenceKey());
final Map<Integer, List<Preference>> prefs = getLocationServices();
for (Map.Entry<Integer, List<Preference>> entry : prefs.entrySet()) {
for (Preference pref : entry.getValue()) {
if (pref instanceof RestrictedAppPreference) {
((RestrictedAppPreference) pref).checkRestrictionAndSetDisabled();
}
}
if (entry.getKey() != UserHandle.myUserId()) {
LocationSettings.addPreferencesSorted(entry.getValue(), categoryLocationServices);
}
}
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class AppBubbleListPreferenceControllerTest method clickConversationPref_updatesChannel.
@Test
public void clickConversationPref_updatesChannel() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
appRow.pkg = "PKG";
mController.onResume(appRow, null, null, null, null, null, null);
mController.mPreference = new PreferenceCategory(mContext);
ConversationChannelWrapper ccw = mConvoList.getList().get(0);
AppBubbleListPreferenceController.ConversationPreference pref = (AppBubbleListPreferenceController.ConversationPreference) mController.createConversationPref(ccw);
pref.onClick(null);
verify(ccw.getNotificationChannel()).setAllowBubbles(DEFAULT_ALLOW_BUBBLE);
verify(mBackend).updateChannel(anyString(), anyInt(), any(NotificationChannel.class));
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class EnterpriseSetDefaultAppsListPreferenceController method updateUi.
private void updateUi() {
final Context prefContext = mParent.getPreferenceManager().getContext();
final PreferenceScreen screen = mParent.getPreferenceScreen();
if (screen == null) {
return;
}
if (!mEnterprisePrivacyFeatureProvider.isInCompMode() && mUsers.size() == 1) {
createPreferences(prefContext, screen, mApps.get(0));
} else {
for (int i = 0; i < mUsers.size(); i++) {
final UserInfo userInfo = mUsers.get(i);
final PreferenceCategory category = new PreferenceCategory(prefContext);
screen.addPreference(category);
if (userInfo.isManagedProfile()) {
category.setTitle(R.string.category_work);
} else {
category.setTitle(R.string.category_personal);
}
category.setOrder(i);
createPreferences(prefContext, category, mApps.get(i));
}
}
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class AllConversationsPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
PreferenceCategory pref = (PreferenceCategory) preference;
// Load conversations
mConversations = mBackend.getConversations(false).getList();
Collections.sort(mConversations, mConversationComparator);
populateList(mConversations, pref);
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class UsbDetailsTranscodeMtpControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mPreferenceManager = new PreferenceManager(mContext);
mScreen = mPreferenceManager.createPreferenceScreen(mContext);
when(mFragment.getActivity()).thenReturn(mActivity);
when(mActivity.getApplicationContext()).thenReturn(mContext);
when(mFragment.getContext()).thenReturn(mContext);
when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
mUnderTest = new UsbDetailsTranscodeMtpController(mContext, mFragment, mUsbBackend);
mPreference = new PreferenceCategory(mContext);
mPreference.setKey(mUnderTest.getPreferenceKey());
mScreen.addPreference(mPreference);
}
Aggregations