diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java index 39751c0d71..17822e6f0c 100644 --- a/quickstep/src/com/android/quickstep/TaskViewUtils.java +++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java @@ -180,6 +180,7 @@ public final class TaskViewUtils { boolean parallaxCenterAndAdjacentTask = taskIndex != recentsView.getCurrentPage() && !(dp.isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()); + float gridTranslationSecondary = recentsView.getGridTranslationSecondary(taskIndex); int startScroll = recentsView.getScrollOffset(taskIndex); TaskViewSimulator topMostSimulator = null; @@ -196,6 +197,8 @@ public final class TaskViewUtils { tsv.setPreview(targets.apps[targets.apps.length - 1]); tsv.fullScreenProgress.value = 0; tsv.recentsViewScale.value = 1; + tsv.gridProgress.value = 1; + tsv.gridTranslationSecondary.value = gridTranslationSecondary; tsv.setScroll(startScroll); // Fade in the task during the initial 20% of the animation @@ -208,6 +211,7 @@ public final class TaskViewUtils { AnimatedFloat.VALUE, 1, TOUCH_RESPONSE_INTERPOLATOR); out.setFloat(tsv.recentsViewScale, AnimatedFloat.VALUE, tsv.getFullScreenScale(), TOUCH_RESPONSE_INTERPOLATOR); + out.setFloat(tsv.gridProgress, AnimatedFloat.VALUE, 0, TOUCH_RESPONSE_INTERPOLATOR); out.setInt(tsv, TaskViewSimulator.SCROLL, 0, TOUCH_RESPONSE_INTERPOLATOR); TaskViewSimulator finalTsv = tsv; diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 584a284381..9537247295 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -16,7 +16,6 @@ package com.android.quickstep.util; import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL; -import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.states.RotationHelper.deltaRotation; import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE; import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE; @@ -98,6 +97,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { private final FullscreenDrawParams mCurrentFullscreenParams; public final AnimatedFloat taskPrimaryTranslation = new AnimatedFloat(); public final AnimatedFloat taskSecondaryTranslation = new AnimatedFloat(); + public final AnimatedFloat gridTranslationSecondary = new AnimatedFloat(); // RecentsView properties public final AnimatedFloat recentsViewScale = new AnimatedFloat(); @@ -317,9 +317,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mMatrix.postScale(scale, scale, mIsRecentsRtl ? 0 : taskWidth, 0); float taskWidthDiff = taskWidth * (1 - gridScale); float taskWidthOffset = mIsRecentsRtl ? taskWidthDiff : -taskWidthDiff; - float translationPrimary = Utilities.mapRange(interpolatedGridProgress, 0, taskWidthOffset); mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE, - translationPrimary); + Utilities.mapRange(interpolatedGridProgress, 0, taskWidthOffset)); + mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE, + Utilities.mapRange(interpolatedGridProgress, 0, gridTranslationSecondary.value)); // Apply TaskView matrix: translate, scroll mMatrix.postTranslate(mTaskRect.left, mTaskRect.top); diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 78910ceddd..db482acebb 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2729,7 +2729,7 @@ public abstract class RecentsView extends PagedView } /** - * @return How many pixels the page is offset on the currently laid out dominant axis. + * Returns how many pixels the page is offset on the currently laid out dominant axis. */ public int getScrollOffset(int pageIndex) { if (pageIndex == -1) { @@ -2745,6 +2745,20 @@ public abstract class RecentsView extends PagedView return getScrollForPage(pageIndex) - scroll; } + /** + * 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 = getTaskViewAtByAbsoluteIndex(pageIndex); + if (taskView == null) { + return 0; + } + + return mOrientationHandler.getSecondaryValue(taskView.getGridTranslationX(), + taskView.getGridTranslationY()); + } + public Consumer getEventDispatcher(float navbarRotation) { float degreesRotated; if (navbarRotation == 0) { diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 3fb5998300..49f5a7a810 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -919,11 +919,19 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { applyTranslationX(); } + public float getGridTranslationX() { + return mGridTranslationX; + } + public void setGridTranslationY(float gridTranslationY) { mGridTranslationY = gridTranslationY; applyTranslationY(); } + public float getGridTranslationY() { + return mGridTranslationY; + } + public void setGridOffsetTranslationX(float gridOffsetTranslationX) { mGridOffsetTranslationX = gridOffsetTranslationX; applyTranslationX();