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

Commit b0e80bce authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fixing missed events during motion interaction

> Only ignoring touch events during the start of the motion events
> Handling action_cancel

Bug: 30291280
Change-Id: I4aa791b30c65ebaff90bb2f232d77de62ab6a033
parent 76acffce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -388,6 +388,8 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
                    break;
                }
            }
        } else if (action == MotionEvent.ACTION_CANCEL) {
            cleanupDeferredDrag();
        }
        return true;
    }
+12 −5
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ public class ShortcutsContainerListener implements View.OnTouchListener,
    private final int[] mTouchDown;
    private boolean mHasMappedTouchDownToContainerCoord;

    /** If true, the gesture is not handled. The value is reset when next gesture starts. */
    private boolean mIgnoreCurrentGesture;

    public ShortcutsContainerListener(BubbleTextView icon) {
        mSrcIcon = icon;
        mScaledTouchSlop = ViewConfiguration.get(icon.getContext()).getScaledTouchSlop();
@@ -72,18 +75,22 @@ public class ShortcutsContainerListener implements View.OnTouchListener,

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (mLauncher.getShortcutIdsForItem((ItemInfo) v.getTag()).isEmpty()) {
            // There are no shortcuts associated with this item, so return to normal touch handling.
            return false;
        }

        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            // There are no shortcuts associated with this item,
            // so return to normal touch handling.
            mIgnoreCurrentGesture =
                    (mLauncher.getShortcutIdsForItem((ItemInfo) v.getTag())).isEmpty();

            mTouchDown[0] = (int) event.getX();
            mTouchDown[1] = (int) event.getY();
            mDragLayer.getDescendantCoordRelativeToSelf(mSrcIcon, mTouchDown);
            mHasMappedTouchDownToContainerCoord = false;
        }

        if (mIgnoreCurrentGesture) {
            return false;
        }

        final boolean wasForwarding = mForwarding;
        final boolean forwarding;
        if (wasForwarding) {