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

Commit 08a7ef9d authored by Brian Isganitis's avatar Brian Isganitis
Browse files

Animate scrim within open/close PendingAnimation.

AbstractSlideInView implementations can override how the scrim is
interpolated.

Test: Manual
Flag: NONE Trivial
Bug: 341784466
Change-Id: Id184a5753b369f8f6b4c3d905d26c1a27209dad6
parent 91ff82f9
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
    protected @NonNull AnimatorPlaybackController mOpenCloseAnimation;

    protected ViewGroup mContent;
    protected final View mColorScrim;
    protected final @Nullable View mColorScrim;

    /**
     * Interpolator for {@link #mOpenCloseAnimation} when we are closing due to dragging downwards.
@@ -216,6 +216,9 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>

        animation.addFloat(
                this, TRANSLATION_SHIFT, fromTranslationShift, toTranslationShift, LINEAR);
        if (mColorScrim != null) {
            animation.setViewAlpha(mColorScrim, 1 - toTranslationShift, getScrimInterpolator());
        }
        onOpenCloseAnimationPending(animation);

        mOpenCloseAnimation = animation.createPlaybackController();
@@ -254,9 +257,6 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
    protected void setTranslationShift(float translationShift) {
        mTranslationShift = translationShift;
        mContent.setTranslationY(mTranslationShift * getShiftRange());
        if (mColorScrim != null) {
            mColorScrim.setAlpha(1 - mTranslationShift);
        }
        invalidate();
    }

@@ -500,6 +500,10 @@ public abstract class AbstractSlideInView<T extends Context & ActivityContext>
        return Interpolators.ACCELERATE;
    }

    protected Interpolator getScrimInterpolator() {
        return LINEAR;
    }

    protected void onCloseComplete() {
        mIsOpen = false;
        getPopupContainer().removeView(this);