Merge "Handle swipe up after quick switch in overview grid" into sc-dev am: d2ec22c3f6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14130325 Change-Id: I7d90df479174f7bc182a109112d6bae4f7bed654
This commit is contained in:
@@ -966,6 +966,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
if (mRecentsView != null) {
|
if (mRecentsView != null) {
|
||||||
int nearestPage = mRecentsView.getDestinationPage();
|
int nearestPage = mRecentsView.getDestinationPage();
|
||||||
boolean isScrolling = false;
|
boolean isScrolling = false;
|
||||||
|
// Update page scroll before snapping to page to make sure we snapped to the
|
||||||
|
// position calculated with target gesture in mind.
|
||||||
|
mRecentsView.updateScrollSynchronously();
|
||||||
if (mRecentsView.getNextPage() != nearestPage) {
|
if (mRecentsView.getNextPage() != nearestPage) {
|
||||||
// We shouldn't really scroll to the next page when swiping up to recents.
|
// We shouldn't really scroll to the next page when swiping up to recents.
|
||||||
// Only allow settling on the next page if it's nearest to the center.
|
// Only allow settling on the next page if it's nearest to the center.
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package com.android.quickstep.fallback;
|
|||||||
|
|
||||||
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
|
import static com.android.quickstep.GestureState.GestureEndTarget.RECENTS;
|
||||||
import static com.android.quickstep.fallback.RecentsState.DEFAULT;
|
import static com.android.quickstep.fallback.RecentsState.DEFAULT;
|
||||||
|
import static com.android.quickstep.fallback.RecentsState.HOME;
|
||||||
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
@@ -97,6 +98,15 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGestureAnimationEnd() {
|
||||||
|
if (mCurrentGestureEndTarget == GestureState.GestureEndTarget.HOME) {
|
||||||
|
// Clean-up logic that occurs when recents is no longer in use/visible.
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
super.onGestureAnimationEnd();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setCurrentTask(int runningTaskId) {
|
public void setCurrentTask(int runningTaskId) {
|
||||||
super.setCurrentTask(runningTaskId);
|
super.setCurrentTask(runningTaskId);
|
||||||
@@ -155,11 +165,6 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
|||||||
super.setRunningTaskHidden(isHidden);
|
super.setRunningTaskHidden(isHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isHomeTask(TaskView taskView) {
|
|
||||||
return mHomeTaskInfo != null && taskView.hasTaskId(mHomeTaskInfo.taskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setModalStateEnabled(boolean isModalState) {
|
public void setModalStateEnabled(boolean isModalState) {
|
||||||
super.setModalStateEnabled(isModalState);
|
super.setModalStateEnabled(isModalState);
|
||||||
@@ -182,6 +187,10 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStateTransitionComplete(RecentsState finalState) {
|
public void onStateTransitionComplete(RecentsState finalState) {
|
||||||
|
if (finalState == HOME) {
|
||||||
|
// Clean-up logic that occurs when recents is no longer in use/visible.
|
||||||
|
reset();
|
||||||
|
}
|
||||||
setOverlayEnabled(finalState == DEFAULT || finalState == MODAL_TASK);
|
setOverlayEnabled(finalState == DEFAULT || finalState == MODAL_TASK);
|
||||||
setFreezeViewVisibility(false);
|
setFreezeViewVisibility(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class ClearAllButton extends Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRecentsViewScroll(int scrollFromEdge, boolean gridEnabled) {
|
public void onRecentsViewScroll(int scroll, boolean gridEnabled) {
|
||||||
RecentsView recentsView = getRecentsView();
|
RecentsView recentsView = getRecentsView();
|
||||||
if (recentsView == null) {
|
if (recentsView == null) {
|
||||||
return;
|
return;
|
||||||
@@ -109,8 +109,8 @@ public class ClearAllButton extends Button {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int leftEdgeScroll = recentsView.getLeftMostChildScroll();
|
int clearAllScroll = recentsView.getClearAllScroll();
|
||||||
int adjustedScrollFromEdge = scrollFromEdge - leftEdgeScroll;
|
int adjustedScrollFromEdge = Math.abs(scroll - clearAllScroll);
|
||||||
float shift = Math.min(adjustedScrollFromEdge, orientationSize);
|
float shift = Math.min(adjustedScrollFromEdge, orientationSize);
|
||||||
mNormalTranslationPrimary = mIsRtl ? -shift : shift;
|
mNormalTranslationPrimary = mIsRtl ? -shift : shift;
|
||||||
if (!gridEnabled) {
|
if (!gridEnabled) {
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
private float mGridProgress = 0;
|
private float mGridProgress = 0;
|
||||||
|
|
||||||
// The GestureEndTarget that is still in progress.
|
// The GestureEndTarget that is still in progress.
|
||||||
private GestureState.GestureEndTarget mCurrentGestureEndTarget;
|
protected GestureState.GestureEndTarget mCurrentGestureEndTarget;
|
||||||
|
|
||||||
IntSet mTopIdSet = new IntSet();
|
IntSet mTopIdSet = new IntSet();
|
||||||
|
|
||||||
@@ -818,9 +818,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
|
|
||||||
private boolean isTaskViewWithinBounds(TaskView tv, int start, int end) {
|
private boolean isTaskViewWithinBounds(TaskView tv, int start, int end) {
|
||||||
int taskStart = mOrientationHandler.getChildStart(tv) + (int) tv.getOffsetAdjustment(
|
int taskStart = mOrientationHandler.getChildStart(tv) + (int) tv.getOffsetAdjustment(
|
||||||
mOverviewFullscreenEnabled, showAsGrid());
|
showAsFullscreen(), showAsGrid());
|
||||||
int taskSize = (int) (mOrientationHandler.getMeasuredSize(tv) * tv.getSizeAdjustment(
|
int taskSize = (int) (mOrientationHandler.getMeasuredSize(tv) * tv.getSizeAdjustment(
|
||||||
mOverviewFullscreenEnabled));
|
showAsFullscreen()));
|
||||||
int taskEnd = taskStart + taskSize;
|
int taskEnd = taskStart + taskSize;
|
||||||
return (taskStart >= start && taskStart <= end) || (taskEnd >= start
|
return (taskStart >= start && taskStart <= end) || (taskEnd >= start
|
||||||
&& taskEnd <= end);
|
&& taskEnd <= end);
|
||||||
@@ -1194,16 +1194,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
|
|
||||||
float accumulatedTranslationX = 0;
|
float accumulatedTranslationX = 0;
|
||||||
float[] fullscreenTranslations = new float[taskCount];
|
float[] fullscreenTranslations = new float[taskCount];
|
||||||
int firstNonHomeTaskIndex = 0;
|
|
||||||
for (int i = 0; i < taskCount; i++) {
|
for (int i = 0; i < taskCount; i++) {
|
||||||
TaskView taskView = getTaskViewAt(i);
|
TaskView taskView = getTaskViewAt(i);
|
||||||
if (isHomeTask(taskView)) {
|
|
||||||
if (firstNonHomeTaskIndex == i) {
|
|
||||||
firstNonHomeTaskIndex++;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
taskView.updateTaskSize();
|
taskView.updateTaskSize();
|
||||||
fullscreenTranslations[i] += accumulatedTranslationX;
|
fullscreenTranslations[i] += accumulatedTranslationX;
|
||||||
// Compensate space caused by TaskView scaling.
|
// Compensate space caused by TaskView scaling.
|
||||||
@@ -1215,16 +1207,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
accumulatedTranslationX += fullscreenTranslationX;
|
accumulatedTranslationX += fullscreenTranslationX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to maintain first non-home task's full screen translation at 0, now shift
|
for (int i = 0; i < taskCount; i++) {
|
||||||
// translation of all the TaskViews to achieve that.
|
getTaskViewAt(i).setFullscreenTranslationX(fullscreenTranslations[i]);
|
||||||
for (int i = firstNonHomeTaskIndex; i < taskCount; i++) {
|
|
||||||
getTaskViewAt(i).setFullscreenTranslationX(
|
|
||||||
fullscreenTranslations[i] - fullscreenTranslations[firstNonHomeTaskIndex]);
|
|
||||||
}
|
}
|
||||||
mClearAllButton.setFullscreenTranslationPrimary(
|
mClearAllButton.setFullscreenTranslationPrimary(accumulatedTranslationX);
|
||||||
accumulatedTranslationX - fullscreenTranslations[firstNonHomeTaskIndex]);
|
|
||||||
|
|
||||||
updateGridProperties(false);
|
updateGridProperties(/*isTaskDismissal=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getTaskSize(Rect outRect) {
|
public void getTaskSize(Rect outRect) {
|
||||||
@@ -1311,13 +1299,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int scroll = mOrientationHandler.getPrimaryScroll(this);
|
int scroll = mOrientationHandler.getPrimaryScroll(this);
|
||||||
int scrollFromEdge = mIsRtl ? scroll : (mMaxScroll - scroll);
|
mClearAllButton.onRecentsViewScroll(scroll, mOverviewGridEnabled);
|
||||||
mClearAllButton.onRecentsViewScroll(scrollFromEdge, mOverviewGridEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getDestinationPage(int scaledScroll) {
|
protected int getDestinationPage(int scaledScroll) {
|
||||||
if (!showAsGrid()) {
|
if (!(mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get())) {
|
||||||
return super.getDestinationPage(scaledScroll);
|
return super.getDestinationPage(scaledScroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,8 +1313,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When in grid, return the page which scroll is closest to screenStart instead of page
|
// When in tablet with variable task width, return the page which scroll is closest to
|
||||||
// nearest to center of screen.
|
// screenStart instead of page nearest to center of screen.
|
||||||
int minDistanceFromScreenStart = Integer.MAX_VALUE;
|
int minDistanceFromScreenStart = Integer.MAX_VALUE;
|
||||||
int minDistanceFromScreenStartIndex = -1;
|
int minDistanceFromScreenStartIndex = -1;
|
||||||
for (int i = 0; i < childCount; ++i) {
|
for (int i = 0; i < childCount; ++i) {
|
||||||
@@ -1578,10 +1565,12 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
*/
|
*/
|
||||||
public void onGestureEndTargetCalculated(GestureState.GestureEndTarget endTarget) {
|
public void onGestureEndTargetCalculated(GestureState.GestureEndTarget endTarget) {
|
||||||
mCurrentGestureEndTarget = endTarget;
|
mCurrentGestureEndTarget = endTarget;
|
||||||
if (showAsGrid()) {
|
if (endTarget == GestureState.GestureEndTarget.NEW_TASK
|
||||||
mFocusedTaskId = mRunningTaskId;
|
|| endTarget == GestureState.GestureEndTarget.LAST_TASK) {
|
||||||
mFocusedTaskRatio =
|
// When switching to tasks in quick switch, ensures the snapped page's scroll maintain
|
||||||
mLastComputedTaskSize.width() / (float) mLastComputedTaskSize.height();
|
// invariant between quick switch and overview grid, to ensure a smooth animation
|
||||||
|
// transition.
|
||||||
|
updateGridProperties(/*isTaskDismissal=*/false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1645,7 +1634,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean runningTaskTileHidden = mRunningTaskTileHidden;
|
boolean runningTaskTileHidden = mRunningTaskTileHidden;
|
||||||
setCurrentTask(runningTaskInfo == null ? -1 : runningTaskInfo.taskId);
|
int runningTaskId = runningTaskInfo == null ? -1 : runningTaskInfo.taskId;
|
||||||
|
setCurrentTask(runningTaskId);
|
||||||
|
if (mActivity.getDeviceProfile().isTablet && FeatureFlags.ENABLE_OVERVIEW_GRID.get()) {
|
||||||
|
setFocusedTask(runningTaskId);
|
||||||
|
}
|
||||||
setCurrentPage(getRunningTaskIndex());
|
setCurrentPage(getRunningTaskIndex());
|
||||||
setRunningTaskViewShowScreenshot(false);
|
setRunningTaskViewShowScreenshot(false);
|
||||||
setRunningTaskHidden(runningTaskTileHidden);
|
setRunningTaskHidden(runningTaskTileHidden);
|
||||||
@@ -1658,7 +1651,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the running task id, cleaning up the old running task if necessary.
|
* Sets the running task id, cleaning up the old running task if necessary.
|
||||||
* @param runningTaskId
|
|
||||||
*/
|
*/
|
||||||
public void setCurrentTask(int runningTaskId) {
|
public void setCurrentTask(int runningTaskId) {
|
||||||
if (mRunningTaskId == runningTaskId) {
|
if (mRunningTaskId == runningTaskId) {
|
||||||
@@ -1674,6 +1666,15 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
mRunningTaskId = runningTaskId;
|
mRunningTaskId = runningTaskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the focused task id and store the width to height ratio of the focused task.
|
||||||
|
*/
|
||||||
|
protected void setFocusedTask(int focusedTaskId) {
|
||||||
|
mFocusedTaskId = focusedTaskId;
|
||||||
|
mFocusedTaskRatio =
|
||||||
|
mLastComputedTaskSize.width() / (float) mLastComputedTaskSize.height();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the tile associated with {@link #mRunningTaskId}
|
* Hides the tile associated with {@link #mRunningTaskId}
|
||||||
*/
|
*/
|
||||||
@@ -1768,74 +1769,115 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
IntSet topSet = new IntSet();
|
IntSet topSet = new IntSet();
|
||||||
IntSet bottomSet = new IntSet();
|
IntSet bottomSet = new IntSet();
|
||||||
float[] gridTranslations = new float[taskCount];
|
float[] gridTranslations = new float[taskCount];
|
||||||
int firstNonHomeTaskIndex = 0;
|
|
||||||
|
int focusedTaskIndex = Integer.MAX_VALUE;
|
||||||
|
int focusedTaskShift = 0;
|
||||||
|
int focusedTaskWidthAndSpacing = 0;
|
||||||
|
int snappedTaskRowWidth = 0;
|
||||||
|
int snappedPage = getNextPage();
|
||||||
|
TaskView snappedTaskView = getTaskViewAtByAbsoluteIndex(snappedPage);
|
||||||
|
|
||||||
if (!isTaskDismissal) {
|
if (!isTaskDismissal) {
|
||||||
mTopIdSet.clear();
|
mTopIdSet.clear();
|
||||||
}
|
}
|
||||||
for (int i = 0; i < taskCount; i++) {
|
for (int i = 0; i < taskCount; i++) {
|
||||||
TaskView taskView = getTaskViewAt(i);
|
TaskView taskView = getTaskViewAt(i);
|
||||||
if (isHomeTask(taskView)) {
|
int taskWidthAndSpacing = taskView.getLayoutParams().width + mPageSpacing;
|
||||||
if (firstNonHomeTaskIndex == i) {
|
|
||||||
firstNonHomeTaskIndex++;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Evenly distribute tasks between rows unless rearranging due to task dismissal, in
|
// Evenly distribute tasks between rows unless rearranging due to task dismissal, in
|
||||||
// which case keep tasks in their respective rows. For the running task, don't join
|
// which case keep tasks in their respective rows. For the running task, don't join
|
||||||
// the grid.
|
// the grid.
|
||||||
if (taskView.isRunningTask()) {
|
if (taskView.isFocusedTask()) {
|
||||||
topRowWidth += taskView.getLayoutParams().width + mPageSpacing;
|
topRowWidth += taskWidthAndSpacing;
|
||||||
bottomRowWidth += taskView.getLayoutParams().width + mPageSpacing;
|
bottomRowWidth += taskWidthAndSpacing;
|
||||||
|
|
||||||
|
focusedTaskIndex = i;
|
||||||
|
focusedTaskWidthAndSpacing = taskWidthAndSpacing;
|
||||||
|
gridTranslations[i] += focusedTaskShift;
|
||||||
|
gridTranslations[i] += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
|
||||||
|
|
||||||
// Center view vertically in case it's from different orientation.
|
// Center view vertically in case it's from different orientation.
|
||||||
taskView.setGridTranslationY((mLastComputedTaskSize.height() + taskTopMargin
|
taskView.setGridTranslationY((mLastComputedTaskSize.height() + taskTopMargin
|
||||||
- taskView.getLayoutParams().height) / 2f);
|
- taskView.getLayoutParams().height) / 2f);
|
||||||
} else if ((!isTaskDismissal && topRowWidth <= bottomRowWidth) || (isTaskDismissal
|
|
||||||
&& mTopIdSet.contains(taskView.getTask().key.id))) {
|
|
||||||
gridTranslations[i] += topAccumulatedTranslationX;
|
|
||||||
topRowWidth += taskView.getLayoutParams().width + mPageSpacing;
|
|
||||||
topSet.add(i);
|
|
||||||
mTopIdSet.add(taskView.getTask().key.id);
|
|
||||||
|
|
||||||
taskView.setGridTranslationY(taskGridVerticalDiff);
|
if (taskView == snappedTaskView) {
|
||||||
|
// If focused task is snapped, the row width is just task width and spacing.
|
||||||
// Move horizontally into empty space.
|
snappedTaskRowWidth = taskWidthAndSpacing;
|
||||||
float widthOffset = 0;
|
|
||||||
for (int j = i - 1; bottomSet.contains(j); j--) {
|
|
||||||
widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float gridTranslationX = mIsRtl ? widthOffset : -widthOffset;
|
|
||||||
gridTranslations[i] += gridTranslationX;
|
|
||||||
topAccumulatedTranslationX += gridTranslationX;
|
|
||||||
} else {
|
} else {
|
||||||
gridTranslations[i] += bottomAccumulatedTranslationX;
|
if (i > focusedTaskIndex) {
|
||||||
bottomRowWidth += taskView.getLayoutParams().width + mPageSpacing;
|
// For tasks after the focused task, shift by focused task's width and spacing.
|
||||||
bottomSet.add(i);
|
gridTranslations[i] +=
|
||||||
|
mIsRtl ? focusedTaskWidthAndSpacing : -focusedTaskWidthAndSpacing;
|
||||||
// Move into bottom row.
|
} else {
|
||||||
taskView.setGridTranslationY(heightOffset + taskGridVerticalDiff);
|
// For task before the focused task, accumulate the width and spacing to
|
||||||
|
// calculate the distance focused task need to shift.
|
||||||
// Move horizontally into empty space.
|
focusedTaskShift += mIsRtl ? taskWidthAndSpacing : -taskWidthAndSpacing;
|
||||||
float widthOffset = 0;
|
|
||||||
for (int j = i - 1; topSet.contains(j); j--) {
|
|
||||||
widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
|
|
||||||
}
|
}
|
||||||
|
boolean isTopRow = isTaskDismissal ? mTopIdSet.contains(taskView.getTask().key.id)
|
||||||
|
: topRowWidth <= bottomRowWidth;
|
||||||
|
if (isTopRow) {
|
||||||
|
gridTranslations[i] += topAccumulatedTranslationX;
|
||||||
|
topRowWidth += taskWidthAndSpacing;
|
||||||
|
topSet.add(i);
|
||||||
|
mTopIdSet.add(taskView.getTask().key.id);
|
||||||
|
|
||||||
float gridTranslationX = mIsRtl ? widthOffset : -widthOffset;
|
taskView.setGridTranslationY(taskGridVerticalDiff);
|
||||||
gridTranslations[i] += gridTranslationX;
|
|
||||||
bottomAccumulatedTranslationX += gridTranslationX;
|
// Move horizontally into empty space.
|
||||||
|
float widthOffset = 0;
|
||||||
|
for (int j = i - 1; !topSet.contains(j) && j >= 0; j--) {
|
||||||
|
if (j == focusedTaskIndex) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
float gridTranslationX = mIsRtl ? widthOffset : -widthOffset;
|
||||||
|
gridTranslations[i] += gridTranslationX;
|
||||||
|
topAccumulatedTranslationX += gridTranslationX;
|
||||||
|
} else {
|
||||||
|
gridTranslations[i] += bottomAccumulatedTranslationX;
|
||||||
|
bottomRowWidth += taskWidthAndSpacing;
|
||||||
|
bottomSet.add(i);
|
||||||
|
|
||||||
|
// Move into bottom row.
|
||||||
|
taskView.setGridTranslationY(heightOffset + taskGridVerticalDiff);
|
||||||
|
|
||||||
|
// Move horizontally into empty space.
|
||||||
|
float widthOffset = 0;
|
||||||
|
for (int j = i - 1; !bottomSet.contains(j) && j >= 0; j--) {
|
||||||
|
if (j == focusedTaskIndex) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
widthOffset += getTaskViewAt(j).getLayoutParams().width + mPageSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
float gridTranslationX = mIsRtl ? widthOffset : -widthOffset;
|
||||||
|
gridTranslations[i] += gridTranslationX;
|
||||||
|
bottomAccumulatedTranslationX += gridTranslationX;
|
||||||
|
}
|
||||||
|
if (taskView == snappedTaskView) {
|
||||||
|
snappedTaskRowWidth = isTopRow ? topRowWidth : bottomRowWidth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to maintain first non-home task's grid translation at 0, now shift translation
|
// We need to maintain snapped task's page scroll invariant between quick switch and
|
||||||
// of all the TaskViews to achieve that.
|
// overview, so we sure snapped task's grid translation is 0, and add a non-fullscreen
|
||||||
for (int i = firstNonHomeTaskIndex; i < taskCount; i++) {
|
// translationX that is the same as snapped task's full scroll adjustment.
|
||||||
|
float snappedTaskFullscreenScrollAdjustment = 0;
|
||||||
|
float snappedTaskGridTranslationX = 0;
|
||||||
|
if (snappedTaskView != null) {
|
||||||
|
snappedTaskFullscreenScrollAdjustment = snappedTaskView.getScrollAdjustment(
|
||||||
|
/*fullscreenEnabled=*/true, /*gridEnabled=*/false);
|
||||||
|
snappedTaskGridTranslationX = gridTranslations[snappedPage - mTaskViewStartIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < taskCount; i++) {
|
||||||
TaskView taskView = getTaskViewAt(i);
|
TaskView taskView = getTaskViewAt(i);
|
||||||
taskView.setGridTranslationX(
|
taskView.setGridTranslationX(gridTranslations[i] - snappedTaskGridTranslationX);
|
||||||
gridTranslations[i] - gridTranslations[firstNonHomeTaskIndex]);
|
taskView.setNonFullscreenTranslationX(snappedTaskFullscreenScrollAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the accumulated translation of the longer row.
|
// Use the accumulated translation of the longer row.
|
||||||
@@ -1861,7 +1903,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
// If the total width is shorter than one grid's width, move ClearAllButton further away
|
// If the total width is shorter than one grid's width, move ClearAllButton further away
|
||||||
// accordingly.
|
// accordingly.
|
||||||
float clearAllShortTotalCompensation = 0;
|
float clearAllShortTotalCompensation = 0;
|
||||||
float longRowWidth = Math.max(topRowWidth, bottomRowWidth);
|
int longRowWidth = Math.max(topRowWidth, bottomRowWidth);
|
||||||
if (longRowWidth < mLastComputedGridSize.width()) {
|
if (longRowWidth < mLastComputedGridSize.width()) {
|
||||||
float shortTotalCompensation = mLastComputedGridSize.width() - longRowWidth;
|
float shortTotalCompensation = mLastComputedGridSize.width() - longRowWidth;
|
||||||
clearAllShortTotalCompensation =
|
clearAllShortTotalCompensation =
|
||||||
@@ -1870,10 +1912,27 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
|
|
||||||
float clearAllTotalTranslationX =
|
float clearAllTotalTranslationX =
|
||||||
clearAllAccumulatedTranslation + clearAllShorterRowCompensation
|
clearAllAccumulatedTranslation + clearAllShorterRowCompensation
|
||||||
+ clearAllShortTotalCompensation;
|
+ clearAllShortTotalCompensation + snappedTaskFullscreenScrollAdjustment;
|
||||||
|
if (focusedTaskIndex < taskCount) {
|
||||||
|
// Shift by focused task's width and spacing if a task is focused.
|
||||||
|
clearAllTotalTranslationX +=
|
||||||
|
mIsRtl ? focusedTaskWidthAndSpacing : -focusedTaskWidthAndSpacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure there are enough space between snapped page and ClearAllButton, for the case
|
||||||
|
// of swiping up after quick switch.
|
||||||
|
if (snappedTaskView != null) {
|
||||||
|
int distanceFromClearAll = longRowWidth - snappedTaskRowWidth;
|
||||||
|
int minimumDistance =
|
||||||
|
mLastComputedGridSize.width() - snappedTaskView.getLayoutParams().width;
|
||||||
|
if (distanceFromClearAll < minimumDistance) {
|
||||||
|
int distanceDifference = minimumDistance - distanceFromClearAll;
|
||||||
|
clearAllTotalTranslationX += mIsRtl ? -distanceDifference : distanceDifference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mClearAllButton.setGridTranslationPrimary(
|
mClearAllButton.setGridTranslationPrimary(
|
||||||
clearAllTotalTranslationX - gridTranslations[firstNonHomeTaskIndex]);
|
clearAllTotalTranslationX - snappedTaskGridTranslationX);
|
||||||
mClearAllButton.setGridScrollOffset(
|
mClearAllButton.setGridScrollOffset(
|
||||||
mIsRtl ? mLastComputedTaskSize.left - mLastComputedGridSize.left
|
mIsRtl ? mLastComputedTaskSize.left - mLastComputedGridSize.left
|
||||||
: mLastComputedTaskSize.right - mLastComputedGridSize.right);
|
: mLastComputedTaskSize.right - mLastComputedGridSize.right);
|
||||||
@@ -1881,10 +1940,6 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
setGridProgress(mGridProgress);
|
setGridProgress(mGridProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isHomeTask(TaskView taskView) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves TaskView and ClearAllButton between carousel and 2 row grid.
|
* Moves TaskView and ClearAllButton between carousel and 2 row grid.
|
||||||
*
|
*
|
||||||
@@ -2107,7 +2162,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
} else {
|
} else {
|
||||||
snapToPageImmediately(pageToSnapTo);
|
snapToPageImmediately(pageToSnapTo);
|
||||||
// Grid got messed up, reapply.
|
// Grid got messed up, reapply.
|
||||||
updateGridProperties(true);
|
updateGridProperties(/*isTaskDismissal=*/true);
|
||||||
if (showAsGrid() && getFocusedTaskView() == null) {
|
if (showAsGrid() && getFocusedTaskView() == null) {
|
||||||
animateActionsViewOut();
|
animateActionsViewOut();
|
||||||
}
|
}
|
||||||
@@ -2981,44 +3036,62 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates page scroll synchronously and layout child views.
|
||||||
|
*/
|
||||||
|
public void updateScrollSynchronously() {
|
||||||
|
onLayout(false /* changed */, getLeft(), getTop(), getRight(), getBottom());
|
||||||
|
updateMinAndMaxScrollX();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int computeMinScroll() {
|
protected int computeMinScroll() {
|
||||||
if (getTaskViewCount() > 0) {
|
if (getTaskViewCount() > 0) {
|
||||||
if (mIsRtl && mDisallowScrollToClearAll) {
|
if (mIsRtl) {
|
||||||
// We aren't showing the clear all button,
|
// If we aren't showing the clear all button, use the rightmost task as the min
|
||||||
// so use the leftmost task as the min scroll.
|
// scroll.
|
||||||
return getScrollForPage(indexOfChild(getTaskViewAt(getTaskViewCount() - 1)));
|
return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||||
|
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
|
||||||
|
} else {
|
||||||
|
TaskView focusedTaskView = showAsGrid() ? getFocusedTaskView() : null;
|
||||||
|
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||||
|
: mTaskViewStartIndex);
|
||||||
}
|
}
|
||||||
return getLeftMostChildScroll();
|
|
||||||
}
|
}
|
||||||
return super.computeMinScroll();
|
return super.computeMinScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns page scroll of the left most child.
|
|
||||||
*/
|
|
||||||
public int getLeftMostChildScroll() {
|
|
||||||
return getScrollForPage(mIsRtl ? indexOfChild(mClearAllButton) : mTaskViewStartIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int computeMaxScroll() {
|
protected int computeMaxScroll() {
|
||||||
if (getTaskViewCount() > 0) {
|
if (getTaskViewCount() > 0) {
|
||||||
if (!mIsRtl && mDisallowScrollToClearAll) {
|
if (mIsRtl) {
|
||||||
// We aren't showing the clear all button,
|
TaskView focusedTaskView = showAsGrid() ? getFocusedTaskView() : null;
|
||||||
// so use the rightmost task as the min scroll.
|
return getScrollForPage(focusedTaskView != null ? indexOfChild(focusedTaskView)
|
||||||
return getScrollForPage(indexOfChild(getTaskViewAt(getTaskViewCount() - 1)));
|
: mTaskViewStartIndex);
|
||||||
|
} else {
|
||||||
|
// If we aren't showing the clear all button, use the leftmost task as the min
|
||||||
|
// scroll.
|
||||||
|
return getScrollForPage(mDisallowScrollToClearAll ? indexOfChild(
|
||||||
|
getTaskViewAt(getTaskViewCount() - 1)) : indexOfChild(mClearAllButton));
|
||||||
}
|
}
|
||||||
return getScrollForPage(mIsRtl ? mTaskViewStartIndex : indexOfChild(mClearAllButton));
|
|
||||||
}
|
}
|
||||||
return super.computeMaxScroll();
|
return super.computeMaxScroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns page scroll of ClearAllButton.
|
||||||
|
*/
|
||||||
|
public int getClearAllScroll() {
|
||||||
|
return getScrollForPage(indexOfChild(mClearAllButton));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
|
protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
|
||||||
ComputePageScrollsLogic scrollLogic) {
|
ComputePageScrollsLogic scrollLogic) {
|
||||||
boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
|
boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren,
|
||||||
scrollLogic);
|
scrollLogic);
|
||||||
|
boolean showAsFullscreen = showAsFullscreen();
|
||||||
|
boolean showAsGrid = showAsGrid();
|
||||||
|
|
||||||
// Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
|
// Align ClearAllButton to the left (RTL) or right (non-RTL), which is different from other
|
||||||
// TaskViews. This must be called after laying out ClearAllButton.
|
// TaskViews. This must be called after laying out ClearAllButton.
|
||||||
@@ -3032,11 +3105,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
View child = getChildAt(i);
|
View child = getChildAt(i);
|
||||||
float scrollDiff = 0;
|
float scrollDiff = 0;
|
||||||
if (child instanceof TaskView) {
|
if (child instanceof TaskView) {
|
||||||
scrollDiff = ((TaskView) child).getScrollAdjustment(mOverviewFullscreenEnabled,
|
scrollDiff = ((TaskView) child).getScrollAdjustment(showAsFullscreen, showAsGrid);
|
||||||
showAsGrid());
|
|
||||||
} else if (child instanceof ClearAllButton) {
|
} else if (child instanceof ClearAllButton) {
|
||||||
scrollDiff = ((ClearAllButton) child).getScrollAdjustment(
|
scrollDiff = ((ClearAllButton) child).getScrollAdjustment(showAsFullscreen,
|
||||||
mOverviewFullscreenEnabled, showAsGrid());
|
showAsGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollDiff != 0) {
|
if (scrollDiff != 0) {
|
||||||
@@ -3052,7 +3124,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
int childOffset = super.getChildOffset(index);
|
int childOffset = super.getChildOffset(index);
|
||||||
View child = getChildAt(index);
|
View child = getChildAt(index);
|
||||||
if (child instanceof TaskView) {
|
if (child instanceof TaskView) {
|
||||||
childOffset += ((TaskView) child).getOffsetAdjustment(mOverviewFullscreenEnabled,
|
childOffset += ((TaskView) child).getOffsetAdjustment(showAsFullscreen(),
|
||||||
showAsGrid());
|
showAsGrid());
|
||||||
} else if (child instanceof ClearAllButton) {
|
} else if (child instanceof ClearAllButton) {
|
||||||
childOffset += ((ClearAllButton) child).getOffsetAdjustment(mOverviewFullscreenEnabled,
|
childOffset += ((ClearAllButton) child).getOffsetAdjustment(mOverviewFullscreenEnabled,
|
||||||
@@ -3068,7 +3140,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return super.getChildVisibleSize(index);
|
return super.getChildVisibleSize(index);
|
||||||
}
|
}
|
||||||
return (int) (super.getChildVisibleSize(index) * taskView.getSizeAdjustment(
|
return (int) (super.getChildVisibleSize(index) * taskView.getSizeAdjustment(
|
||||||
mOverviewFullscreenEnabled));
|
showAsFullscreen()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClearAllButton getClearAllButton() {
|
public ClearAllButton getClearAllButton() {
|
||||||
@@ -3268,6 +3340,11 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
mCurrentGestureEndTarget).displayOverviewTasksAsGrid(mActivity.getDeviceProfile()));
|
mCurrentGestureEndTarget).displayOverviewTasksAsGrid(mActivity.getDeviceProfile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean showAsFullscreen() {
|
||||||
|
return mOverviewFullscreenEnabled
|
||||||
|
&& mCurrentGestureEndTarget != GestureState.GestureEndTarget.RECENTS;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean shouldShowOverviewActionsForState(STATE_TYPE state) {
|
public boolean shouldShowOverviewActionsForState(STATE_TYPE state) {
|
||||||
return !state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())
|
return !state.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())
|
||||||
|| getFocusedTaskView() != null;
|
|| getFocusedTaskView() != null;
|
||||||
|
|||||||
@@ -29,14 +29,12 @@ import static android.widget.Toast.LENGTH_SHORT;
|
|||||||
|
|
||||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
||||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||||
import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION;
|
|
||||||
import static com.android.launcher3.Utilities.comp;
|
import static com.android.launcher3.Utilities.comp;
|
||||||
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
||||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||||
import static com.android.launcher3.anim.Interpolators.EXAGGERATED_EASE;
|
import static com.android.launcher3.anim.Interpolators.EXAGGERATED_EASE;
|
||||||
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
||||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||||
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
|
|
||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS;
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS;
|
||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
|
||||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||||
@@ -78,7 +76,6 @@ import com.android.launcher3.DeviceProfile;
|
|||||||
import com.android.launcher3.LauncherSettings;
|
import com.android.launcher3.LauncherSettings;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
|
||||||
import com.android.launcher3.anim.Interpolators;
|
import com.android.launcher3.anim.Interpolators;
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||||
@@ -287,6 +284,9 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
private float mTaskResistanceTranslationY;
|
private float mTaskResistanceTranslationY;
|
||||||
// The following translation variables should only be used in the same orientation as Launcher.
|
// The following translation variables should only be used in the same orientation as Launcher.
|
||||||
private float mFullscreenTranslationX;
|
private float mFullscreenTranslationX;
|
||||||
|
// Applied as a complement to fullscreenTranslation, for adjusting the carousel overview, or the
|
||||||
|
// in transition carousel before forming the grid on tablets.
|
||||||
|
private float mNonFullscreenTranslationX;
|
||||||
private float mBoxTranslationY;
|
private float mBoxTranslationY;
|
||||||
// The following grid translations scales with mGridProgress.
|
// The following grid translations scales with mGridProgress.
|
||||||
private float mGridTranslationX;
|
private float mGridTranslationX;
|
||||||
@@ -784,7 +784,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecycle() {
|
public void onRecycle() {
|
||||||
mFullscreenTranslationX = mGridTranslationX = mGridTranslationY = mBoxTranslationY = 0f;
|
mFullscreenTranslationX = mNonFullscreenTranslationX =
|
||||||
|
mGridTranslationX = mGridTranslationY = mBoxTranslationY = 0f;
|
||||||
resetViewTransforms();
|
resetViewTransforms();
|
||||||
// Clear any references to the thumbnail (it will be re-read either from the cache or the
|
// Clear any references to the thumbnail (it will be re-read either from the cache or the
|
||||||
// system on next bind)
|
// system on next bind)
|
||||||
@@ -931,6 +932,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
applyTranslationX();
|
applyTranslationX();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNonFullscreenTranslationX(float nonFullscreenTranslationX) {
|
||||||
|
mNonFullscreenTranslationX = nonFullscreenTranslationX;
|
||||||
|
applyTranslationX();
|
||||||
|
}
|
||||||
|
|
||||||
public void setGridTranslationX(float gridTranslationX) {
|
public void setGridTranslationX(float gridTranslationX) {
|
||||||
mGridTranslationX = gridTranslationX;
|
mGridTranslationX = gridTranslationX;
|
||||||
applyTranslationX();
|
applyTranslationX();
|
||||||
@@ -953,6 +959,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
float scrollAdjustment = 0;
|
float scrollAdjustment = 0;
|
||||||
if (fullscreenEnabled) {
|
if (fullscreenEnabled) {
|
||||||
scrollAdjustment += mFullscreenTranslationX;
|
scrollAdjustment += mFullscreenTranslationX;
|
||||||
|
} else {
|
||||||
|
scrollAdjustment += mNonFullscreenTranslationX;
|
||||||
}
|
}
|
||||||
if (gridEnabled) {
|
if (gridEnabled) {
|
||||||
scrollAdjustment += mGridTranslationX;
|
scrollAdjustment += mGridTranslationX;
|
||||||
@@ -980,6 +988,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
private void applyTranslationX() {
|
private void applyTranslationX() {
|
||||||
setTranslationX(mDismissTranslationX + mTaskOffsetTranslationX + mTaskResistanceTranslationX
|
setTranslationX(mDismissTranslationX + mTaskOffsetTranslationX + mTaskResistanceTranslationX
|
||||||
+ getFullscreenTrans(mFullscreenTranslationX)
|
+ getFullscreenTrans(mFullscreenTranslationX)
|
||||||
|
+ getNonFullscreenTrans(mNonFullscreenTranslationX)
|
||||||
+ getGridTrans(mGridTranslationX));
|
+ getGridTrans(mGridTranslationX));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1201,12 +1210,12 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
int boxHeight;
|
int boxHeight;
|
||||||
float thumbnailRatio;
|
float thumbnailRatio;
|
||||||
boolean isFocusedTask = isFocusedTask();
|
boolean isFocusedTask = isFocusedTask();
|
||||||
if (isFocusedTask || isRunningTask()) {
|
if (isFocusedTask) {
|
||||||
// Task will be focused and should use focused task size. Use runningTaskRatio
|
// Task will be focused and should use focused task size. Use focusTaskRatio
|
||||||
// that is associated with the original orientation of the focused task if possible.
|
// that is associated with the original orientation of the focused task.
|
||||||
boxWidth = taskWidth;
|
boxWidth = taskWidth;
|
||||||
boxHeight = taskHeight;
|
boxHeight = taskHeight;
|
||||||
thumbnailRatio = isFocusedTask ? getRecentsView().getFocusedTaskRatio() : 0;
|
thumbnailRatio = getRecentsView().getFocusedTaskRatio();
|
||||||
} else {
|
} else {
|
||||||
// Otherwise task is in grid, and should use lastComputedGridTaskSize.
|
// Otherwise task is in grid, and should use lastComputedGridTaskSize.
|
||||||
Rect lastComputedGridTaskSize = getRecentsView().getLastComputedGridTaskSize();
|
Rect lastComputedGridTaskSize = getRecentsView().getLastComputedGridTaskSize();
|
||||||
@@ -1262,6 +1271,10 @@ public class TaskView extends FrameLayout implements Reusable {
|
|||||||
return Utilities.mapRange(progress, 0, endTranslation);
|
return Utilities.mapRange(progress, 0, endTranslation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float getNonFullscreenTrans(float endTranslation) {
|
||||||
|
return endTranslation - getFullscreenTrans(endTranslation);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRunningTask() {
|
public boolean isRunningTask() {
|
||||||
if (getRecentsView() == null) {
|
if (getRecentsView() == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user