Merge "2D Recents: polish the app -> recents transition" into nyc-mr2-dev

This commit is contained in:
TreeHugger Robot
2017-01-19 01:26:00 +00:00
committed by Android (Google) Code Review
2 changed files with 23 additions and 4 deletions

View File

@@ -733,7 +733,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
Task toTask = new Task(); Task toTask = new Task();
TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask, TaskViewTransform toTransform = getThumbnailTransitionTransform(stackView, toTask,
windowOverrideRect); windowOverrideRect);
Bitmap thumbnail = drawThumbnailTransitionBitmap(toTask, toTransform, // When using a grid layout, the header is already visible on screen at the target
// location, making it unnecessary to draw it in the transition thumbnail.
Bitmap thumbnail = stackView.useGridLayout()
? mThumbTransitionBitmapCache.createAshmemBitmap()
: drawThumbnailTransitionBitmap(toTask, toTransform,
mThumbTransitionBitmapCache); mThumbTransitionBitmapCache);
if (thumbnail != null) { if (thumbnail != null) {
RectF toTaskRect = toTransform.rect; RectF toTaskRect = toTransform.rect;
@@ -765,7 +769,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
// Get the transform for the running task // Get the transform for the running task
stackView.updateLayoutAlgorithm(true /* boundScroll */); stackView.updateLayoutAlgorithm(true /* boundScroll */);
stackView.updateToInitialState(); stackView.updateToInitialState();
boolean isInSplitScreen = Recents.getSystemServices().hasDockedTask();
stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask, stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
stackView.getScroller().getStackScroll(), mTmpTransform, null, windowOverrideRect); stackView.getScroller().getStackScroll(), mTmpTransform, null, windowOverrideRect);
return mTmpTransform; return mTmpTransform;

View File

@@ -292,6 +292,9 @@ public class TaskStackLayoutAlgorithm {
@ViewDebug.ExportedProperty(category="recents") @ViewDebug.ExportedProperty(category="recents")
private int mStackBottomOffset; private int mStackBottomOffset;
/** The height, in pixels, of each task view's title bar. */
private int mTitleBarHeight;
// The paths defining the motion of the tasks when the stack is focused and unfocused // The paths defining the motion of the tasks when the stack is focused and unfocused
private Path mUnfocusedCurve; private Path mUnfocusedCurve;
private Path mFocusedCurve; private Path mFocusedCurve;
@@ -404,6 +407,14 @@ public class TaskStackLayoutAlgorithm {
mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin); mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin);
mFreeformStackGap = mFreeformStackGap =
res.getDimensionPixelSize(R.dimen.recents_freeform_layout_bottom_margin); res.getDimensionPixelSize(R.dimen.recents_freeform_layout_bottom_margin);
mTitleBarHeight = getDimensionForDevice(mContext,
R.dimen.recents_task_view_header_height,
R.dimen.recents_task_view_header_height,
R.dimen.recents_task_view_header_height,
R.dimen.recents_task_view_header_height_tablet_land,
R.dimen.recents_task_view_header_height,
R.dimen.recents_task_view_header_height_tablet_land,
R.dimen.recents_grid_task_view_header_height);
} }
/** /**
@@ -904,12 +915,17 @@ public class TaskStackLayoutAlgorithm {
* Transforms the given {@param transformOut} to the screen coordinates, overriding the current * Transforms the given {@param transformOut} to the screen coordinates, overriding the current
* window rectangle with {@param windowOverrideRect} if non-null. * window rectangle with {@param windowOverrideRect} if non-null.
*/ */
public TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut, TaskViewTransform transformToScreenCoordinates(TaskViewTransform transformOut,
Rect windowOverrideRect) { Rect windowOverrideRect) {
Rect windowRect = windowOverrideRect != null Rect windowRect = windowOverrideRect != null
? windowOverrideRect ? windowOverrideRect
: Recents.getSystemServices().getWindowRect(); : Recents.getSystemServices().getWindowRect();
transformOut.rect.offset(windowRect.left, windowRect.top); transformOut.rect.offset(windowRect.left, windowRect.top);
if (useGridLayout()) {
// Draw the thumbnail a little lower to perfectly coincide with the view we are
// transitioning to, where the header bar has already been drawn.
transformOut.rect.offset(0, mTitleBarHeight);
}
return transformOut; return transformOut;
} }