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

Commit 7c9055fc authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Fix launch animation from bottom row and end of grid" into sc-v2-dev

parents a37f8baa b7abf7e9
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import static com.android.launcher3.QuickstepTransitionManager.SPLIT_LAUNCH_DURA
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL;
import static com.android.launcher3.anim.Interpolators.clampToProgress;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
@@ -193,7 +192,6 @@ public final class TaskViewUtils {
        boolean showAsGrid = dp.overviewShowAsGrid;
        boolean parallaxCenterAndAdjacentTask =
                taskIndex != recentsView.getCurrentPage() && !showAsGrid;
        float gridTranslationSecondary = recentsView.getGridTranslationSecondary(taskIndex);
        int startScroll = recentsView.getScrollOffset(taskIndex);

        RemoteTargetHandle[] topMostSimulators = null;
@@ -211,11 +209,9 @@ public final class TaskViewUtils {

                tvsLocal.fullScreenProgress.value = 0;
                tvsLocal.recentsViewScale.value = 1;
                if (showAsGrid) {
                    tvsLocal.taskSecondaryTranslation.value = gridTranslationSecondary;
                }
                tvsLocal.setScroll(startScroll);
                tvsLocal.setIsGridTask(v.isGridTask());
                tvsLocal.setGridTranslationY(v.getGridTranslationY());

                // Fade in the task during the initial 20% of the animation
                out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,
@@ -230,10 +226,6 @@ public final class TaskViewUtils {
            out.setFloat(tvsLocal.recentsViewScale,
                    AnimatedFloat.VALUE, tvsLocal.getFullScreenScale(),
                    TOUCH_RESPONSE_INTERPOLATOR);
            if (showAsGrid) {
                out.setFloat(tvsLocal.taskSecondaryTranslation, AnimatedFloat.VALUE, 0,
                        TOUCH_RESPONSE_INTERPOLATOR_ACCEL_DEACCEL);
            }
            out.setFloat(tvsLocal.recentsViewScroll, AnimatedFloat.VALUE, 0,
                    TOUCH_RESPONSE_INTERPOLATOR);

+17 −3
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    private StagedSplitBounds mStagedSplitBounds;
    private boolean mDrawsBelowRecents;
    private boolean mIsGridTask;
    private float mGridTranslationY;

    public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
        mContext = context;
@@ -156,9 +157,15 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
            fullTaskSize = new Rect(mTaskRect);
            mOrientationState.getOrientationHandler()
                    .setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
            if (mIsGridTask) {
                mTaskRect.offset(0, (int) mGridTranslationY);
            }
        } else {
            fullTaskSize = mTaskRect;
        }
        if (mIsGridTask) {
            fullTaskSize.offset(0, (int) mGridTranslationY);
        }
        return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
    }

@@ -217,6 +224,13 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        mIsGridTask = isGridTask;
    }

    /**
     * Sets the y-translation when overview is in grid.
     */
    public void setGridTranslationY(float gridTranslationY) {
        mGridTranslationY = gridTranslationY;
    }

    /**
     * Adds animation for all the components corresponding to transition from an app to overview.
     */
@@ -320,14 +334,12 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        mMatrix.postTranslate(insets.left, insets.top);
        mMatrix.postScale(scale, scale);

        // Apply TaskView matrix: translate, scroll
        // Apply TaskView matrix: taskRect, translate
        mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
        mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
                taskPrimaryTranslation.value);
        mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
                taskSecondaryTranslation.value);
        mOrientationState.getOrientationHandler().set(
                mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);

        // Apply RecentsView matrix
        mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
@@ -335,6 +347,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
                recentsViewSecondaryTranslation.value);
        mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
                recentsViewPrimaryTranslation.value);
        mOrientationState.getOrientationHandler().set(
                mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
        applyWindowToHomeRotation(mMatrix);

        // Crop rect is the inverse of thumbnail matrix
+0 −14
Original line number Diff line number Diff line
@@ -4679,20 +4679,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        return position != -1 ? position : bottomRowIdArray.indexOf(taskView.getTaskViewId());
    }

    /**
     * Returns how many pixels the task is offset on the currently laid out secondary axis
     * according to {@link #mGridProgress}.
     */
    public float getGridTranslationSecondary(int pageIndex) {
        TaskView taskView = getTaskViewAt(pageIndex);
        if (taskView == null) {
            return 0;
        }

        return mOrientationHandler.getSecondaryValue(taskView.getGridTranslationX(),
                taskView.getGridTranslationY());
    }

    public Consumer<MotionEvent> getEventDispatcher(float navbarRotation) {
        float degreesRotated;
        if (navbarRotation == 0) {