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

Commit d0f20abe authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix a couple of issues with app close" into ub-launcher3-master

parents ac0a5060 fc0f6a5c
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -440,6 +440,10 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                    mAnimator.play(getClosingWindowAnimators(targets));
                    mAnimator.play(getLauncherResumeAnimation());
                    mAnimator.start();

                    // Because t=0 has the app icon in its original spot, we can skip the
                    // first frame and have the same movement one frame earlier.
                    mAnimator.setCurrentPlayTime(REFRESH_RATE_MS);
                });
            }
        };
@@ -452,7 +456,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
        Matrix matrix = new Matrix();
        float height = mLauncher.getDeviceProfile().heightPx;
        float width = mLauncher.getDeviceProfile().widthPx;
        float endX = Utilities.isRtl(mLauncher.getResources()) ? -width : width;
        float endX = (Utilities.isRtl(mLauncher.getResources()) ? -width : width) * 1.16f;

        ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
        closingAnimator.setDuration(CLOSING_TRANSITION_DURATION_MS);
@@ -467,27 +471,27 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag

                float scale = getValue(1f, 0.8f, 0, 267, currentPlayTime,
                        Interpolators.AGGRESSIVE_EASE);
                matrix.setScale(scale, scale);

                float dX = getValue(0, endX, 0, 350, currentPlayTime,
                        Interpolators.AGGRESSIVE_EASE_IN_OUT);
                float dY = (height - height * scale) / 2f;

                TransactionCompat t = new TransactionCompat();
                for (RemoteAnimationTargetCompat app : targets) {
                    if (app.mode == RemoteAnimationTargetCompat.MODE_CLOSING) {
                        t.setAlpha(app.leash, 1f - percent);
                        matrix.postTranslate(dX, dY);
                        t.setAlpha(app.leash, getValue(1f, 0f, 0, 350, currentPlayTime,
                                Interpolators.APP_CLOSE_ALPHA));
                        matrix.setScale(scale, scale,
                                app.sourceContainerBounds.centerX(),
                                app.sourceContainerBounds.centerY());
                        matrix.postTranslate(dX, 0);
                        matrix.postTranslate(app.position.x, app.position.y);
                        t.setMatrix(app.leash, matrix);
                    }
                    // TODO: Layer should be set only once, but there is possibly a race condition
                    // where WindowManager is also calling setLayer.
                    if (isFirstFrame) {
                        int layer = app.mode == RemoteAnimationTargetCompat.MODE_CLOSING
                                ? Integer.MAX_VALUE
                                : app.prefixOrderIndex;
                        t.setLayer(app.leash, layer);
                    if (isFirstFrame) {
                        t.show(app.leash);
                    }
                }
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ public class Interpolators {
    public static final Interpolator AGGRESSIVE_EASE = new PathInterpolator(0.2f, 0f, 0f, 1f);
    public static final Interpolator AGGRESSIVE_EASE_IN_OUT = new PathInterpolator(0.8f,0, 0.4f, 1);

    public static final Interpolator APP_CLOSE_ALPHA = new PathInterpolator(0.9f, 0, 1f, 1f);

    public static final Interpolator OVERSHOOT_0 = new OvershootInterpolator(0);

    /**