Only clipping heads up that are not the first ones

Previously we would clip even the first heads up
notification which would lead to the notification being
clipped. This would happen if a notification would be
before the first heads up which could happen temporarily.

Fixes: 	138467810
Test: Add 2 heads up notifications that are not dismissable, swipe away the first, observe no clipping
Change-Id: I13f681a0a09a9de8e948fb666ee99718df3bae02
This commit is contained in:
Selim Cinek
2019-07-29 16:33:48 -07:00
parent 2738aa3f79
commit 3ff6f5080e

View File

@@ -161,6 +161,7 @@ public class StackScrollAlgorithm {
: 0;
float clipStart = 0;
int childCount = algorithmState.visibleChildren.size();
boolean firstHeadsUp = true;
for (int i = 0; i < childCount; i++) {
ExpandableView child = algorithmState.visibleChildren.get(i);
ExpandableViewState state = child.getViewState();
@@ -173,7 +174,7 @@ public class StackScrollAlgorithm {
boolean isHeadsUp = (child instanceof ExpandableNotificationRow)
&& ((ExpandableNotificationRow) child).isPinned();
if (mClipNotificationScrollToTop
&& (!state.inShelf || isHeadsUp)
&& (!state.inShelf || (isHeadsUp && !firstHeadsUp))
&& newYTranslation < clipStart) {
// The previous view is overlapping on top, clip!
float overlapAmount = clipStart - newYTranslation;
@@ -181,7 +182,9 @@ public class StackScrollAlgorithm {
} else {
state.clipTopAmount = 0;
}
if (isHeadsUp) {
firstHeadsUp = false;
}
if (!child.isTransparent()) {
// Only update the previous values if we are not transparent,
// otherwise we would clip to a transparent view.