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

Commit 9b6652d8 authored by mattsziklay's avatar mattsziklay
Browse files

Change split drag zones to split snap.

Changes the drag transition on the left/right sides of the screen from
changing into splitscreen windowing to remaining in desktop with split
snap bounds.

Also refactors VeiledResizeTaskPositioner to do two things:

1: Consolidate mVeilIsVisible and mIsResizingOrAnimatingResize as these
   were being used identically.
2: Check resizing status before calling hideResizeVeil; hide being
   called on drag end would prevent the veil from showing during the
   split snap animation.

Bug: 280828642
Bug: 317286772
Test: Manual
Change-Id: I61b8da0d2abcf698d8d0ff4c9b5ec7bcce256bbf
parent b43432bc
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -919,19 +919,13 @@ class DesktopTasksController(
        }
        if (inputCoordinate.x <= transitionAreaWidth) {
            releaseVisualIndicator()
            val wct = WindowContainerTransaction()
            addMoveToSplitChanges(wct, taskInfo)
            splitScreenController.requestEnterSplitSelect(taskInfo, wct,
                SPLIT_POSITION_TOP_OR_LEFT, taskBounds)
            snapToHalfScreen(taskInfo, SnapPosition.LEFT)
            return
        }
        if (inputCoordinate.x >= (displayController.getDisplayLayout(taskInfo.displayId)?.width()
            ?.minus(transitionAreaWidth) ?: return)) {
            releaseVisualIndicator()
            val wct = WindowContainerTransaction()
            addMoveToSplitChanges(wct, taskInfo)
            splitScreenController.requestEnterSplitSelect(taskInfo, wct,
                SPLIT_POSITION_BOTTOM_OR_RIGHT, taskBounds)
            snapToHalfScreen(taskInfo, SnapPosition.RIGHT)
            return
        }
        // A freeform drag-move ended, remove the indicator immediately.
+12 −9
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
    private int mCtrlType;
    private boolean mIsResizingOrAnimatingResize;
    @Surface.Rotation private int mRotation;
    private boolean mVeilIsVisible;

    public VeiledResizeTaskPositioner(ShellTaskOrganizer taskOrganizer,
            DesktopModeWindowDecoration windowDecoration,
@@ -119,10 +118,9 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
        if (isResizing() && DragPositioningCallbackUtility.changeBounds(mCtrlType,
                mRepositionTaskBounds, mTaskBoundsAtDragStart, mStableBounds, delta,
                mDisplayController, mDesktopWindowDecoration)) {
            mIsResizingOrAnimatingResize = true;
            if (!mVeilIsVisible) {
            if (!mIsResizingOrAnimatingResize) {
                mDesktopWindowDecoration.showResizeVeil(mRepositionTaskBounds);
                mVeilIsVisible = true;
                mIsResizingOrAnimatingResize = true;
            } else {
                mDesktopWindowDecoration.updateResizeVeil(mRepositionTaskBounds);
            }
@@ -148,11 +146,10 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
                final WindowContainerTransaction wct = new WindowContainerTransaction();
                wct.setBounds(mDesktopWindowDecoration.mTaskInfo.token, mRepositionTaskBounds);
                mTransitions.startTransition(TRANSIT_CHANGE, wct, this);
            } else if (mVeilIsVisible) {
            } else {
                // If bounds haven't changed, perform necessary veil reset here as startAnimation
                // won't be called.
                mDesktopWindowDecoration.hideResizeVeil();
                mIsResizingOrAnimatingResize = false;
                resetVeilIfVisible();
            }
        } else if (DragPositioningCallbackUtility.isBelowDisallowedArea(
                mDisallowedAreaForEndBoundsHeight, mTaskBoundsAtDragStart, mRepositionStartPoint,
@@ -168,7 +165,6 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
        mCtrlType = CTRL_TYPE_UNDEFINED;
        mTaskBoundsAtDragStart.setEmpty();
        mRepositionStartPoint.set(0, 0);
        mVeilIsVisible = false;
        return new Rect(mRepositionTaskBounds);
    }

@@ -177,6 +173,13 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
                || (mCtrlType & CTRL_TYPE_LEFT) != 0 || (mCtrlType & CTRL_TYPE_RIGHT) != 0;
    }

    private void resetVeilIfVisible() {
        if (mIsResizingOrAnimatingResize) {
            mDesktopWindowDecoration.hideResizeVeil();
            mIsResizingOrAnimatingResize = false;
        }
    }

    @Override
    public boolean startAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
            @NonNull SurfaceControl.Transaction startTransaction,
@@ -192,7 +195,7 @@ public class VeiledResizeTaskPositioner implements DragPositioningCallback,
        }

        startTransaction.apply();
        mDesktopWindowDecoration.hideResizeVeil();
        resetVeilIfVisible();
        mCtrlType = CTRL_TYPE_UNDEFINED;
        finishCallback.onTransitionFinished(null);
        mIsResizingOrAnimatingResize = false;