Implement transition for docking task in recents #3
- Implement clipping for thumbnail. Bug: 27607141 Change-Id: Ic3ba0acf685341ad715fae1601fad5eba1a93e44
This commit is contained in:
@@ -871,8 +871,8 @@ public class AppTransition implements Dump {
|
||||
* This animation runs for the thumbnail that gets cross faded with the enter/exit activity
|
||||
* when a thumbnail is specified with the pending animation override.
|
||||
*/
|
||||
Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, Bitmap thumbnailHeader,
|
||||
final int taskId) {
|
||||
Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, @Nullable Rect contentInsets,
|
||||
Bitmap thumbnailHeader, final int taskId) {
|
||||
Animation a;
|
||||
final int thumbWidthI = thumbnailHeader.getWidth();
|
||||
final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
|
||||
@@ -900,11 +900,35 @@ public class AppTransition implements Dump {
|
||||
translate.setInterpolator(TOUCH_RESPONSE_INTERPOLATOR);
|
||||
translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
|
||||
|
||||
float thumbScale = thumbWidth / (appWidth - (contentInsets != null
|
||||
? contentInsets.left - contentInsets.right : 0));
|
||||
|
||||
mTmpFromClipRect.set(0, 0, thumbWidthI, thumbHeightI);
|
||||
mTmpToClipRect.set(appRect);
|
||||
|
||||
// Containing frame is in screen space, but we need the clip rect in the
|
||||
// app space.
|
||||
mTmpToClipRect.offsetTo(0, 0);
|
||||
mTmpToClipRect.right = (int) (mTmpToClipRect.right * thumbScale);
|
||||
mTmpToClipRect.bottom = (int) (mTmpToClipRect.bottom * thumbScale);
|
||||
|
||||
if (contentInsets != null) {
|
||||
mTmpToClipRect.inset((int) (-contentInsets.left * thumbScale),
|
||||
(int) (-contentInsets.top * thumbScale),
|
||||
(int) (-contentInsets.right * thumbScale),
|
||||
(int) (-contentInsets.bottom * thumbScale));
|
||||
}
|
||||
|
||||
Animation clipAnim = new ClipRectAnimation(mTmpFromClipRect, mTmpToClipRect);
|
||||
clipAnim.setInterpolator(TOUCH_RESPONSE_INTERPOLATOR);
|
||||
clipAnim.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
|
||||
|
||||
// This AnimationSet uses the Interpolators assigned above.
|
||||
AnimationSet set = new AnimationSet(false);
|
||||
set.addAnimation(scale);
|
||||
set.addAnimation(alpha);
|
||||
set.addAnimation(translate);
|
||||
set.addAnimation(clipAnim);
|
||||
a = set;
|
||||
} else {
|
||||
// Animation down from the full screen to the thumbnail
|
||||
|
||||
@@ -288,6 +288,7 @@ public class AppWindowAnimator {
|
||||
}
|
||||
thumbnail.setMatrix(tmpFloats[Matrix.MSCALE_X], tmpFloats[Matrix.MSKEW_Y],
|
||||
tmpFloats[Matrix.MSKEW_X], tmpFloats[Matrix.MSCALE_Y]);
|
||||
thumbnail.setWindowCrop(thumbnailTransformation.getClipRect());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1576,12 +1576,13 @@ class WindowSurfacePlacer {
|
||||
WindowState win = appToken.findMainWindow();
|
||||
Rect appRect = win != null ? win.getContentFrameLw() :
|
||||
new Rect(0, 0, displayInfo.appWidth, displayInfo.appHeight);
|
||||
Rect insets = win != null ? win.mContentInsets : null;
|
||||
// For the new aspect-scaled transition, we want it to always show
|
||||
// above the animating opening/closing window, and we want to
|
||||
// synchronize its thumbnail surface with the surface for the
|
||||
// open/close animation (only on the way down)
|
||||
anim = mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect,
|
||||
thumbnailHeader, taskId);
|
||||
insets, thumbnailHeader, taskId);
|
||||
openingAppAnimator.thumbnailForceAboveLayer = Math.max(openingLayer, closingLayer);
|
||||
openingAppAnimator.deferThumbnailDestruction =
|
||||
!mService.mAppTransition.isNextThumbnailTransitionScaleUp();
|
||||
|
||||
Reference in New Issue
Block a user