Huns could become clipped and their actions hidden
after they were posted the first time.
They are now only pushed in if they are above the shelf
Test: manual, add huns, observe correct clipping
Change-Id: I3277da30397e7424c000098b822e571620dd1e08
Fixes:
38017936
}
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
float notificationClipEnd;
- boolean aboveShelf = row.getTranslationZ() > baseZHeight;
+ boolean aboveShelf = ViewState.getFinalTranslationZ(row) > baseZHeight;
boolean isLastChild = child == lastChild;
float rowTranslationY = row.getTranslationY();
if (isLastChild || aboveShelf || backgroundForceHidden) {
private void updateNotificationClipHeight(ExpandableNotificationRow row,
float notificationClipEnd) {
float viewEnd = row.getTranslationY() + row.getActualHeight();
+ boolean isPinned = row.isPinned() || row.isHeadsUpAnimatingAway();
if (viewEnd > notificationClipEnd
- && (mAmbientState.isShadeExpanded()
- || (!row.isPinned() && !row.isHeadsUpAnimatingAway()))) {
- row.setClipBottomAmount((int) (viewEnd - notificationClipEnd));
+ && (mAmbientState.isShadeExpanded() || !isPinned)) {
+ int clipBottomAmount = (int) (viewEnd - notificationClipEnd);
+ if (isPinned) {
+ clipBottomAmount = Math.min(row.getIntrinsicHeight() - row.getCollapsedHeight(),
+ clipBottomAmount);
+ }
+ row.setClipBottomAmount(clipBottomAmount);
} else {
row.setClipBottomAmount(0);
}
? fullTransitionAmount
: transitionAmount;
iconState.clampedAppearAmount = clampedAmount;
- float contentTransformationAmount = isLastChild || iconState.translateContent
+ float contentTransformationAmount = !row.isAboveShelf()
+ && (isLastChild || iconState.translateContent)
? iconTransitionAmount
: 0.0f;
row.setContentTransformationAmount(contentTransformationAmount, isLastChild);
if (mIsExpanded) {
// Ensure that the heads up is always visible even when scrolled off
clampHunToTop(ambientState, row, childState);
- if (i == 0) {
+ if (i == 0 && row.isAboveShelf()) {
// the first hun can't get off screen.
clampHunToMaxTranslation(ambientState, row, childState);
}
private void clampHunToMaxTranslation(AmbientState ambientState, ExpandableNotificationRow row,
ExpandableViewState childState) {
float newTranslation;
- float bottomPosition = ambientState.getMaxHeadsUpTranslation() - row.getCollapsedHeight();
+ float maxHeadsUpTranslation = ambientState.getMaxHeadsUpTranslation();
+ float maxShelfPosition = ambientState.getInnerHeight() + ambientState.getTopPadding()
+ + ambientState.getStackTranslation();
+ maxHeadsUpTranslation = Math.min(maxHeadsUpTranslation, maxShelfPosition);
+ float bottomPosition = maxHeadsUpTranslation - row.getCollapsedHeight();
newTranslation = Math.min(childState.yTranslation, bottomPosition);
- childState.height = (int) Math.max(childState.height
- - (childState.yTranslation - newTranslation), row.getCollapsedHeight());
+ childState.height = (int) Math.min(childState.height, maxHeadsUpTranslation
+ - newTranslation);
childState.yTranslation = newTranslation;
}
}
}
+ /**
+ * Get the end value of the zTranslation animation running on a view or the zTranslation
+ * if no animation is running.
+ */
+ public static float getFinalTranslationZ(View view) {
+ if (view == null) {
+ return 0;
+ }
+ ValueAnimator zAnimator = getChildTag(view, TAG_ANIMATOR_TRANSLATION_Z);
+ if (zAnimator == null) {
+ return view.getTranslationZ();
+ } else {
+ return getChildTag(view, TAG_END_TRANSLATION_Z);
+ }
+ }
+
public static boolean isAnimatingY(View child) {
return getChildTag(child, TAG_ANIMATOR_TRANSLATION_Y) != null;
}