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

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

Merge "Pulse animation synchronization" into pi-dev

parents e8a1e7a4 2a6bdfd9
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ public class KeyguardStatusView extends GridLayout implements

    private ArraySet<View> mVisibleInDoze;
    private boolean mPulsing;
    private boolean mWasPulsing;
    private float mDarkAmount = 0;
    private int mTextColor;
    private float mWidgetPadding;
@@ -224,7 +225,8 @@ public class KeyguardStatusView extends GridLayout implements
        boolean hasHeader = mKeyguardSlice.hasHeader();
        boolean smallClock = hasHeader || mPulsing;
        long duration = KeyguardSliceView.DEFAULT_ANIM_DURATION;
        long delay = smallClock ? 0 : duration / 4;
        long delay = smallClock || mWasPulsing ? 0 : duration / 4;
        mWasPulsing = false;

        boolean shouldAnimate = mKeyguardSlice.getLayoutTransition() != null
                && mKeyguardSlice.getLayoutTransition().isRunning();
@@ -448,6 +450,12 @@ public class KeyguardStatusView extends GridLayout implements
    }

    public void setPulsing(boolean pulsing, boolean animate) {
        if (mPulsing == pulsing) {
            return;
        }
        if (mPulsing) {
            mWasPulsing = true;
        }
        mPulsing = pulsing;
        mKeyguardSlice.setPulsing(pulsing, animate);
        updateDozeVisibleViews();
+6 −5
Original line number Diff line number Diff line
@@ -2736,13 +2736,14 @@ public class NotificationPanelView extends PanelView implements

    public void setPulsing(boolean pulsing) {
        mPulsing = pulsing;
        final boolean canAnimatePulse =
                !DozeParameters.getInstance(mContext).getDisplayNeedsBlanking();
        if (canAnimatePulse) {
        DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
        final boolean animatePulse = !dozeParameters.getDisplayNeedsBlanking()
                && dozeParameters.getAlwaysOn();
        if (animatePulse) {
            mAnimateNextPositionUpdate = true;
        }
        mNotificationStackScroller.setPulsing(pulsing, canAnimatePulse);
        mKeyguardStatusView.setPulsing(pulsing, canAnimatePulse);
        mNotificationStackScroller.setPulsing(pulsing, animatePulse);
        mKeyguardStatusView.setPulsing(pulsing, animatePulse);
    }

    public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
+4 −0
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ public class AnimationFilter {
                // to look nice
                customDelay = StackStateAnimator.ANIMATION_DELAY_HEADS_UP_CLICKED
                        + StackStateAnimator.ANIMATION_DELAY_HEADS_UP;
            } else if (ev.animationType == NotificationStackScrollLayout.AnimationEvent
                    .ANIMATION_TYPE_PULSE_APPEAR || ev.animationType ==
                    NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
                customDelay = StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2;
            }
        }
    }
+4 −2
Original line number Diff line number Diff line
@@ -5067,11 +5067,13 @@ public class NotificationStackScrollLayout extends ViewGroup
                // ANIMATION_TYPE_PULSE_APPEAR
                new AnimationFilter()
                        .animateAlpha()
                        .hasDelays()
                        .animateY(),

                // ANIMATION_TYPE_PULSE_DISAPPEAR
                new AnimationFilter()
                        .animateAlpha()
                        .hasDelays()
                        .animateY(),
        };

@@ -5135,10 +5137,10 @@ public class NotificationStackScrollLayout extends ViewGroup
                StackStateAnimator.ANIMATION_DURATION_STANDARD,

                // ANIMATION_TYPE_PULSE_APPEAR
                KeyguardSliceView.DEFAULT_ANIM_DURATION,
                StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR,

                // ANIMATION_TYPE_PULSE_DISAPPEAR
                KeyguardSliceView.DEFAULT_ANIM_DURATION / 2,
                StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2,
        };

        static final int ANIMATION_TYPE_ADD = 0;
+20 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;

import com.android.keyguard.KeyguardSliceView;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.statusbar.ExpandableNotificationRow;
@@ -51,6 +52,8 @@ public class StackStateAnimator {
            = (int) (ANIMATION_DURATION_HEADS_UP_APPEAR
                    * HeadsUpAppearInterpolator.getFractionUntilOvershoot());
    public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 300;
    public static final int ANIMATION_DURATION_PULSE_APPEAR =
            KeyguardSliceView.DEFAULT_ANIM_DURATION;
    public static final int ANIMATION_DURATION_BLOCKING_HELPER_FADE = 240;
    public static final int ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING = 80;
    public static final int ANIMATION_DELAY_PER_ELEMENT_MANUAL = 32;
@@ -430,15 +433,26 @@ public class StackStateAnimator {
            } else if (event.animationType == NotificationStackScrollLayout
                    .AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR) {
                ExpandableViewState viewState = finalState.getViewStateForView(changingView);
                if (viewState != null) {
                    mTmpState.copyFrom(viewState);
                    mTmpState.yTranslation += mPulsingAppearingTranslation;
                    mTmpState.alpha = 0;
                    mTmpState.applyToView(changingView);
                }
            } else if (event.animationType == NotificationStackScrollLayout
                    .AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
                ExpandableViewState viewState = finalState.getViewStateForView(changingView);
                viewState.yTranslation += mPulsingAppearingTranslation;
                if (viewState != null) {
                    viewState.alpha = 0;
                    // We want to animate the alpha away before the view starts translating,
                    // otherwise everything will overlap and look xtra ugly.
                    float originalYTranslation = viewState.yTranslation;
                    viewState.yTranslation = changingView.getTranslationY();
                    mAnimationFilter.animateAlpha = true;
                    mAnimationProperties.duration = ANIMATION_DURATION_PULSE_APPEAR / 2;
                    viewState.animateTo(changingView, mAnimationProperties);
                    viewState.yTranslation = originalYTranslation;
                }
            } else if (event.animationType == NotificationStackScrollLayout
                    .AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) {
                // This item is added, initialize it's properties.