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

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

Merge "Tuning app open/close animation." into ub-launcher3-qt-dev

parents ba33d1d2 b3c9077c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,5 +27,5 @@
    <!-- Swipe up to home related -->
    <dimen name="swipe_up_fling_min_visible_change">18dp</dimen>
    <dimen name="swipe_up_y_overshoot">10dp</dimen>
    <dimen name="swipe_up_max_workspace_trans_y">-80dp</dimen>
    <dimen name="swipe_up_max_workspace_trans_y">-60dp</dimen>
</resources>
 No newline at end of file
+12 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.Utilities.postAsyncCallback;
import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -1140,16 +1141,25 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>

        AnimatorPlaybackController homeAnim = homeAnimationFactory.createActivityAnimationToHome();

        // End on a "round-enough" radius so that the shape reveal doesn't have to do too much
        // rounding at the end of the animation.
        float startRadius = mClipAnimationHelper.getCurrentCornerRadius();
        float endRadius = startRect.width() / 6f;
        // We want the window alpha to be 0 once this threshold is met, so that the
        // FolderIconView can be seen morphing into the icon shape.
        final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f;
        anim.addOnUpdateListener((currentRect, progress) -> {
            homeAnim.setPlayFraction(progress);

            float windowAlpha = Math.max(0, Utilities.mapToRange(progress, 0,
                    windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR));
            float alphaProgress = ACCEL_1_5.getInterpolation(progress);
            float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0,
                    windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1);
            mTransformParams.setProgress(progress)
                    .setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
            if (isFloatingIconView) {
                mTransformParams.setCornerRadius(endRadius * progress + startRadius
                        * (1f - progress));
            }
            mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
                    false /* launcherOnTop */);

+16 −4
Original line number Diff line number Diff line
@@ -197,10 +197,15 @@ public class ClipAnimationHelper {
                    mTmpMatrix.postTranslate(app.position.x, app.position.y);
                    mClipRectF.roundOut(crop);
                    if (mSupportsRoundedCornersOnWindows) {
                        if (params.cornerRadius > -1) {
                            cornerRadius = params.cornerRadius;
                            scale = params.currentRect.width() / crop.width();
                        } else {
                            float windowCornerRadius = mUseRoundedCornersOnWindows
                                    ? mWindowCornerRadius : 0;
                            cornerRadius = Utilities.mapRange(progress, windowCornerRadius,
                                    mTaskCornerRadius);
                        }
                        mCurrentCornerRadius = cornerRadius;
                    }
                }
@@ -355,6 +360,7 @@ public class ClipAnimationHelper {
        @Nullable RectF currentRect;
        float targetAlpha;
        boolean forLiveTile;
        float cornerRadius;

        SyncRtSurfaceTransactionApplierCompat syncTransactionApplier;

@@ -365,6 +371,7 @@ public class ClipAnimationHelper {
            currentRect = null;
            targetAlpha = 0;
            forLiveTile = false;
            cornerRadius = -1;
        }

        public TransformParams setProgress(float progress) {
@@ -373,6 +380,11 @@ public class ClipAnimationHelper {
            return this;
        }

        public TransformParams setCornerRadius(float cornerRadius) {
            this.cornerRadius = cornerRadius;
            return this;
        }

        public TransformParams setCurrentRectAndTargetAlpha(RectF currentRect, float targetAlpha) {
            this.currentRect = currentRect;
            this.targetAlpha = targetAlpha;
+6 −7
Original line number Diff line number Diff line
@@ -44,14 +44,13 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
 */
public class StaggeredWorkspaceAnim {

    private static final int APP_CLOSE_ROW_START_DELAY_MS = 16;
    private static final int ALPHA_DURATION_MS = 200;
    private static final int APP_CLOSE_ROW_START_DELAY_MS = 10;
    private static final int ALPHA_DURATION_MS = 250;

    private static final float MAX_VELOCITY_PX_PER_S = 22f;

    private static final float DAMPING_RATIO =
            (SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY + SpringForce.DAMPING_RATIO_LOW_BOUNCY) / 2f;
    private static final float STIFFNESS = SpringForce.STIFFNESS_LOW;
    private static final float DAMPING_RATIO = 0.7f;
    private static final float STIFFNESS = 150f;

    private final float mVelocity;
    private final float mSpringTransY;
@@ -71,9 +70,9 @@ public class StaggeredWorkspaceAnim {

        // Scale the translationY based on the initial velocity to better sync the workspace items
        // with the floating view.
        float transFactor = 0.1f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
        float transFactor = 0.2f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
        mSpringTransY = transFactor * launcher.getResources()
                .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);;
                .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);

        DeviceProfile grid = launcher.getDeviceProfile();
        ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace()
+5 −2
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
    private static final long APP_LAUNCH_ALPHA_DOWN_DURATION =
            (long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);

    private static final long CROP_DURATION = 375;
    private static final long RADIUS_DURATION = 375;

    public static final int RECENTS_LAUNCH_DURATION = 336;
    private static final int LAUNCHER_RESUME_START_DELAY = 100;
    private static final int CLOSING_TRANSITION_DURATION_MS = 250;
@@ -494,10 +497,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
                    EXAGGERATED_EASE);
            FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
                    alphaDuration, LINEAR);
            FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, APP_LAUNCH_DURATION,
            FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, CROP_DURATION,
                    EXAGGERATED_EASE);
            FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0,
                    APP_LAUNCH_DURATION, EXAGGERATED_EASE);
                    RADIUS_DURATION, EXAGGERATED_EASE);

            @Override
            public void onUpdate(float percent) {
Loading