Search in sources :

Example 1 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherAccessibilityDelegate method getSupportedActions.

/**
 * Returns all the accessibility actions that can be handled by the host.
 */
public static List<LauncherAction> getSupportedActions(Launcher launcher, View host) {
    if (host == null || !(host.getTag() instanceof ItemInfo)) {
        return Collections.emptyList();
    }
    PopupContainerWithArrow container = PopupContainerWithArrow.getOpen(launcher);
    LauncherAccessibilityDelegate delegate = container != null ? container.getAccessibilityDelegate() : launcher.getAccessibilityDelegate();
    List<LauncherAction> result = new ArrayList<>();
    delegate.getSupportedActions(host, (ItemInfo) host.getTag(), result);
    return result;
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow)

Example 2 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_Launcher3 by AOSPA.

the class LauncherAccessibilityDelegate method getSupportedActions.

/**
 * Returns all the accessibility actions that can be handled by the host.
 */
public static List<LauncherAction> getSupportedActions(Launcher launcher, View host) {
    if (host == null || !(host.getTag() instanceof ItemInfo)) {
        return Collections.emptyList();
    }
    PopupContainerWithArrow container = PopupContainerWithArrow.getOpen(launcher);
    LauncherAccessibilityDelegate delegate = container != null ? container.getAccessibilityDelegate() : launcher.getAccessibilityDelegate();
    List<LauncherAction> result = new ArrayList<>();
    delegate.getSupportedActions(host, (ItemInfo) host.getTag(), result);
    return result;
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow)

Example 3 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_Launcher3 by ArrowOS.

the class LauncherAccessibilityDelegate method onInitializeAccessibilityNodeInfo.

@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
    if (host.getTag() instanceof ItemInfo) {
        ItemInfo item = (ItemInfo) host.getTag();
        List<LauncherAction> actions = new ArrayList<>();
        getSupportedActions(host, item, actions);
        actions.forEach(la -> info.addAction(la.accessibilityAction));
        if (!itemSupportsLongClick(host, item)) {
            info.setLongClickable(false);
            info.removeAction(AccessibilityAction.ACTION_LONG_CLICK);
        }
    }
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList)

Example 4 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_Launcher3 by ArrowOS.

the class LauncherAccessibilityDelegate method getSupportedActions.

/**
 * Returns all the accessibility actions that can be handled by the host.
 */
public static List<LauncherAction> getSupportedActions(Launcher launcher, View host) {
    if (host == null || !(host.getTag() instanceof ItemInfo)) {
        return Collections.emptyList();
    }
    PopupContainerWithArrow container = PopupContainerWithArrow.getOpen(launcher);
    LauncherAccessibilityDelegate delegate = container != null ? container.getAccessibilityDelegate() : launcher.getAccessibilityDelegate();
    List<LauncherAction> result = new ArrayList<>();
    delegate.getSupportedActions(host, (ItemInfo) host.getTag(), result);
    return result;
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow)

Example 5 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_Launcher3 by ProtonAOSP.

the class LauncherAccessibilityDelegate method onInitializeAccessibilityNodeInfo.

@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
    if (host.getTag() instanceof ItemInfo) {
        ItemInfo item = (ItemInfo) host.getTag();
        List<LauncherAction> actions = new ArrayList<>();
        getSupportedActions(host, item, actions);
        actions.forEach(la -> info.addAction(la.accessibilityAction));
        if (!itemSupportsLongClick(host, item)) {
            info.setLongClickable(false);
            info.removeAction(AccessibilityAction.ACTION_LONG_CLICK);
        }
    }
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList)

Aggregations

PendingAddItemInfo (com.android.launcher3.PendingAddItemInfo)10 ItemInfo (com.android.launcher3.model.data.ItemInfo)10 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)10 ArrayList (java.util.ArrayList)10 PopupContainerWithArrow (com.android.launcher3.popup.PopupContainerWithArrow)5