Merge "Split shade motion: improve expansion timing"

This commit is contained in:
Christian Göllner
2022-01-28 11:09:22 +00:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 1 deletions

View File

@@ -369,6 +369,13 @@
<!-- The top margin of the panel that holds the list of notifications. -->
<dimen name="notification_panel_margin_top">0dp</dimen>
<!-- The minimum content height for the split shade NSSL.
It is used because if the height is too small, the expansion motion is too fast.
Note that the value of 256dp is more or less a random value and can be changed to tweak
the expansion motion.
-->
<dimen name="nssl_split_shade_min_content_height">256dp</dimen>
<!-- The bottom margin of the panel that holds the list of notifications. -->
<dimen name="notification_panel_margin_bottom">0dp</dimen>

View File

@@ -202,6 +202,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private int mBottomMargin;
private int mBottomInset = 0;
private float mQsExpansionFraction;
private final int mSplitShadeMinContentHeight;
/**
* The algorithm which calculates the properties for our children
@@ -583,6 +584,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
.getDefaultColor();
int minHeight = res.getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = res.getDimensionPixelSize(R.dimen.notification_max_height);
mSplitShadeMinContentHeight = res.getDimensionPixelSize(
R.dimen.nssl_split_shade_min_content_height);
mExpandHelper = new ExpandHelper(getContext(), mExpandHelperCallback,
minHeight, maxHeight);
mExpandHelper.setEventSource(this);
@@ -3925,7 +3928,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
@ShadeViewRefactor(RefactorComponent.COORDINATOR)
int getEmptyBottomMargin() {
return Math.max(mMaxLayoutHeight - mContentHeight, 0);
int contentHeight;
if (mShouldUseSplitNotificationShade) {
// When in split shade and there are no notifications, the height can be too low, as
// it is based on notifications bottom, which is lower on split shade.
// Here we prefer to use at least a minimum height defined for split shade.
// Otherwise the expansion motion is too fast.
contentHeight = Math.max(mSplitShadeMinContentHeight, mContentHeight);
} else {
contentHeight = mContentHeight;
}
return Math.max(mMaxLayoutHeight - contentHeight, 0);
}
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)