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();
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class UsbDefaultFragment method getCandidates.
@Override
protected List<? extends CandidateInfo> getCandidates() {
List<CandidateInfo> ret = Lists.newArrayList();
for (final long option : UsbDetailsFunctionsController.FUNCTIONS_MAP.keySet()) {
final String title = getContext().getString(UsbDetailsFunctionsController.FUNCTIONS_MAP.get(option));
final String key = UsbBackend.usbFunctionsToString(option);
// Only show supported functions
if (mUsbBackend.areFunctionsSupported(option)) {
ret.add(new CandidateInfo(true) {
/* enabled */
@Override
public CharSequence loadLabel() {
return title;
}
@Override
public Drawable loadIcon() {
return null;
}
@Override
public String getKey() {
return key;
}
});
}
}
return ret;
}
use of com.android.settingslib.widget.CandidateInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatterySaverScheduleSettings method getCandidates.
@Override
protected List<? extends CandidateInfo> getCandidates() {
Context context = getContext();
List<CandidateInfo> candidates = Lists.newArrayList();
String routineProviderApp = getContext().getResources().getString(com.android.internal.R.string.config_batterySaverScheduleProvider);
candidates.add(new BatterySaverScheduleCandidateInfo(context.getText(R.string.battery_saver_auto_no_schedule), /* summary */
null, BatterySaverScheduleRadioButtonsController.KEY_NO_SCHEDULE, /* enabled */
true));
// only add routine option if an app has been specified
if (!TextUtils.isEmpty(routineProviderApp)) {
candidates.add(new BatterySaverScheduleCandidateInfo(context.getText(R.string.battery_saver_auto_routine), context.getText(R.string.battery_saver_auto_routine_summary), BatterySaverScheduleRadioButtonsController.KEY_ROUTINE, /* enabled */
true));
} else {
// Make sure routine is not selected if no provider app is configured
BatterySaverUtils.revertScheduleToNoneIfNeeded(context);
}
candidates.add(new BatterySaverScheduleCandidateInfo(context.getText(R.string.battery_saver_auto_percentage), /* summary */
null, BatterySaverScheduleRadioButtonsController.KEY_PERCENTAGE, /* enabled */
true));
return candidates;
}
Aggregations