diff options
| author | Selim Cinek <cinek@google.com> | 2014-04-30 17:27:15 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-04-30 17:27:15 +0000 |
| commit | ac1d91c1de3934f022b1b93c032aad28dab79405 (patch) | |
| tree | e954e12fcbc7184528050615e72982135d87074e | |
| parent | c96190e9fe49aa8c9d1d9605e9ec46a705b836bd (diff) | |
| parent | 0653363a76f31e262519591df7401dd0c0acf855 (diff) | |
| download | frameworks_base-ac1d91c1de3934f022b1b93c032aad28dab79405.zip frameworks_base-ac1d91c1de3934f022b1b93c032aad28dab79405.tar.gz frameworks_base-ac1d91c1de3934f022b1b93c032aad28dab79405.tar.bz2 | |
am eeffa380: Merge "Fixed a crash of the notification animation on initial startup"
* commit 'eeffa3804170d1ecb3521cb3911da7d677fa1611':
Fixed a crash of the notification animation on initial startup
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java index 9c6238f..24daa4f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java @@ -66,8 +66,8 @@ public class StackStateAnimator { } initializeAddedViewStates(mAnimationEvents, finalState); int childCount = mHostLayout.getChildCount(); + boolean isFirstAnimatingView = true; for (int i = 0; i < childCount; i++) { - final boolean isFirstView = i == 0; final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i); StackScrollState.ViewState viewState = finalState.getViewStateForView(child); if (viewState == null) { @@ -80,7 +80,7 @@ public class StackStateAnimator { child.setVisibility(View.VISIBLE); } - startPropertyAnimation(newDuration, isFirstView, child, viewState, alpha); + startPropertyAnimation(newDuration, isFirstAnimatingView, child, viewState, alpha); // TODO: animate clipBounds child.setClipBounds(null); @@ -88,11 +88,12 @@ public class StackStateAnimator { if (viewState.height != currentHeigth) { startHeightAnimation(newDuration, child, viewState, currentHeigth); } + isFirstAnimatingView = false; } mAnimationIsRunning = true; } - private void startPropertyAnimation(long newDuration, final boolean isFirstView, + private void startPropertyAnimation(long newDuration, final boolean hasFinishAction, final ExpandableView child, StackScrollState.ViewState viewState, final float alpha) { child.animate().setInterpolator(mFastOutSlowInInterpolator) .alpha(alpha) @@ -103,7 +104,7 @@ public class StackStateAnimator { @Override public void run() { mAnimationIsRunning = false; - if (isFirstView) { + if (hasFinishAction) { mHandledEvents.clear(); mHostLayout.onChildAnimationFinished(); } @@ -128,16 +129,26 @@ public class StackStateAnimator { heightAnimator.start(); } + /** + * Initialize the viewStates for the added children + * + * @param animationEvents the animation events who contain the added children + * @param finalState the final state to animate to + */ private void initializeAddedViewStates( - ArrayList<NotificationStackScrollLayout.ChildHierarchyChangeEvent> mAnimationEvents, + ArrayList<NotificationStackScrollLayout.ChildHierarchyChangeEvent> animationEvents, StackScrollState finalState) { - for (NotificationStackScrollLayout.ChildHierarchyChangeEvent event: mAnimationEvents) { + for (NotificationStackScrollLayout.ChildHierarchyChangeEvent event: animationEvents) { View changingView = event.changingView; if (event.animationType == NotificationStackScrollLayout.ChildHierarchyChangeEvent .ANIMATION_TYPE_ADD && !mHandledEvents.contains(event)) { // This item is added, initialize it's properties. StackScrollState.ViewState viewState = finalState.getViewStateForView(changingView); + if (viewState == null) { + // The position for this child was never generated, let's continue. + continue; + } changingView.setAlpha(0); changingView.setTranslationY(viewState.yTranslation); changingView.setTranslationZ(viewState.zTranslation); |
