Support both grid and large tile with gridOnlyOverivew

- With the introduction of Desktop windowing, we'll need to supprot grid task and large tile (desktop tile) coexisting
- The previous gridOnlyOverview aimed to have taskSize matches actual grid task size, and introduced another carouselTaskSize for scaling in swipe up carousel
- Now I'm reverting to pre-gridOnlyOverview implementation of having taskSize as both large tile size and carousel task size, and gridTaskSize as only task size in grid

TaskViewSimualtor
- Removed no longer needed carousel translation and related calculations
- mIsGridTask is now determined with DeviceProfile, so when swipeing to Desktop task it won't use grid task size

TaskView
- Removed no longer used nonGridPivotTranslationX

RecentsView
- Make getSelectedTaskBounds / getTaskBounds picks the correct taskSize

Fix: 359573248
Fix: 321697299
Fix: 325606690
Bug: 322816508
Test: Swipe up, quick switch, task launching with grid task and desktop tasks; repeat with RTL, three button, phone
Flag: com.android.launcher3.enable_grid_only_overview
Change-Id: I14648c6682c53a4d06f9c9585d53f28dddef4f8f
This commit is contained in:
Alex Chau
2025-01-06 21:15:12 +00:00
parent a2857a9940
commit 9c85596111
14 changed files with 62 additions and 236 deletions
@@ -27,12 +27,6 @@
<dimen name="gesture_tutorial_menu_done_button_top_spacing">40dp</dimen>
<dimen name="gesture_tutorial_menu_back_shape_bottom_margin">49dp</dimen>
<!-- Grid Only Overview -->
<!-- The top margin above the top row of tasks in grid only overview -->
<dimen name="overview_top_margin_grid_only">24dp</dimen>
<!-- The bottom margin above the bottom row of tasks in grid only overview -->
<dimen name="overview_bottom_margin_grid_only">40dp</dimen>
<dimen name="taskbar_suw_insets">24dp</dimen>
</resources>
-4
View File
@@ -33,10 +33,6 @@
<dimen name="overview_page_spacing">36dp</dimen>
<!-- The space to the left and to the right of the "Clear all" button -->
<dimen name="overview_grid_side_margin">64dp</dimen>
<!-- The top margin above the top row of tasks in grid only overview -->
<dimen name="overview_top_margin_grid_only">80dp</dimen>
<!-- The bottom margin above the bottom row of tasks in grid only overview -->
<dimen name="overview_bottom_margin_grid_only">80dp</dimen>
<!-- Overview actions -->
<dimen name="overview_actions_top_margin">24dp</dimen>
-3
View File
@@ -34,9 +34,6 @@
<!-- Overview Task Views -->
<!-- The thumbnail uses up to this much of the total screen height/width in Overview -->
<item name="overview_max_scale" format="float" type="dimen">0.7</item>
<!-- The thumbnail should not go smaller than this much of the total screen height/width in
tablet app to Overview carousel -->
<item name="overview_carousel_min_scale" format="float" type="dimen">0.46</item>
<!-- A touch target for icons, sometimes slightly larger than the icons themselves -->
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<!-- The icon size for the focused task, placed in center of touch target -->
@@ -31,7 +31,6 @@ import static com.android.launcher3.BaseActivity.EVENT_STARTED;
import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.Flags.enableAdditionalHomeAnimations;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.launcher3.Flags.enableScalingRevealHomeAnimation;
import static com.android.launcher3.Flags.msdlFeedback;
import static com.android.launcher3.PagedView.INVALID_PAGE;
@@ -173,6 +172,8 @@ import com.android.wm.shell.shared.startingsurface.SplashScreenExitAnimationUtil
import com.google.android.msdl.data.model.MSDLToken;
import kotlin.Unit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -182,8 +183,6 @@ import java.util.Optional;
import java.util.OptionalInt;
import java.util.function.Consumer;
import kotlin.Unit;
/**
* Handles the navigation gestures when Launcher is the default home activity.
*/
@@ -2688,9 +2687,7 @@ public abstract class AbsSwipeUpHandler<
}
float scrollOffset = Math.abs(mRecentsView.getScrollOffset(mRecentsView.getCurrentPage()));
Rect carouselTaskSize = enableGridOnlyOverview()
? mRecentsView.getLastComputedCarouselTaskSize()
: mRecentsView.getLastComputedTaskSize();
Rect carouselTaskSize = mRecentsView.getLastComputedTaskSize();
int maxScrollOffset = mRecentsView.getPagedOrientationHandler().getPrimaryValue(
carouselTaskSize.width(), carouselTaskSize.height());
maxScrollOffset += mRecentsView.getPageSpacing();
@@ -251,11 +251,7 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect,
RecentsPagedOrientationHandler orientationHandler) {
if (dp.isTablet) {
if (Flags.enableGridOnlyOverview()) {
calculateGridTaskSize(context, dp, outRect, orientationHandler);
} else {
calculateFocusTaskSize(context, dp, outRect);
}
calculateLargeTileSize(context, dp, outRect);
} else {
Resources res = context.getResources();
float maxScale = res.getFloat(R.dimen.overview_max_scale);
@@ -276,24 +272,7 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
}
}
/**
* Calculates the taskView size for carousel during app to overview animation on tablets.
*/
public final void calculateCarouselTaskSize(Context context, DeviceProfile dp, Rect outRect,
RecentsPagedOrientationHandler orientationHandler) {
if (dp.isTablet && dp.isGestureMode) {
Resources res = context.getResources();
float minScale = res.getFloat(R.dimen.overview_carousel_min_scale);
Rect gridRect = new Rect();
calculateGridSize(dp, context, gridRect);
calculateTaskSizeInternal(context, dp, gridRect, minScale, Gravity.CENTER | Gravity.TOP,
outRect);
} else {
calculateTaskSize(context, dp, outRect, orientationHandler);
}
}
private void calculateFocusTaskSize(Context context, DeviceProfile dp, Rect outRect) {
private void calculateLargeTileSize(Context context, DeviceProfile dp, Rect outRect) {
Resources res = context.getResources();
float maxScale = res.getFloat(R.dimen.overview_max_scale);
Rect gridRect = new Rect();
@@ -381,12 +360,6 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
Rect insets = dp.getInsets();
int topMargin = dp.overviewTaskThumbnailTopMarginPx;
int bottomMargin = dp.getOverviewActionsClaimedSpace();
if (dp.isTaskbarPresent && Flags.enableGridOnlyOverview()) {
topMargin += context.getResources().getDimensionPixelSize(
R.dimen.overview_top_margin_grid_only);
bottomMargin += context.getResources().getDimensionPixelSize(
R.dimen.overview_bottom_margin_grid_only);
}
int sideMargin = dp.overviewGridSideMargin;
outRect.set(0, 0, dp.widthPx, dp.heightPx);
@@ -401,11 +374,7 @@ public abstract class BaseContainerInterface<STATE_TYPE extends BaseState<STATE_
RecentsPagedOrientationHandler orientationHandler) {
Resources res = context.getResources();
Rect potentialTaskRect = new Rect();
if (Flags.enableGridOnlyOverview()) {
calculateGridSize(dp, context, potentialTaskRect);
} else {
calculateFocusTaskSize(context, dp, potentialTaskRect);
}
calculateLargeTileSize(context, dp, potentialTaskRect);
float rowHeight = (potentialTaskRect.height() + dp.overviewTaskThumbnailTopMarginPx
- dp.overviewRowSpacing) / 2f;
@@ -112,7 +112,7 @@ public abstract class SwipeUpAnimationLogic implements
PendingAnimation pendingAnimation = new PendingAnimation(mTransitionDragLength * 2);
TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator();
taskViewSimulator.setDp(dp);
taskViewSimulator.addAppToOverviewAnim(pendingAnimation, LINEAR);
taskViewSimulator.addAppToCarouselAnim(pendingAnimation, LINEAR);
AnimatorPlaybackController playbackController =
pendingAnimation.createPlaybackController();
@@ -22,6 +22,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.app.animation.Interpolators.TOUCH_RESPONSE;
import static com.android.app.animation.Interpolators.clampToProgress;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
@@ -232,7 +233,9 @@ public final class TaskViewUtils {
tvsLocal.fullScreenProgress.value = 0;
tvsLocal.recentsViewScale.value = 1;
tvsLocal.setIsGridTask(v.isGridTask());
if (!enableGridOnlyOverview()) {
tvsLocal.setIsGridTask(v.isGridTask());
}
tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal,
TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary,
taskRectTranslationSecondary);
@@ -17,7 +17,6 @@ package com.android.quickstep.util;
import static com.android.app.animation.Interpolators.DECELERATE;
import static com.android.app.animation.Interpolators.LINEAR;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.quickstep.views.RecentsView.RECENTS_SCALE_PROPERTY;
import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION;
@@ -50,7 +49,6 @@ public class AnimatorControllerWithResistance {
private enum RecentsResistanceParams {
FROM_APP(0.75f, 0.5f, 1f, false),
FROM_APP_TABLET(1f, 0.7f, 1f, true),
FROM_APP_TABLET_GRID_ONLY(1f, 1f, 1f, true),
FROM_OVERVIEW(1f, 0.75f, 0.5f, false);
RecentsResistanceParams(float scaleStartResist, float scaleMaxResist,
@@ -259,9 +257,7 @@ public class AnimatorControllerWithResistance {
this.translationTarget = translationTarget;
this.translationProperty = translationProperty;
if (dp.isTablet) {
resistanceParams = enableGridOnlyOverview()
? RecentsResistanceParams.FROM_APP_TABLET_GRID_ONLY
: RecentsResistanceParams.FROM_APP_TABLET;
resistanceParams = RecentsResistanceParams.FROM_APP_TABLET;
} else {
resistanceParams = RecentsResistanceParams.FROM_APP;
}
@@ -41,7 +41,6 @@ import android.view.animation.Interpolator;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.app.animation.Interpolators;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatedFloat;
@@ -101,8 +100,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
// Carousel properties
public final AnimatedFloat carouselScale = new AnimatedFloat();
public final AnimatedFloat carouselPrimaryTranslation = new AnimatedFloat();
public final AnimatedFloat carouselSecondaryTranslation = new AnimatedFloat();
// RecentsView properties
public final AnimatedFloat recentsViewScale = new AnimatedFloat();
@@ -118,7 +115,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
private Boolean mDrawsBelowRecents = null;
private boolean mIsGridTask;
private final boolean mIsDesktopTask;
private boolean mScaleToCarouselTaskSize = false;
private boolean mIsAnimatingToCarousel = false;
private int mTaskRectTranslationX;
private int mTaskRectTranslationY;
private int mDesktopTaskIndex = 0;
@@ -149,6 +146,9 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
mDp = dp;
mLayoutValid = false;
mOrientationState.setDeviceProfile(dp);
if (enableGridOnlyOverview()) {
mIsGridTask = dp.isTablet && !mIsDesktopTask;
}
calculateTaskSize();
}
@@ -160,14 +160,16 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
if (mIsGridTask) {
mSizeStrategy.calculateGridTaskSize(mContext, mDp, mFullTaskSize,
mOrientationState.getOrientationHandler());
if (enableGridOnlyOverview()) {
mSizeStrategy.calculateTaskSize(mContext, mDp, mCarouselTaskSize,
mOrientationState.getOrientationHandler());
}
} else {
mSizeStrategy.calculateTaskSize(mContext, mDp, mFullTaskSize,
mOrientationState.getOrientationHandler());
}
if (enableGridOnlyOverview()) {
mSizeStrategy.calculateCarouselTaskSize(mContext, mDp, mCarouselTaskSize,
mOrientationState.getOrientationHandler());
if (enableGridOnlyOverview()) {
mCarouselTaskSize.set(mFullTaskSize);
}
}
if (mSplitBounds != null) {
@@ -222,12 +224,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
}
// Copy mFullTaskSize instead of updating it directly so it could be reused next time
// without recalculating
Rect scaleRect = new Rect();
if (mScaleToCarouselTaskSize) {
scaleRect.set(mCarouselTaskSize);
} else {
scaleRect.set(mFullTaskSize);
}
Rect scaleRect = new Rect(mIsAnimatingToCarousel ? mCarouselTaskSize : mFullTaskSize);
scaleRect.offset(mTaskRectTranslationX, mTaskRectTranslationY);
float scale = mOrientationState.getFullScreenScaleAndPivot(scaleRect, mDp, mPivot);
if (mPivotOverride != null) {
@@ -313,66 +310,16 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
}
/**
* Adds animation for all the components corresponding to transition from an app to overview.
* Adds animation for all the components corresponding to transition from an app to carousel.
*/
public void addAppToOverviewAnim(PendingAnimation pa, Interpolator interpolator) {
public void addAppToCarouselAnim(PendingAnimation pa, Interpolator interpolator) {
pa.addFloat(fullScreenProgress, AnimatedFloat.VALUE, 1, 0, interpolator);
float fullScreenScale;
if (enableGridOnlyOverview() && mDp.isTablet && mDp.isGestureMode) {
// Move pivot to top right edge of the screen, to avoid task scaling down in opposite
// direction of app window movement, otherwise the animation will wiggle left and right.
// Also translate the app window to top right edge of the screen to simplify
// calculations.
taskPrimaryTranslation.value = mIsRecentsRtl
? mDp.widthPx - mFullTaskSize.right
: -mFullTaskSize.left;
taskSecondaryTranslation.value = -mFullTaskSize.top;
mPivotOverride = new PointF(mIsRecentsRtl ? mDp.widthPx : 0, 0);
// Scale down to the carousel and use the carousel Rect to calculate fullScreenScale.
mScaleToCarouselTaskSize = true;
mIsAnimatingToCarousel = true;
carouselScale.value = mCarouselTaskSize.width() / (float) mFullTaskSize.width();
fullScreenScale = getFullScreenScale();
float carouselPrimaryTranslationTarget = mIsRecentsRtl
? mCarouselTaskSize.right - mDp.widthPx
: mCarouselTaskSize.left;
float carouselSecondaryTranslationTarget = mCarouselTaskSize.top;
// Expected carousel position's center is in the middle, and invariant of
// recentsViewScale.
float exceptedCarouselCenterX = mCarouselTaskSize.centerX();
// Animating carousel translations linearly will result in a curved path, therefore
// we'll need to calculate the expected translation at each recentsView scale. Luckily
// primary and secondary follow the same translation, and primary is used here due to
// it being simpler.
Interpolator carouselTranslationInterpolator = t -> {
// recentsViewScale is calculated rather than using recentsViewScale.value, so that
// this interpolator works independently even if recentsViewScale don't animate.
float recentsViewScale =
Utilities.mapToRange(t, 0, 1, fullScreenScale, 1, Interpolators.LINEAR);
// Without the translation, the app window will animate from fullscreen into top
// right corner.
float expectedTaskCenterX = mIsRecentsRtl
? mDp.widthPx - mCarouselTaskSize.width() * recentsViewScale / 2f
: mCarouselTaskSize.width() * recentsViewScale / 2f;
// Calculate the expected translation, then work back the animatedFraction that
// results in this value.
float carouselPrimaryTranslation =
(exceptedCarouselCenterX - expectedTaskCenterX) / recentsViewScale;
return carouselPrimaryTranslation / carouselPrimaryTranslationTarget;
};
// Use addAnimatedFloat so this animation can later be canceled and animate to a
// different value in RecentsView.onPrepareGestureEndAnimation.
pa.addAnimatedFloat(carouselPrimaryTranslation, 0, carouselPrimaryTranslationTarget,
carouselTranslationInterpolator);
pa.addAnimatedFloat(carouselSecondaryTranslation, 0, carouselSecondaryTranslationTarget,
carouselTranslationInterpolator);
} else {
fullScreenScale = getFullScreenScale();
}
pa.addFloat(recentsViewScale, AnimatedFloat.VALUE, fullScreenScale, 1, interpolator);
pa.addFloat(recentsViewScale, AnimatedFloat.VALUE, getFullScreenScale(), 1,
interpolator);
}
/**
@@ -484,11 +431,9 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
taskSecondaryTranslation.value);
mMatrix.postScale(carouselScale.value, carouselScale.value, mPivot.x, mPivot.y);
mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
carouselPrimaryTranslation.value);
mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
carouselSecondaryTranslation.value);
mMatrix.postScale(carouselScale.value, carouselScale.value,
mIsRecentsRtl ? mCarouselTaskSize.right : mCarouselTaskSize.left,
mCarouselTaskSize.top);
mOrientationState.getOrientationHandler().setPrimary(
mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
@@ -524,8 +469,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
+ " taskRect: " + mTaskRect
+ " taskPrimaryT: " + taskPrimaryTranslation.value
+ " taskSecondaryT: " + taskSecondaryTranslation.value
+ " carouselPrimaryT: " + carouselPrimaryTranslation.value
+ " carouselSecondaryT: " + carouselSecondaryTranslation.value
+ " recentsPrimaryT: " + recentsViewPrimaryTranslation.value
+ " recentsSecondaryT: " + recentsViewSecondaryTranslation.value
+ " recentsScroll: " + recentsViewScroll.value
@@ -16,7 +16,6 @@
package com.android.quickstep.views;
import static com.android.launcher3.Flags.enableGridOnlyOverview;
import static com.android.quickstep.util.BorderAnimator.DEFAULT_BORDER_COLOR;
import android.content.Context;
@@ -331,13 +330,7 @@ public class ClearAllButton extends Button {
private float getOriginalTranslationY() {
DeviceProfile deviceProfile = mContainer.getDeviceProfile();
if (deviceProfile.isTablet) {
if (enableGridOnlyOverview()) {
return (getRecentsView().getLastComputedTaskSize().height()
+ deviceProfile.overviewTaskThumbnailTopMarginPx) / 2.0f
+ deviceProfile.overviewRowSpacing;
} else {
return deviceProfile.overviewRowSpacing;
}
return deviceProfile.overviewRowSpacing;
}
return deviceProfile.overviewTaskThumbnailTopMarginPx / 2.0f;
}
@@ -174,16 +174,8 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
}
@SuppressLint("RtlHardcoded")
override fun updateTaskSize(
lastComputedTaskSize: Rect,
lastComputedGridTaskSize: Rect,
lastComputedCarouselTaskSize: Rect,
) {
super.updateTaskSize(
lastComputedTaskSize,
lastComputedGridTaskSize,
lastComputedCarouselTaskSize,
)
override fun updateTaskSize(lastComputedTaskSize: Rect, lastComputedGridTaskSize: Rect) {
super.updateTaskSize(lastComputedTaskSize, lastComputedGridTaskSize)
if (taskContainers.isEmpty()) {
return
}
@@ -521,7 +521,6 @@ public abstract class RecentsView<
@Nullable
protected RemoteTargetHandle[] mRemoteTargetHandles;
protected final Rect mLastComputedCarouselTaskSize = new Rect();
protected final Rect mLastComputedTaskSize = new Rect();
protected final Rect mLastComputedGridSize = new Rect();
protected final Rect mLastComputedGridTaskSize = new Rect();
@@ -2279,11 +2278,6 @@ public abstract class RecentsView<
mSizeStrategy.calculateGridTaskSize(mContainer, dp, mLastComputedGridTaskSize,
getPagedOrientationHandler());
if (enableGridOnlyOverview()) {
mSizeStrategy.calculateCarouselTaskSize(mContainer, dp, mLastComputedCarouselTaskSize,
getPagedOrientationHandler());
}
mTaskGridVerticalDiff = mLastComputedGridTaskSize.top - mLastComputedTaskSize.top;
mTopBottomRowHeightDiff =
mLastComputedGridTaskSize.height() + dp.overviewTaskThumbnailTopMarginPx
@@ -2303,17 +2297,9 @@ public abstract class RecentsView<
}
float accumulatedTranslationX = 0;
float translateXToMiddle = 0;
if (enableGridOnlyOverview() && mContainer.getDeviceProfile().isTablet) {
translateXToMiddle = mIsRtl
? mLastComputedCarouselTaskSize.right - mLastComputedTaskSize.right
: mLastComputedCarouselTaskSize.left - mLastComputedTaskSize.left;
}
for (TaskView taskView : getTaskViews()) {
taskView.updateTaskSize(mLastComputedTaskSize, mLastComputedGridTaskSize,
mLastComputedCarouselTaskSize);
taskView.updateTaskSize(mLastComputedTaskSize, mLastComputedGridTaskSize);
taskView.setNonGridTranslationX(accumulatedTranslationX);
taskView.setNonGridPivotTranslationX(translateXToMiddle);
// Compensate space caused by TaskView scaling.
float widthDiff =
taskView.getLayoutParams().width * (1 - taskView.getNonGridScale());
@@ -2342,7 +2328,8 @@ public abstract class RecentsView<
*/
public Rect getSelectedTaskBounds() {
if (mSelectedTask == null) {
return mLastComputedTaskSize;
return enableGridOnlyOverview() && mContainer.getDeviceProfile().isTablet
? mLastComputedGridTaskSize : mLastComputedTaskSize;
}
return getTaskBounds(mSelectedTask);
}
@@ -2351,8 +2338,9 @@ public abstract class RecentsView<
int selectedPage = indexOfChild(taskView);
int primaryScroll = getPagedOrientationHandler().getPrimaryScroll(this);
int selectedPageScroll = getScrollForPage(selectedPage);
boolean isTopRow = taskView != null && mTopRowIdSet.contains(taskView.getTaskViewId());
Rect outRect = new Rect(mLastComputedTaskSize);
boolean isTopRow = mTopRowIdSet.contains(taskView.getTaskViewId());
Rect outRect = new Rect(
taskView.isGridTask() ? mLastComputedGridTaskSize : mLastComputedTaskSize);
outRect.offset(
-(primaryScroll - (selectedPageScroll + getOffsetFromScrollPosition(selectedPage))),
(int) (showAsGrid() && enableGridOnlyOverview() && !isTopRow
@@ -2369,10 +2357,6 @@ public abstract class RecentsView<
return mLastComputedGridTaskSize;
}
public Rect getLastComputedCarouselTaskSize() {
return mLastComputedCarouselTaskSize;
}
/** Gets the task size for modal state. */
public void getModalTaskSize(Rect outRect) {
mSizeStrategy.calculateModalTaskSize(mContainer, mContainer.getDeviceProfile(), outRect,
@@ -2899,8 +2883,6 @@ public abstract class RecentsView<
} else {
animatorSet.play(ObjectAnimator.ofFloat(this, RECENTS_GRID_PROGRESS, 1));
animatorSet.play(tvs.carouselScale.animateToValue(1));
animatorSet.play(tvs.carouselPrimaryTranslation.animateToValue(0));
animatorSet.play(tvs.carouselSecondaryTranslation.animateToValue(0));
animatorSet.play(tvs.taskPrimaryTranslation.animateToValue(
runningTaskPrimaryGridTranslation));
animatorSet.play(tvs.taskSecondaryTranslation.animateToValue(
@@ -4798,14 +4780,7 @@ public abstract class RecentsView<
mTempPointF.set(mLastComputedTaskSize.centerX(), mLastComputedTaskSize.bottom);
}
} else {
// 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() && mContainer.getDeviceProfile().isTablet
&& !mOverviewGridEnabled) {
mTempRect.set(mLastComputedCarouselTaskSize);
} else {
mTempRect.set(mLastComputedTaskSize);
}
mTempRect.set(mLastComputedTaskSize);
getPagedViewOrientedState().getFullScreenScaleAndPivot(mTempRect,
mContainer.getDeviceProfile(), mTempPointF);
}
@@ -4916,10 +4891,12 @@ public abstract class RecentsView<
&& child instanceof DesktopTaskView;
float totalTranslationX = (skipTranslationOffset ? 0f : translation) + modalTranslation
+ carouselHiddenOffsetSize;
FloatProperty translationPropertyX = child instanceof TaskView
? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
: getPagedOrientationHandler().getPrimaryViewTranslate();
translationPropertyX.set(child, totalTranslationX);
if (child instanceof TaskView taskView) {
taskView.getPrimaryTaskOffsetTranslationProperty().set(taskView, totalTranslationX);
} else {
getPagedOrientationHandler().getPrimaryViewTranslate().set(child,
totalTranslationX);
}
if (mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
runActionOnRemoteHandles(
remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator()
@@ -4927,11 +4904,11 @@ public abstract class RecentsView<
redrawLiveTile();
}
if (showAsGrid && enableGridOnlyOverview() && child instanceof TaskView) {
float totalTranslationY = getVerticalOffsetSize(i, modalOffset);
FloatProperty translationPropertyY =
((TaskView) child).getSecondaryTaskOffsetTranslationProperty();
translationPropertyY.set(child, totalTranslationY);
if (showAsGrid && enableGridOnlyOverview() && child instanceof TaskView taskView) {
float totalTranslationY = getVerticalOffsetSize(taskView, modalOffset);
FloatProperty<TaskView> translationPropertyY =
taskView.getSecondaryTaskOffsetTranslationProperty();
translationPropertyY.set(taskView, totalTranslationY);
}
}
updateCurveProperties();
@@ -5047,7 +5024,7 @@ public abstract class RecentsView<
*
* @param offsetProgress From 0 to 1 where 0 means no offset and 1 means offset offscreen.
*/
private float getVerticalOffsetSize(int childIndex, float offsetProgress) {
private float getVerticalOffsetSize(TaskView taskView, float offsetProgress) {
if (offsetProgress == 0 || !(showAsGrid() && enableGridOnlyOverview())
|| mSelectedTask == null) {
// Don't bother calculating everything below if we won't offset vertically.
@@ -5055,11 +5032,10 @@ public abstract class RecentsView<
}
// First, get the position of the task relative to the top row.
TaskView child = getTaskViewAt(childIndex);
Rect taskPosition = getTaskBounds(child);
Rect taskPosition = getTaskBounds(taskView);
boolean isSelectedTaskTopRow = mTopRowIdSet.contains(mSelectedTask.getTaskViewId());
boolean isChildTopRow = mTopRowIdSet.contains(child.getTaskViewId());
boolean isChildTopRow = mTopRowIdSet.contains(taskView.getTaskViewId());
// Whether the task should be shifted to the top.
boolean isTopShift = !isSelectedTaskTopRow && isChildTopRow;
boolean isBottomShift = isSelectedTaskTopRow && !isChildTopRow;
@@ -5656,19 +5632,10 @@ public abstract class RecentsView<
* Returns the scale up required on the view, so that it coves the screen completely
*/
public float getMaxScaleForFullScreen() {
if (enableGridOnlyOverview() && mContainer.getDeviceProfile().isTablet
&& !mOverviewGridEnabled) {
if (mLastComputedCarouselTaskSize.isEmpty()) {
mSizeStrategy.calculateCarouselTaskSize(mContainer, mContainer.getDeviceProfile(),
mLastComputedCarouselTaskSize, getPagedOrientationHandler());
}
mTempRect.set(mLastComputedCarouselTaskSize);
} else {
if (mLastComputedTaskSize.isEmpty()) {
getTaskSize(mLastComputedTaskSize);
}
mTempRect.set(mLastComputedTaskSize);
if (mLastComputedTaskSize.isEmpty()) {
getTaskSize(mLastComputedTaskSize);
}
mTempRect.set(mLastComputedTaskSize);
return getPagedViewOrientedState().getFullScreenScaleAndPivot(
mTempRect, mContainer.getDeviceProfile(), mTempPointF);
}
@@ -165,10 +165,7 @@ constructor(
* Returns addition of translationX that is persistent (e.g. fullscreen and grid), and does
* not change according to a temporary state (e.g. task offset).
*/
get() =
(getNonGridTrans(nonGridTranslationX) +
getGridTrans(this.gridTranslationX) +
getNonGridTrans(nonGridPivotTranslationX))
get() = (getNonGridTrans(nonGridTranslationX) + getGridTrans(this.gridTranslationX))
protected val persistentTranslationY: Float
/**
@@ -352,12 +349,6 @@ constructor(
applyTranslationX()
}
protected var nonGridPivotTranslationX = 0f
set(value) {
field = value
applyTranslationX()
}
// Used when in SplitScreenSelectState
private var splitSelectTranslationY = 0f
set(value) {
@@ -797,11 +788,7 @@ constructor(
* Updates TaskView scaling and translation required to support variable width if enabled, while
* ensuring TaskView fits into screen in fullscreen.
*/
open fun updateTaskSize(
lastComputedTaskSize: Rect,
lastComputedGridTaskSize: Rect,
lastComputedCarouselTaskSize: Rect,
) {
open fun updateTaskSize(lastComputedTaskSize: Rect, lastComputedGridTaskSize: Rect) {
val thumbnailPadding = container.deviceProfile.overviewTaskThumbnailTopMarginPx
val taskWidth = lastComputedTaskSize.width()
val taskHeight = lastComputedTaskSize.height()
@@ -829,12 +816,7 @@ constructor(
expectedHeight = boxHeight + thumbnailPadding
// Scale to to fit task Rect.
nonGridScale =
if (enableGridOnlyOverview()) {
lastComputedCarouselTaskSize.width() / taskWidth.toFloat()
} else {
taskWidth / boxWidth.toFloat()
}
nonGridScale = taskWidth / boxWidth.toFloat()
// Align to top of task Rect.
boxTranslationY = (expectedHeight - thumbnailPadding - taskHeight) / 2.0f
@@ -1587,7 +1569,6 @@ constructor(
gridTranslationX = 0f
gridTranslationY = 0f
boxTranslationY = 0f
nonGridPivotTranslationX = 0f
taskContainers.forEach {
it.snapshotView.translationX = 0f
it.snapshotView.translationY = 0f
-2
View File
@@ -488,8 +488,6 @@
<dimen name="overview_grid_side_margin">0dp</dimen>
<dimen name="overview_grid_row_spacing">0dp</dimen>
<dimen name="overview_page_spacing">0dp</dimen>
<dimen name="overview_top_margin_grid_only">0dp</dimen>
<dimen name="overview_bottom_margin_grid_only">0dp</dimen>
<dimen name="split_placeholder_size">72dp</dimen>
<dimen name="split_placeholder_inset">16dp</dimen>