Animate task from overview grid when launching
Bug: 174464863 Test: Manually launching from different grid positions Change-Id: Iafb03b86c6b85fb0ebabc0f2ba98acf89d7ea971
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2729,7 +2729,7 @@ public abstract class RecentsView<T extends StatefulActivity> 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<T extends StatefulActivity> 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<MotionEvent> getEventDispatcher(float navbarRotation) {
|
||||
float degreesRotated;
|
||||
if (navbarRotation == 0) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user