Clean up speedbump handling when going to SHADE_LOCKED
Bug: 16291973 Change-Id: Ibaa127709ff7a1a001402bd958016998e2bd23bf
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user