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

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

Merge "Better interpolation and duration for animations"

parents 729bf1cf 79742599
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import android.util.SparseArray;
import android.view.InsetsState.InternalInsetType;
import android.view.SurfaceControl.Transaction;
import android.view.WindowInsets.Type.InsetType;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;

import com.android.internal.annotations.VisibleForTesting;

@@ -46,8 +48,9 @@ import java.util.ArrayList;
 */
public class InsetsController implements WindowInsetsController {

    // TODO: Use animation scaling and more optimal duration.
    private static final int ANIMATION_DURATION_MS = 400;
    private static final int ANIMATION_DURATION_SHOW_MS = 275;
    private static final int ANIMATION_DURATION_HIDE_MS = 340;
    private static final Interpolator INTERPOLATOR = new PathInterpolator(0.4f, 0f, 0.2f, 1f);
    private static final int DIRECTION_NONE = 0;
    private static final int DIRECTION_SHOW = 1;
    private static final int DIRECTION_HIDE = 2;
@@ -341,7 +344,10 @@ public class InsetsController implements WindowInsetsController {
                        show ? controller.getHiddenStateInsets() : controller.getShownStateInsets(),
                        show ? controller.getShownStateInsets() : controller.getHiddenStateInsets()
                );
                mAnimator.setDuration(ANIMATION_DURATION_MS);
                mAnimator.setDuration(show
                        ? ANIMATION_DURATION_SHOW_MS
                        : ANIMATION_DURATION_HIDE_MS);
                mAnimator.setInterpolator(INTERPOLATOR);
                mAnimator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationCancel(Animator animation) {