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

Commit 3eca7440 authored by Abhishek Aggarwal's avatar Abhishek Aggarwal Committed by Mohammed Althaf T
Browse files

fix(drag): Fix icon getting stuck

parent eb615a5e
Loading
Loading
Loading
Loading
+12 −36
Original line number Diff line number Diff line
@@ -1200,36 +1200,6 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        return super.onInterceptTouchEvent(ev);
    }

    /**
     * Needed here because launcher has a fullscreen exclusion rect and doesn't pilfer the pointers.
     */
    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (isTrackpadMultiFingerSwipe(ev)) {
            return false;
        }

        int[] cell = new int[2];
        final CellLayout cellLayout = (CellLayout) getChildAt(getCurrentPage());
        cellLayout.pointToCellExact((int) ev.getX(), (int) ev.getY(), cell);

        if ((cellLayout.isOccupied(cell[0], cell[1]))) {
            View v= cellLayout.getChildAt(cell[0], cell[1]);
            if (v instanceof BubbleTextView) {
                RectF rect = new RectF();
                FloatingIconView.getLocationBoundsForView(mLauncher, v, false, rect,
                        new Rect());

                if (rect.contains(ev.getX(), ev.getY()) && ev.getAction() == MotionEvent.ACTION_MOVE) {
                    return false;
                }
            }
        }

        return super.onTouchEvent(ev);
    }

    @Override
    protected void onDisallowSwipeToMinusOnePage() {
        mLauncher.getOverlayManager().onDisallowSwipeToMinusOnePage();
@@ -1243,10 +1213,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return shouldConsumeTouch(v, event);
        return shouldConsumeTouch(v);
    }

    private boolean shouldConsumeTouch(View v, MotionEvent event) {
    private boolean shouldConsumeTouch(View v) {
        return !workspaceIconsCanBeDragged()
                || (!workspaceInModalState() && !isVisible(v));
    }
@@ -1806,12 +1776,18 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
    }

    public void startDrag(CellInfo cellInfo, DragOptions options) {
        if (!isWobbling() && MultiModeController.isSingleLayerMode()) {
        View child = cellInfo.cell;

        if (MultiModeController.isSingleLayerMode() ) {
            if (!isWobbling()) {
                wobbleLayouts(true);
           // return;
                return;
            } else {
                assert child != null;
                child.setOnTouchListener(null);
            }
        }

        View child = cellInfo.cell;
        if (wobbleExpireAlarm.alarmPending()) {
            wobbleExpireAlarm.cancelAlarm();
        }
+0 −1
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ public class ItemLongClickListener {
        if (ev.getEventTime() - ev.getDownTime() < 150) {
            return false;
        }

        return onWorkspaceItemLongClick(v);
    }