Search in sources :

Example 6 with LauncherAction

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

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 7 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_404Launcher by P-404.

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 8 with LauncherAction

use of com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction in project android_packages_apps_404Launcher by P-404.

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 9 with LauncherAction

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

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 10 with LauncherAction

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

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