Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c45e888 authored by Jonathan Miranda's avatar Jonathan Miranda Committed by Android (Google) Code Review
Browse files

Merge "Remove accessibility long click option if no long click action occurs."...

Merge "Remove accessibility long click option if no long click action occurs." into ub-launcher3-master
parents 29f241c6 cafe918f
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -146,11 +146,21 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
            }
        }

        if (!fromKeyboard && !itemSupportsLongClick(host, item)) {
            info.setLongClickable(false);
            info.removeAction(AccessibilityAction.ACTION_LONG_CLICK);
        }

        if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) {
            info.addAction(mActions.get(ADD_TO_WORKSPACE));
        }
    }

    private boolean itemSupportsLongClick(View host, ItemInfo info) {
        return new CustomActionsPopup(mLauncher, host).canShow()
                || ShortcutUtil.supportsShortcuts(info);
    }

    private boolean itemSupportsAccessibleDrag(ItemInfo item) {
        if (item instanceof WorkspaceItemInfo) {
            // Support the action unless the item is in a context menu.
@@ -171,18 +181,18 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme

    public boolean performAction(final View host, final ItemInfo item, int action) {
        if (action == ACTION_LONG_CLICK) {
            if (ShortcutUtil.isDeepShortcut(item)) {
                CustomActionsPopup popup = new CustomActionsPopup(mLauncher, host);
                if (popup.canShow()) {
                    popup.show();
                    return true;
                }
            } else if (host instanceof BubbleTextView) {
            if (ShortcutUtil.supportsShortcuts(item)) {
                // Long press should be consumed for workspace items, and it should invoke the
                // Shortcuts / Notifications / Actions pop-up menu, and not start a drag as the
                // standard long press path does.
                PopupContainerWithArrow.showForIcon((BubbleTextView) host);
                return true;
            } else {
                CustomActionsPopup popup = new CustomActionsPopup(mLauncher, host);
                if (popup.canShow()) {
                    popup.show();
                    return true;
                }
            }
        }