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

Commit 38cbf7e9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixing some swipe animations for multi-window" into ub-launcher3-edmonton

parents eba61c64 8c36e3c7
Loading
Loading
Loading
Loading
+16 −22
Original line number Diff line number Diff line
@@ -451,13 +451,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
            }
        }

        if (mLauncherTransitionController != null) {
            Runnable runOnUi = () -> {
                if (mLauncherTransitionController == null) {
                    return;
                }
                mLauncherTransitionController.setPlayFraction(shift);

        if (mRecentsAnimationWrapper.controller != null) {
            // TODO: This logic is spartanic!
            boolean passedThreshold = shift > 0.12f;
@@ -467,14 +460,15 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
                        .setSplitScreenMinimizedForTransaction(passedThreshold);
            }
        }
            };
            if (Looper.getMainLooper() == Looper.myLooper()) {
                runOnUi.run();
            } else {
                // The fling operation completed even before the launcher was drawn
                mMainExecutor.execute(runOnUi);

        mMainExecutor.execute(this::updateFinalShiftUi);
    }

    private void updateFinalShiftUi() {
        if (mLauncherTransitionController == null) {
            return;
        }
        mLauncherTransitionController.setPlayFraction(mCurrentShift.value);
    }

    public void onRecentsAnimationStart(RecentsAnimationControllerCompat controller,
+10 −14
Original line number Diff line number Diff line
@@ -50,8 +50,6 @@ public class ClipAnimationHelper {
    private final RectF mSourceRect = new RectF();
    // The bounds of the task view in launcher window coordinates
    private final RectF mTargetRect = new RectF();
    // Doesn't change after initialized, used as an anchor when changing mTargetOffset
    private final PointF mInitialTargetOffset = new PointF();
    // Set when the final window destination is changed, such as offsetting for quick scrub
    private final PointF mTargetOffset = new PointF();
    // The insets to be used for clipping the app window, which can be larger than mSourceInsets
@@ -84,9 +82,8 @@ public class ClipAnimationHelper {
                mSourceStackBounds.width() - mSourceInsets.right,
                mSourceStackBounds.height() - mSourceInsets.bottom);
        mTargetRect.set(targetRect);
        mInitialTargetOffset.set(mHomeStackBounds.left - mSourceStackBounds.left,
        mTargetRect.offset(mHomeStackBounds.left - mSourceStackBounds.left,
                mHomeStackBounds.top - mSourceStackBounds.top);
        mTargetOffset.set(mInitialTargetOffset);

        // Calculate the clip based on the target rect (since the content insets and the
        // launcher insets may differ, so the aspect ratio of the target rect can differ
@@ -109,6 +106,7 @@ public class ClipAnimationHelper {
        mTmpRectF.set(mTargetRect);
        Utilities.scaleRectFAboutCenter(mTmpRectF, mTargetScale);
        currentRect =  mRectFEvaluator.evaluate(progress, mSourceRect, mTmpRectF);

        synchronized (mTargetOffset) {
            // Stay lined up with the center of the target, since it moves for quick scrub.
            currentRect.offset(mTargetOffset.x * SCROLL.getInterpolation(progress),
@@ -144,8 +142,7 @@ public class ClipAnimationHelper {
    public void offsetTarget(float scale, float offsetX, float offsetY) {
        synchronized (mTargetOffset) {
            mTargetScale = scale;
            mTargetOffset.set(mInitialTargetOffset);
            mTargetOffset.offset(offsetX, offsetY);
            mTargetOffset.set(offsetX, offsetY);
        }
    }

@@ -199,11 +196,10 @@ public class ClipAnimationHelper {

    public void drawForProgress(TaskThumbnailView ttv, Canvas canvas, float progress) {
        RectF currentRect =  mRectFEvaluator.evaluate(progress, mSourceRect, mTargetRect);

        synchronized (mTargetOffset) {
            canvas.translate(-mTargetOffset.x, -mTargetOffset.y);
        }
        canvas.translate(mSourceStackBounds.left - mHomeStackBounds.left,
                mSourceStackBounds.top - mHomeStackBounds.top);
        mTmpMatrix.setRectToRect(mTargetRect, currentRect, ScaleToFit.FILL);

        canvas.concat(mTmpMatrix);
        canvas.translate(mTargetRect.left, mTargetRect.top);