Fix launch animation from bottom row and end of grid

- Apply gridTranslationY when calculating taskRect so it's used to calculate RecnetsView pivot
- Moved recentsViewScroll to RecentsView group and applied after recentsViewScale
- Before: http://dr/file/d/1-Nrqa80J4FRbjcdZ3GZSeKwfQF8fN9a1/view?resourcekey=0-gYT9z1HA0YksW5Ujbzsmeg
- After: http://dr/file/d/1-DpZrg5_nFeUKS-8APnLvG8SJVvke9BU/view?resourcekey=0-p59hm-abzpU7Y7tqWyneTQ

Fix: 200813202
Test: Launch task from grid from top/bottom/left/right/focus
Test: Launch task from left/middle/right in small screen
Change-Id: I814512c02611f59a5a6d1f53411d42cf4f0f26b3
This commit is contained in:
Alex Chau 2021-11-15 20:02:43 +00:00
parent fffea98399
commit b7abf7e96d
3 changed files with 18 additions and 26 deletions

View File

@ -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);

View File

@ -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

View File

@ -4654,20 +4654,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) {