Hide footer in place instead of scrolling it offscreen

Bug: 186479647
Test: open shade with shelf,
      scroll notifications all the way up to show footer,
      then scroll down => footer hides in place
Change-Id: If95b6f8682cc1d8980d6e2b9edf769fb55aad336
This commit is contained in:
Lyn Han
2021-04-30 18:07:48 -05:00
parent f5cded5a11
commit 3b25cae9ff

View File

@@ -399,10 +399,14 @@ public class StackScrollAlgorithm {
}
if (view instanceof FooterView) {
viewState.yTranslation = Math.min(viewState.yTranslation,
ambientState.getStackHeight());
// Hide footer if shelf is showing
viewState.hidden = algorithmState.firstViewInShelf != null;
final boolean isShelfShowing = algorithmState.firstViewInShelf != null;
final float footerEnd = viewState.yTranslation + view.getIntrinsicHeight();
final boolean noSpaceForFooter = footerEnd > ambientState.getStackHeight();
viewState.hidden = isShelfShowing
|| (!ambientState.isExpansionChanging() && noSpaceForFooter);
} else if (view != ambientState.getTrackedHeadsUpRow()) {
if (ambientState.isExpansionChanging()) {
// Show all views. Views below the shelf will later be clipped (essentially hidden)