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

Commit 79742599 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Tarandeep Singh
Browse files

Better interpolation and duration for animations

Test: Open IME
Bug: 111084606
Change-Id: I3c64fe8b772a8164573c8fe3de94d3573e8cd238
parent 12d08fd3
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) {