am 0ebd001f: Merge "Fixed a HUN crash with notification children" into mnc-dev

* commit '0ebd001f3068116b93e8a447f35f01a5b96ec161':
  Fixed a HUN crash with notification children
This commit is contained in:
Selim Cinek
2015-06-25 19:03:37 +00:00
committed by Android Git Automerger
2 changed files with 20 additions and 14 deletions

View File

@@ -1898,15 +1898,23 @@ public class NotificationStackScrollLayout extends ViewGroup
boolean pinnedAndClosed = row.isPinned() && !mIsExpanded; boolean pinnedAndClosed = row.isPinned() && !mIsExpanded;
if (!mIsExpanded && !isHeadsUp) { if (!mIsExpanded && !isHeadsUp) {
type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR; type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_DISAPPEAR;
} else if (isHeadsUp && (mAddedHeadsUpChildren.contains(row) || pinnedAndClosed)) { } else {
if (pinnedAndClosed || shouldHunAppearFromBottom(row)) { StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
// Our custom add animation if (viewState == null) {
type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR; // A view state was never generated for this view, so we don't need to animate
} else { // this. This may happen with notification children.
// Normal add animation continue;
type = AnimationEvent.ANIMATION_TYPE_ADD; }
if (isHeadsUp && (mAddedHeadsUpChildren.contains(row) || pinnedAndClosed)) {
if (pinnedAndClosed || shouldHunAppearFromBottom(viewState)) {
// Our custom add animation
type = AnimationEvent.ANIMATION_TYPE_HEADS_UP_APPEAR;
} else {
// Normal add animation
type = AnimationEvent.ANIMATION_TYPE_ADD;
}
onBottom = !pinnedAndClosed;
} }
onBottom = !pinnedAndClosed;
} }
AnimationEvent event = new AnimationEvent(row, type); AnimationEvent event = new AnimationEvent(row, type);
event.headsUpFromBottom = onBottom; event.headsUpFromBottom = onBottom;
@@ -1916,8 +1924,7 @@ public class NotificationStackScrollLayout extends ViewGroup
mAddedHeadsUpChildren.clear(); mAddedHeadsUpChildren.clear();
} }
private boolean shouldHunAppearFromBottom(ExpandableNotificationRow row) { private boolean shouldHunAppearFromBottom(StackViewState viewState) {
StackViewState viewState = mCurrentStackScrollState.getViewStateForView(row);
if (viewState.yTranslation + viewState.height < mAmbientState.getMaxHeadsUpTranslation()) { if (viewState.yTranslation + viewState.height < mAmbientState.getMaxHeadsUpTranslation()) {
return false; return false;
} }

View File

@@ -893,13 +893,12 @@ public class StackStateAnimator {
if (mHostLayout.indexOfChild(changingView) == -1) { if (mHostLayout.indexOfChild(changingView) == -1) {
// This notification was actually removed, so we need to add it to the overlay // This notification was actually removed, so we need to add it to the overlay
mHostLayout.getOverlay().add(changingView); mHostLayout.getOverlay().add(changingView);
ViewState viewState = new ViewState(); mTmpState.initFrom(changingView);
viewState.initFrom(changingView); mTmpState.yTranslation = -changingView.getActualHeight();
viewState.yTranslation = -changingView.getActualHeight();
// We temporarily enable Y animations, the real filter will be combined // We temporarily enable Y animations, the real filter will be combined
// afterwards anyway // afterwards anyway
mAnimationFilter.animateY = true; mAnimationFilter.animateY = true;
startViewAnimations(changingView, viewState, 0, startViewAnimations(changingView, mTmpState, 0,
ANIMATION_DURATION_HEADS_UP_DISAPPEAR); ANIMATION_DURATION_HEADS_UP_DISAPPEAR);
mChildrenToClearFromOverlay.add(changingView); mChildrenToClearFromOverlay.add(changingView);
} }