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

Commit 8058bc06 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android Git Automerger
Browse files

am 76ce7a8b: Clean up speedbump handling when going to SHADE_LOCKED

* commit '76ce7a8bf3a9f73f90fd91b7e2facc416ae20540':
  Clean up speedbump handling when going to SHADE_LOCKED
parents 6326e09d 8b73006a
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -76,23 +76,25 @@ public class SpeedBumpView extends ExpandableView {
        return true;
    }

    public void performVisibilityAnimation(boolean nowVisible) {
        animateDivider(nowVisible, null /* onFinishedRunnable */);
    public void performVisibilityAnimation(boolean nowVisible, long delay) {
        animateDivider(nowVisible, delay, null /* onFinishedRunnable */);
    }

    /**
     * Animate the divider to a new visibility.
     *
     * @param nowVisible should it now be visible
     * @param delay the delay after the animation should start
     * @param onFinishedRunnable A runnable which should be run when the animation is
     *        finished.
     */
    public void animateDivider(boolean nowVisible, Runnable onFinishedRunnable) {
    public void animateDivider(boolean nowVisible, long delay, Runnable onFinishedRunnable) {
        if (nowVisible != mIsVisible) {
            // Animate dividers
            float endValue = nowVisible ? 1.0f : 0.0f;
            mLine.animate()
                    .alpha(endValue)
                    .setStartDelay(delay)
                    .scaleX(endValue)
                    .scaleY(endValue)
                    .setInterpolator(mFastOutSlowInInterpolator)
@@ -116,13 +118,13 @@ public class SpeedBumpView extends ExpandableView {
    public void performRemoveAnimation(long duration, float translationDirection,
            Runnable onFinishedRunnable) {
        // TODO: Use duration
        performVisibilityAnimation(false);
        performVisibilityAnimation(false, 0 /* delay */);
    }

    @Override
    public void performAddAnimation(long delay, long duration) {
        // TODO: Use delay and duration
        performVisibilityAnimation(true);
        // TODO: Use duration
        performVisibilityAnimation(true, delay);
    }

    @Override
+1 −3
Original line number Diff line number Diff line
@@ -1932,10 +1932,8 @@ public class NotificationStackScrollLayout extends ViewGroup
            if (visible) {
                // Make invisible to ensure that the appear animation is played.
                mSpeedBumpView.setInvisible();
                if (!mIsExpansionChanging) {
                    generateAddAnimation(mSpeedBumpView);
                }
            } else {
                // TODO: This doesn't really work, because the view is already set to GONE above.
                generateRemoveAnimation(mSpeedBumpView);
            }
        }
+6 −5
Original line number Diff line number Diff line
@@ -171,8 +171,7 @@ public class StackScrollState {
                updateChildClip(child, newHeight, state.topOverLap);

                if(child instanceof SpeedBumpView) {
                    float lineEnd = newYTranslation + newHeight / 2;
                    performSpeedBumpAnimation(i, (SpeedBumpView) child, lineEnd);
                    performSpeedBumpAnimation(i, (SpeedBumpView) child, state, 0);
                } else if (child instanceof DismissView) {
                    DismissView dismissView = (DismissView) child;
                    boolean visible = state.topOverLap < mClearAllTopPadding;
@@ -197,12 +196,14 @@ public class StackScrollState {
        child.setClipBounds(mClipRect);
    }

    private void performSpeedBumpAnimation(int i, SpeedBumpView speedBump, float speedBumpEnd) {
    public void performSpeedBumpAnimation(int i, SpeedBumpView speedBump, ViewState state,
            long delay) {
        View nextChild = getNextChildNotGone(i);
        if (nextChild != null) {
            float lineEnd = state.yTranslation + state.height / 2;
            ViewState nextState = getViewStateForView(nextChild);
            boolean startIsAboveNext = nextState.yTranslation > speedBumpEnd;
            speedBump.animateDivider(startIsAboveNext, null /* onFinishedRunnable */);
            boolean startIsAboveNext = nextState.yTranslation > lineEnd;
            speedBump.animateDivider(startIsAboveNext, delay, null /* onFinishedRunnable */);
        }
    }

+7 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.view.animation.Interpolator;

import com.android.systemui.R;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.SpeedBumpView;

import java.util.ArrayList;
import java.util.HashSet;
@@ -115,7 +116,7 @@ public class StackStateAnimator {
            }

            child.setClipBounds(null);
            startAnimations(child, viewState, finalState);
            startAnimations(child, viewState, finalState, i);
        }
        if (!isRunning()) {
            // no child has preformed any animation, lets finish
@@ -145,7 +146,7 @@ public class StackStateAnimator {
     * Start an animation to the given viewState
     */
    private void startAnimations(final ExpandableView child, StackScrollState.ViewState viewState,
            StackScrollState finalState) {
            StackScrollState finalState, int i) {
        int childVisibility = child.getVisibility();
        boolean wasVisible = childVisibility == View.VISIBLE;
        final float alpha = viewState.alpha;
@@ -223,6 +224,10 @@ public class StackStateAnimator {
        if (wasAdded) {
            child.performAddAnimation(delay, mCurrentLength);
        }
        if (child instanceof SpeedBumpView) {
            finalState.performSpeedBumpAnimation(i, (SpeedBumpView) child, viewState,
                    delay + duration);
        }
    }

    private long calculateChildAnimationDelay(StackScrollState.ViewState viewState,