Move task to middle when dragging up in grid only overview
When dragging up, TaskView should be in the middle of the screen if grid only overview is enabled. The pivot and translation of current task and other tasks are changed to move it to the middle. Bug: 291880228 Test: TaplTestsQuickstep#testBackground Test: Manual Test, swipe up to go from app to overview, app launch for live/non-live, split screen as live/non-live task. Test the same scenario in 3P Launcher Flag: enableGridOnlyOverview Change-Id: I297119283771ef70c916c63f799552656d767661
This commit is contained in:
1 parent
927c78f2c6
commit
d60eff365b
3 files changed
+36
-9
No files matched your search
@@ -17,6 +17,7 @@ package com.android.quickstep.util;
|
||||
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
|
||||
import static com.android.launcher3.Flags.enableGridOnlyOverview;
|
||||
import static com.android.launcher3.states.RotationHelper.deltaRotation;
|
||||
import static com.android.launcher3.touch.PagedOrientationHandler.MATRIX_POST_TRANSLATE;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
@@ -108,6 +109,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
private boolean mIsDesktopTask;
|
||||
private int mTaskRectTranslationX;
|
||||
private int mTaskRectTranslationY;
|
||||
private int mPivotOffsetX;
|
||||
|
||||
public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
|
||||
mContext = context;
|
||||
@@ -179,9 +181,10 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
// Ensure the task rect is inside the full task rect
|
||||
mTaskRect.offset(fullTaskSize.left, fullTaskSize.top);
|
||||
} else {
|
||||
fullTaskSize = mTaskRect;
|
||||
fullTaskSize = new Rect(mTaskRect);
|
||||
mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY);
|
||||
}
|
||||
fullTaskSize.offset(mTaskRectTranslationX, mTaskRectTranslationY);
|
||||
fullTaskSize.offset(mTaskRectTranslationX + mPivotOffsetX, mTaskRectTranslationY);
|
||||
return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
|
||||
}
|
||||
|
||||
@@ -265,6 +268,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
|
||||
*/
|
||||
public void addAppToOverviewAnim(PendingAnimation pa, TimeInterpolator interpolator) {
|
||||
pa.addFloat(fullScreenProgress, AnimatedFloat.VALUE, 1, 0, interpolator);
|
||||
if (enableGridOnlyOverview() && mDp.isTablet) {
|
||||
int translationXToMiddle = mDp.widthPx / 2 - mTaskRect.centerX();
|
||||
taskPrimaryTranslation.value = translationXToMiddle;
|
||||
mPivotOffsetX = translationXToMiddle;
|
||||
}
|
||||
pa.addFloat(recentsViewScale, AnimatedFloat.VALUE, getFullScreenScale(), 1, interpolator);
|
||||
}
|
||||
|
||||
|
||||
@@ -2101,11 +2101,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
|
||||
float accumulatedTranslationX = 0;
|
||||
float translateXToMiddle = enableGridOnlyOverview() && mActivity.getDeviceProfile().isTablet
|
||||
? mActivity.getDeviceProfile().widthPx / 2 - mLastComputedGridTaskSize.centerX()
|
||||
: 0;
|
||||
for (int i = 0; i < taskCount; i++) {
|
||||
TaskView taskView = requireTaskViewAt(i);
|
||||
taskView.updateTaskSize();
|
||||
taskView.getPrimaryNonGridTranslationProperty().set(taskView, accumulatedTranslationX);
|
||||
taskView.getSecondaryNonGridTranslationProperty().set(taskView, 0f);
|
||||
taskView.setNonGridPivotTranslationX(translateXToMiddle);
|
||||
// Compensate space caused by TaskView scaling.
|
||||
float widthDiff =
|
||||
taskView.getLayoutParams().width * (1 - taskView.getNonGridScale());
|
||||
@@ -4322,14 +4326,19 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
|
||||
Utilities.getPivotsForScalingRectToRect(mTempRect, selectedTaskPosition,
|
||||
mTempPointF);
|
||||
setPivotX(mTempPointF.x);
|
||||
setPivotY(mTempPointF.y);
|
||||
} else {
|
||||
mTempRect.set(mLastComputedTaskSize);
|
||||
// Only update pivot when it is tablet and not in grid yet, so the pivot is correct
|
||||
// for non-current tasks when swiping up to overview
|
||||
if (enableGridOnlyOverview() && mActivity.getDeviceProfile().isTablet
|
||||
&& !mOverviewGridEnabled) {
|
||||
mTempRect.offset(mActivity.getDeviceProfile().widthPx / 2 - mTempRect.centerX(), 0);
|
||||
}
|
||||
getPagedViewOrientedState().getFullScreenScaleAndPivot(mTempRect,
|
||||
mActivity.getDeviceProfile(), mTempPointF);
|
||||
setPivotX(mTempPointF.x);
|
||||
setPivotY(mTempPointF.y);
|
||||
}
|
||||
setPivotX(mTempPointF.x);
|
||||
setPivotY(mTempPointF.y);
|
||||
}
|
||||
|
||||
private void updatePageOffsets() {
|
||||
|
||||
@@ -384,6 +384,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
// switch.
|
||||
private float mNonGridTranslationX;
|
||||
private float mNonGridTranslationY;
|
||||
private float mNonGridPivotTranslationX;
|
||||
// Used when in SplitScreenSelectState
|
||||
private float mSplitSelectTranslationY;
|
||||
private float mSplitSelectTranslationX;
|
||||
@@ -1284,8 +1285,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
|
||||
protected void resetPersistentViewTransforms() {
|
||||
mNonGridTranslationX = mNonGridTranslationY =
|
||||
mGridTranslationX = mGridTranslationY = mBoxTranslationY = 0f;
|
||||
mNonGridTranslationX = mNonGridTranslationY = mGridTranslationX =
|
||||
mGridTranslationY = mBoxTranslationY = mNonGridPivotTranslationX = 0f;
|
||||
resetViewTransforms();
|
||||
}
|
||||
|
||||
@@ -1487,6 +1488,14 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
applyTranslationX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set translation X for non-grid pivot
|
||||
*/
|
||||
public void setNonGridPivotTranslationX(float nonGridPivotTranslationX) {
|
||||
mNonGridPivotTranslationX = nonGridPivotTranslationX;
|
||||
applyTranslationX();
|
||||
}
|
||||
|
||||
public float getScrollAdjustment(boolean gridEnabled) {
|
||||
float scrollAdjustment = 0;
|
||||
if (gridEnabled) {
|
||||
@@ -1529,7 +1538,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
* change according to a temporary state (e.g. task offset).
|
||||
*/
|
||||
public float getPersistentTranslationX() {
|
||||
return getNonGridTrans(mNonGridTranslationX) + getGridTrans(mGridTranslationX);
|
||||
return getNonGridTrans(mNonGridTranslationX) + getGridTrans(mGridTranslationX)
|
||||
+ getNonGridTrans(mNonGridPivotTranslationX);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user