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

Commit 258f5267 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge "Only calling finishedwhen all the animations have finished" into qt-qpr1-dev

am: 29b8d32f

Change-Id: I1bce705678d5f6669aebf8f415fea0fecf4322e4
parents 4092468b 29b8d32f
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -754,6 +754,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
    }

    private void onFinished(Callback callback) {
        if (!hasReachedFinalState(mScrimBehind)
            || !hasReachedFinalState(mScrimInFront)
            || !hasReachedFinalState(mScrimForBubble)) {
            if (callback != null && callback != mCallback) {
                // Since we only notify the callback that we're finished once everything has
                // finished, we need to make sure that any changing callbacks are also invoked
                callback.onFinished();
            }
            return;
        }
        if (mWakeLockHeld) {
            mWakeLock.release(TAG);
            mWakeLockHeld = false;
@@ -773,7 +783,15 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
            mInFrontTint = Color.TRANSPARENT;
            mBehindTint = Color.TRANSPARENT;
            mBubbleTint = Color.TRANSPARENT;
            updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint);
            updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint);
            updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint);
        }
    }

    private boolean hasReachedFinalState(ScrimView scrim) {
        return scrim.getViewAlpha() == getCurrentScrimAlpha(scrim)
                && scrim.getTint() == getCurrentScrimTint(scrim);
    }

    private boolean isAnimating(View scrim) {
+1 −0
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ public class ScrimControllerTest extends SysuiTestCase {
                TRANSPARENT /* behind */,
                TRANSPARENT /* bubble */);

        // Make sure at the very end of the animation, we're reset to transparent
        assertScrimTint(false /* front */,
                false /* behind */,
                false  /* bubble */);