Pulse animation synchronization
Fade in pulsing notification after a delay and fix clock scale delay. Fixes: 109809484 Fixes: 110204622 Test: visual Change-Id: I3b62c4c2508d7b536287020801a58cb317e88ac0
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5051,11 +5051,13 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
// ANIMATION_TYPE_PULSE_APPEAR
|
||||
new AnimationFilter()
|
||||
.animateAlpha()
|
||||
.hasDelays()
|
||||
.animateY(),
|
||||
|
||||
// ANIMATION_TYPE_PULSE_DISAPPEAR
|
||||
new AnimationFilter()
|
||||
.animateAlpha()
|
||||
.hasDelays()
|
||||
.animateY(),
|
||||
};
|
||||
|
||||
@@ -5119,10 +5121,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;
|
||||
|
||||
@@ -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);
|
||||
mTmpState.copyFrom(viewState);
|
||||
mTmpState.yTranslation += mPulsingAppearingTranslation;
|
||||
mTmpState.alpha = 0;
|
||||
mTmpState.applyToView(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;
|
||||
viewState.alpha = 0;
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user