Merge "Pulse animation synchronization" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
32066387e1
@@ -73,6 +73,7 @@ public class KeyguardStatusView extends GridLayout implements
|
|||||||
|
|
||||||
private ArraySet<View> mVisibleInDoze;
|
private ArraySet<View> mVisibleInDoze;
|
||||||
private boolean mPulsing;
|
private boolean mPulsing;
|
||||||
|
private boolean mWasPulsing;
|
||||||
private float mDarkAmount = 0;
|
private float mDarkAmount = 0;
|
||||||
private int mTextColor;
|
private int mTextColor;
|
||||||
private float mWidgetPadding;
|
private float mWidgetPadding;
|
||||||
@@ -224,7 +225,8 @@ public class KeyguardStatusView extends GridLayout implements
|
|||||||
boolean hasHeader = mKeyguardSlice.hasHeader();
|
boolean hasHeader = mKeyguardSlice.hasHeader();
|
||||||
boolean smallClock = hasHeader || mPulsing;
|
boolean smallClock = hasHeader || mPulsing;
|
||||||
long duration = KeyguardSliceView.DEFAULT_ANIM_DURATION;
|
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
|
boolean shouldAnimate = mKeyguardSlice.getLayoutTransition() != null
|
||||||
&& mKeyguardSlice.getLayoutTransition().isRunning();
|
&& mKeyguardSlice.getLayoutTransition().isRunning();
|
||||||
@@ -448,6 +450,12 @@ public class KeyguardStatusView extends GridLayout implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPulsing(boolean pulsing, boolean animate) {
|
public void setPulsing(boolean pulsing, boolean animate) {
|
||||||
|
if (mPulsing == pulsing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mPulsing) {
|
||||||
|
mWasPulsing = true;
|
||||||
|
}
|
||||||
mPulsing = pulsing;
|
mPulsing = pulsing;
|
||||||
mKeyguardSlice.setPulsing(pulsing, animate);
|
mKeyguardSlice.setPulsing(pulsing, animate);
|
||||||
updateDozeVisibleViews();
|
updateDozeVisibleViews();
|
||||||
|
|||||||
@@ -2736,13 +2736,14 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
|
|
||||||
public void setPulsing(boolean pulsing) {
|
public void setPulsing(boolean pulsing) {
|
||||||
mPulsing = pulsing;
|
mPulsing = pulsing;
|
||||||
final boolean canAnimatePulse =
|
DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
|
||||||
!DozeParameters.getInstance(mContext).getDisplayNeedsBlanking();
|
final boolean animatePulse = !dozeParameters.getDisplayNeedsBlanking()
|
||||||
if (canAnimatePulse) {
|
&& dozeParameters.getAlwaysOn();
|
||||||
|
if (animatePulse) {
|
||||||
mAnimateNextPositionUpdate = true;
|
mAnimateNextPositionUpdate = true;
|
||||||
}
|
}
|
||||||
mNotificationStackScroller.setPulsing(pulsing, canAnimatePulse);
|
mNotificationStackScroller.setPulsing(pulsing, animatePulse);
|
||||||
mKeyguardStatusView.setPulsing(pulsing, canAnimatePulse);
|
mKeyguardStatusView.setPulsing(pulsing, animatePulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
|
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
|
||||||
|
|||||||
@@ -137,6 +137,10 @@ public class AnimationFilter {
|
|||||||
// to look nice
|
// to look nice
|
||||||
customDelay = StackStateAnimator.ANIMATION_DELAY_HEADS_UP_CLICKED
|
customDelay = StackStateAnimator.ANIMATION_DELAY_HEADS_UP_CLICKED
|
||||||
+ StackStateAnimator.ANIMATION_DELAY_HEADS_UP;
|
+ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5067,11 +5067,13 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
// ANIMATION_TYPE_PULSE_APPEAR
|
// ANIMATION_TYPE_PULSE_APPEAR
|
||||||
new AnimationFilter()
|
new AnimationFilter()
|
||||||
.animateAlpha()
|
.animateAlpha()
|
||||||
|
.hasDelays()
|
||||||
.animateY(),
|
.animateY(),
|
||||||
|
|
||||||
// ANIMATION_TYPE_PULSE_DISAPPEAR
|
// ANIMATION_TYPE_PULSE_DISAPPEAR
|
||||||
new AnimationFilter()
|
new AnimationFilter()
|
||||||
.animateAlpha()
|
.animateAlpha()
|
||||||
|
.hasDelays()
|
||||||
.animateY(),
|
.animateY(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -5135,10 +5137,10 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
StackStateAnimator.ANIMATION_DURATION_STANDARD,
|
StackStateAnimator.ANIMATION_DURATION_STANDARD,
|
||||||
|
|
||||||
// ANIMATION_TYPE_PULSE_APPEAR
|
// ANIMATION_TYPE_PULSE_APPEAR
|
||||||
KeyguardSliceView.DEFAULT_ANIM_DURATION,
|
StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR,
|
||||||
|
|
||||||
// ANIMATION_TYPE_PULSE_DISAPPEAR
|
// ANIMATION_TYPE_PULSE_DISAPPEAR
|
||||||
KeyguardSliceView.DEFAULT_ANIM_DURATION / 2,
|
StackStateAnimator.ANIMATION_DURATION_PULSE_APPEAR / 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
static final int ANIMATION_TYPE_ADD = 0;
|
static final int ANIMATION_TYPE_ADD = 0;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
|
import com.android.keyguard.KeyguardSliceView;
|
||||||
import com.android.systemui.Interpolators;
|
import com.android.systemui.Interpolators;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.ExpandableNotificationRow;
|
||||||
@@ -51,6 +52,8 @@ public class StackStateAnimator {
|
|||||||
= (int) (ANIMATION_DURATION_HEADS_UP_APPEAR
|
= (int) (ANIMATION_DURATION_HEADS_UP_APPEAR
|
||||||
* HeadsUpAppearInterpolator.getFractionUntilOvershoot());
|
* HeadsUpAppearInterpolator.getFractionUntilOvershoot());
|
||||||
public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 300;
|
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_DURATION_BLOCKING_HELPER_FADE = 240;
|
||||||
public static final int ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING = 80;
|
public static final int ANIMATION_DELAY_PER_ELEMENT_INTERRUPTING = 80;
|
||||||
public static final int ANIMATION_DELAY_PER_ELEMENT_MANUAL = 32;
|
public static final int ANIMATION_DELAY_PER_ELEMENT_MANUAL = 32;
|
||||||
@@ -430,15 +433,26 @@ public class StackStateAnimator {
|
|||||||
} else if (event.animationType == NotificationStackScrollLayout
|
} else if (event.animationType == NotificationStackScrollLayout
|
||||||
.AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR) {
|
.AnimationEvent.ANIMATION_TYPE_PULSE_APPEAR) {
|
||||||
ExpandableViewState viewState = finalState.getViewStateForView(changingView);
|
ExpandableViewState viewState = finalState.getViewStateForView(changingView);
|
||||||
mTmpState.copyFrom(viewState);
|
if (viewState != null) {
|
||||||
mTmpState.yTranslation += mPulsingAppearingTranslation;
|
mTmpState.copyFrom(viewState);
|
||||||
mTmpState.alpha = 0;
|
mTmpState.yTranslation += mPulsingAppearingTranslation;
|
||||||
mTmpState.applyToView(changingView);
|
mTmpState.alpha = 0;
|
||||||
|
mTmpState.applyToView(changingView);
|
||||||
|
}
|
||||||
} else if (event.animationType == NotificationStackScrollLayout
|
} else if (event.animationType == NotificationStackScrollLayout
|
||||||
.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
|
.AnimationEvent.ANIMATION_TYPE_PULSE_DISAPPEAR) {
|
||||||
ExpandableViewState viewState = finalState.getViewStateForView(changingView);
|
ExpandableViewState viewState = finalState.getViewStateForView(changingView);
|
||||||
viewState.yTranslation += mPulsingAppearingTranslation;
|
if (viewState != null) {
|
||||||
viewState.alpha = 0;
|
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
|
} else if (event.animationType == NotificationStackScrollLayout
|
||||||
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) {
|
.AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR) {
|
||||||
// This item is added, initialize it's properties.
|
// This item is added, initialize it's properties.
|
||||||
|
|||||||
Reference in New Issue
Block a user