Search in sources :

Example 1 with ToggleableFrameworkFeatureInfo

use of com.android.internal.accessibility.AccessibilityShortcutController.ToggleableFrameworkFeatureInfo 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;
}
Also used : Context(android.content.Context) CandidateInfo(com.android.settingslib.widget.CandidateInfo) ArrayList(java.util.ArrayList) AccessibilityServiceInfo(android.accessibilityservice.AccessibilityServiceInfo) AccessibilityManager(android.view.accessibility.AccessibilityManager) ComponentName(android.content.ComponentName) ToggleableFrameworkFeatureInfo(com.android.internal.accessibility.AccessibilityShortcutController.ToggleableFrameworkFeatureInfo)

Aggregations

AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 AccessibilityManager (android.view.accessibility.AccessibilityManager)1 ToggleableFrameworkFeatureInfo (com.android.internal.accessibility.AccessibilityShortcutController.ToggleableFrameworkFeatureInfo)1 CandidateInfo (com.android.settingslib.widget.CandidateInfo)1 ArrayList (java.util.ArrayList)1