Clip view before shelf and leave the rest unclipped

Bug: 172289889
Test: visual
Change-Id: Ic49edf84ba246be9bfff7d39d822ced1d7a23e46
This commit is contained in:
Lyn Han
2021-01-19 18:06:31 -06:00
parent 129869eb48
commit 8f3ba5abbd

View File

@@ -204,6 +204,30 @@ public class NotificationShelf extends ActivatableNotificationView implements
}
}
/**
* @return whether to clip bottom of given view
*/
private boolean shouldClipBottom(ExpandableView view) {
final boolean showShelf = ((ShelfState) getViewState()).hasItemsInStableShelf;
if (showShelf) {
if (mAmbientState.isShadeOpening()) {
final float viewEnd = view.getTranslationY()
+ view.getActualHeight()
+ mPaddingBetweenElements;
final float finalShelfStart = mMaxLayoutHeight - getIntrinsicHeight();
// While the shade is opening, only clip view if it overlaps with shelf;
// otherwise leave view unclipped.
if (viewEnd < finalShelfStart) {
return false;
}
}
// Clip for scrolling.
return true;
}
// Don't clip since we have enough space to show all views.
return false;
}
/**
* Update the shelf appearance based on the other notifications around it. This transforms
* the icons from the notification area into the shelf.
@@ -345,7 +369,9 @@ public class NotificationShelf extends ActivatableNotificationView implements
clipTransientViews();
setClipTopAmount(clipTopAmount);
boolean isHidden = getViewState().hidden || clipTopAmount >= getIntrinsicHeight();
boolean isHidden = getViewState().hidden
|| clipTopAmount >= getIntrinsicHeight()
|| mAmbientState.isShadeOpening();
if (mShowNotificationShelf) {
setVisibility(isHidden ? View.INVISIBLE : View.VISIBLE);
}
@@ -468,7 +494,8 @@ public class NotificationShelf extends ActivatableNotificationView implements
} else {
shouldClipOwnTop = view.showingPulsing();
}
if (viewEnd > notificationClipEnd && !shouldClipOwnTop
if (shouldClipBottom(view)
&& viewEnd > notificationClipEnd && !shouldClipOwnTop
&& (mAmbientState.isShadeExpanded() || !isPinned)) {
int clipBottomAmount = (int) (viewEnd - notificationClipEnd);
if (isPinned) {