Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dfb25d3f authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Make thumbnail header animation match multi window thumbnail animation.

Change-Id: Ib21c7c6300d58f08132aadae3aa68439793936d2
parent f120f523
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -651,15 +651,15 @@ 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 activity options.
     */
    Animation createThumbnailAspectScaleAnimationLocked(int appWidth, int appHeight,
            int deviceWidth) {
    Animation createThumbnailAspectScaleAnimationLocked(Rect appRect) {
        Animation a;
        final int thumbWidthI = mNextAppTransitionThumbnail.getWidth();
        final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
        final int thumbHeightI = mNextAppTransitionThumbnail.getHeight();
        final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
        final int appWidth = appRect.width();

        float scaleW = deviceWidth / thumbWidth;
        float scaleW = appWidth / thumbWidth;
        float unscaledHeight = thumbHeight * scaleW;
        float unscaledStartY = mNextAppTransitionStartY - (unscaledHeight - thumbHeight) / 2f;
        if (mNextAppTransitionScaleUp) {
@@ -672,8 +672,10 @@ public class AppTransition implements Dump {
            Animation alpha = new AlphaAnimation(1, 0);
            alpha.setInterpolator(mThumbnailFadeOutInterpolator);
            alpha.setDuration(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION);
            Animation translate = new TranslateAnimation(0, 0, 0, -unscaledStartY +
                    mNextAppTransitionInsets.top);
            final float toX = appRect.left + appRect.width() / 2 -
                    (mNextAppTransitionStartX + thumbWidth / 2);
            final float toY = appRect.top + mNextAppTransitionInsets.top + -unscaledStartY;
            Animation translate = new TranslateAnimation(0, toX, 0, toY);
            translate.setInterpolator(mTouchResponseInterpolator);
            translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);

@@ -706,7 +708,7 @@ public class AppTransition implements Dump {
            a = set;

        }
        return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, 0,
        return prepareThumbnailAnimationWithDuration(a, appWidth, appRect.height(), 0,
                mTouchResponseInterpolator);
    }

+7 −3
Original line number Diff line number Diff line
@@ -9539,13 +9539,17 @@ public class WindowManagerService extends IWindowManager.Stub
                    // Get the thumbnail animation
                    Animation anim;
                    if (mAppTransition.isNextThumbnailTransitionAspectScaled()) {
                        // If this is a multi-window scenario, we use the windows frame as
                        // destination of the thumbnail header animation. If this is a full screen
                        // window scenario, we use the whole display as the target.
                        WindowState win = topOpeningApp.findMainWindow();
                        Rect appRect = win != null ? win.getContentFrameLw() :
                                new Rect(0, 0, displayInfo.appWidth, displayInfo.appHeight);
                        // 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 = mAppTransition.createThumbnailAspectScaleAnimationLocked(
                                displayInfo.appWidth, displayInfo.appHeight,
                                displayInfo.logicalWidth);
                        anim = mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect);
                        openingAppAnimator.thumbnailForceAboveLayer = Math.max(topOpeningLayer,
                                topClosingLayer);
                        openingAppAnimator.deferThumbnailDestruction =