use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationAssistantPickerTest method dialogTextHasAssistantName.
@Test
public void dialogTextHasAssistantName() {
CandidateInfo c = mock(CandidateInfo.class);
when(mContext.getString(anyInt(), anyString())).thenAnswer((InvocationOnMock invocation) -> {
return invocation.getArgument(1);
});
when(c.loadLabel()).thenReturn(TEST_NAME);
when(c.getKey()).thenReturn(TEST_CMP);
CharSequence text = mFragment.getConfirmationMessage(c);
assertNotNull(text);
assertTrue(text.toString().contains(TEST_NAME));
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationAssistantPicker method onServicesReloaded.
@Override
public void onServicesReloaded(List<ServiceInfo> services) {
List<CandidateInfo> list = new ArrayList<>();
services.sort(new PackageItemInfo.DisplayNameComparator(mPm));
for (ServiceInfo service : services) {
if (mContext.getPackageManager().checkPermission(android.Manifest.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE, service.packageName) == PackageManager.PERMISSION_GRANTED) {
final ComponentName cn = new ComponentName(service.packageName, service.name);
list.add(new DefaultAppInfo(mContext, mPm, mUserId, cn));
}
}
list.add(new CandidateNone(mContext));
mCandidateInfos = list;
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NotificationAssistantPreferenceController method getSummary.
@Override
public CharSequence getSummary() {
CandidateInfo appSelected = new NotificationAssistantPicker.CandidateNone(mContext);
ComponentName assistant = mNotificationBackend.getAllowedNotificationAssistant();
if (assistant != null) {
appSelected = createCandidateInfo(assistant);
}
return appSelected.loadLabel();
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ShortcutServicePickerFragment method getCandidates.
@Override
protected List<? extends CandidateInfo> getCandidates() {
final Context context = getContext();
final AccessibilityManager accessibilityManager = context.getSystemService(AccessibilityManager.class);
final List<AccessibilityServiceInfo> installedServices = accessibilityManager.getInstalledAccessibilityServiceList();
final int numInstalledServices = installedServices.size();
final List<CandidateInfo> candidates = new ArrayList<>(numInstalledServices);
Map<ComponentName, ToggleableFrameworkFeatureInfo> frameworkFeatureInfoMap = AccessibilityShortcutController.getFrameworkShortcutFeaturesMap();
for (ComponentName componentName : frameworkFeatureInfoMap.keySet()) {
final int iconId;
if (componentName.equals(COLOR_INVERSION_COMPONENT_NAME)) {
iconId = R.drawable.ic_color_inversion;
} else if (componentName.equals(DALTONIZER_COMPONENT_NAME)) {
iconId = R.drawable.ic_daltonizer;
} else {
iconId = R.drawable.empty_icon;
}
candidates.add(new FrameworkCandidateInfo(frameworkFeatureInfoMap.get(componentName), iconId, componentName.flattenToString()));
}
for (int i = 0; i < numInstalledServices; i++) {
candidates.add(new ServiceCandidateInfo(installedServices.get(i)));
}
return candidates;
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SystemNavigationGestureSettings method updateCandidates.
@Override
public void updateCandidates() {
final String defaultKey = getDefaultKey();
final String systemDefaultKey = getSystemDefaultKey();
final PreferenceScreen screen = getPreferenceScreen();
screen.removeAll();
screen.addPreference(mVideoPreference);
final List<? extends CandidateInfo> candidateList = getCandidates();
if (candidateList == null) {
return;
}
for (CandidateInfo info : candidateList) {
RadioButtonPreferenceWithExtraWidget pref = new RadioButtonPreferenceWithExtraWidget(getPrefContext());
bindPreference(pref, info.getKey(), info, defaultKey);
bindPreferenceExtra(pref, info.getKey(), info, defaultKey, systemDefaultKey);
screen.addPreference(pref);
}
mayCheckOnlyRadioButton();
}
Aggregations