Update scale on TaskView instead for select mode
- Avoid zooming in RecentsView in Select mode, instead zoom in the selected TaskView only to avoid changing RecentsView's scale and pivot, otherwise when doing home gesture in Select mode RecentseView zoom will be distorted - Set taskModalness on all TaskViews, so they can fade out while entering Select mode, this avoid janky transitionig of non-selected TaskView appearing during hoem gesture - Keep overviewGridEnabled true until transitioning out of a RecentsView visible state, so showAsGrid() remains true and the Overview grid won't deform midway through animating - When leaving Select mode to RecentsView invisible state (e.g. Home), leave taskModalness 1 until the last frame so selected TaskView remains zoomed in until RecentsView is invisible Fix: 322818393 Test: OverviewTaskSelectImageTest Test: Repeat with combination of default/fallback, live/static tile, handheld/tablet 1) Swipe up from Overview 2) Swipe up from Select to go Home 3) Backc/cross button to exit Select to Overview Flag: com.android.launcher3.enable_grid_only_overview Change-Id: I8fec62315cbd404502852654772edb1d695f1ec6
This commit is contained in:
@@ -275,7 +275,7 @@ public abstract class RecentsView<
|
||||
HighResLoadingState.HighResLoadingStateChangedCallback,
|
||||
TaskVisualsChangeListener, DesktopVisibilityListener {
|
||||
|
||||
private static final String TAG = "RecentsView";
|
||||
protected static final String TAG = "RecentsView";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
public static final FloatProperty<RecentsView<?, ?>> CONTENT_ALPHA =
|
||||
@@ -534,7 +534,6 @@ public abstract class RecentsView<
|
||||
protected final Rect mLastComputedTaskSize = new Rect();
|
||||
protected final Rect mLastComputedGridSize = new Rect();
|
||||
protected final Rect mLastComputedGridTaskSize = new Rect();
|
||||
private TaskView mSelectedTask = null;
|
||||
// How much a task that is directly offscreen will be pushed out due to RecentsView scale/pivot.
|
||||
@Nullable
|
||||
protected Float mLastComputedTaskStartPushOutDistance = null;
|
||||
@@ -2418,21 +2417,28 @@ public abstract class RecentsView<
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the last TaskView selected.
|
||||
* Returns the currently selected TaskView in Select mode.
|
||||
*/
|
||||
@Nullable
|
||||
public TaskView getSelectedTaskView() {
|
||||
return mUtils.getSelectedTaskView();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected TaskView in Select mode.
|
||||
*/
|
||||
public void setSelectedTask(int lastSelectedTaskId) {
|
||||
mSelectedTask = getTaskViewByTaskId(lastSelectedTaskId);
|
||||
mUtils.setSelectedTaskView(getTaskViewByTaskId(lastSelectedTaskId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of the task selected to enter modal state.
|
||||
*/
|
||||
public Rect getSelectedTaskBounds() {
|
||||
if (mSelectedTask == null) {
|
||||
return enableGridOnlyOverview() && mContainer.getDeviceProfile().isTablet
|
||||
? mLastComputedGridTaskSize : mLastComputedTaskSize;
|
||||
if (getSelectedTaskView() == null) {
|
||||
return mLastComputedTaskSize;
|
||||
}
|
||||
return getTaskBounds(mSelectedTask);
|
||||
return getTaskBounds(getSelectedTaskView());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2448,7 +2454,7 @@ public abstract class RecentsView<
|
||||
return deviceProfile.overviewTaskThumbnailTopMarginPx / 2.0f;
|
||||
}
|
||||
|
||||
private Rect getTaskBounds(TaskView taskView) {
|
||||
protected Rect getTaskBounds(TaskView taskView) {
|
||||
int selectedPage = indexOfChild(taskView);
|
||||
int primaryScroll = getPagedOrientationHandler().getPrimaryScroll(this);
|
||||
int selectedPageScroll = getScrollForPage(selectedPage);
|
||||
@@ -5011,15 +5017,8 @@ public abstract class RecentsView<
|
||||
}
|
||||
|
||||
private void updatePivots() {
|
||||
if (mOverviewSelectEnabled) {
|
||||
if (enableGridOnlyOverview()) {
|
||||
getModalTaskSize(mTempRect);
|
||||
Rect selectedTaskPosition = getSelectedTaskBounds();
|
||||
Utilities.getPivotsForScalingRectToRect(mTempRect, selectedTaskPosition,
|
||||
mTempPointF);
|
||||
} else {
|
||||
mTempPointF.set(mLastComputedTaskSize.centerX(), mLastComputedTaskSize.bottom);
|
||||
}
|
||||
if (mOverviewSelectEnabled && !enableGridOnlyOverview()) {
|
||||
mTempPointF.set(mLastComputedTaskSize.centerX(), mLastComputedTaskSize.bottom);
|
||||
} else {
|
||||
mTempRect.set(mLastComputedTaskSize);
|
||||
getPagedViewOrientedState().getFullScreenScaleAndPivot(mTempRect,
|
||||
@@ -5065,7 +5064,7 @@ public abstract class RecentsView<
|
||||
&& (enableGridOnlyOverview() || enableLargeDesktopWindowingTile())
|
||||
&& mTaskModalness > 0;
|
||||
if (shouldCalculateOffsetForAllTasks) {
|
||||
modalMidpoint = indexOfChild(mSelectedTask);
|
||||
modalMidpoint = indexOfChild(getSelectedTaskView());
|
||||
}
|
||||
|
||||
float midpointOffsetSize = 0;
|
||||
@@ -5273,7 +5272,7 @@ public abstract class RecentsView<
|
||||
*/
|
||||
private float getVerticalOffsetSize(TaskView taskView, float offsetProgress) {
|
||||
if (offsetProgress == 0 || !(showAsGrid() && enableGridOnlyOverview())
|
||||
|| mSelectedTask == null) {
|
||||
|| getSelectedTaskView() == null) {
|
||||
// Don't bother calculating everything below if we won't offset vertically.
|
||||
return 0;
|
||||
}
|
||||
@@ -5281,7 +5280,7 @@ public abstract class RecentsView<
|
||||
// First, get the position of the task relative to the top row.
|
||||
Rect taskPosition = getTaskBounds(taskView);
|
||||
|
||||
boolean isSelectedTaskTopRow = mTopRowIdSet.contains(mSelectedTask.getTaskViewId());
|
||||
boolean isSelectedTaskTopRow = mTopRowIdSet.contains(getSelectedTaskView().getTaskViewId());
|
||||
boolean isChildTopRow = mTopRowIdSet.contains(taskView.getTaskViewId());
|
||||
// Whether the task should be shifted to the top.
|
||||
boolean isTopShift = !isSelectedTaskTopRow && isChildTopRow;
|
||||
@@ -5335,8 +5334,8 @@ public abstract class RecentsView<
|
||||
* Resets the visuals when exit modal state.
|
||||
*/
|
||||
public void resetModalVisuals() {
|
||||
if (mSelectedTask != null) {
|
||||
mSelectedTask.taskContainers.forEach(
|
||||
if (getSelectedTaskView() != null) {
|
||||
getSelectedTaskView().taskContainers.forEach(
|
||||
taskContainer -> taskContainer.getOverlay().resetModalVisuals());
|
||||
}
|
||||
}
|
||||
@@ -6717,8 +6716,14 @@ public abstract class RecentsView<
|
||||
private void setTaskModalness(float modalness) {
|
||||
mTaskModalness = modalness;
|
||||
updatePageOffsets();
|
||||
if (mSelectedTask != null) {
|
||||
mSelectedTask.setModalness(modalness);
|
||||
if (getSelectedTaskView() != null) {
|
||||
if (enableGridOnlyOverview()) {
|
||||
for (TaskView taskView : getTaskViews()) {
|
||||
taskView.setModalness(modalness);
|
||||
}
|
||||
} else {
|
||||
getSelectedTaskView().setModalness(modalness);
|
||||
}
|
||||
} else if (getCurrentPageTaskView() != null) {
|
||||
getCurrentPageTaskView().setModalness(modalness);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user