From 3b25cae9ffe5914939b13af7f9e3bd98f542ff14 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Fri, 30 Apr 2021 18:07:48 -0500 Subject: [PATCH] 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 --- .../notification/stack/StackScrollAlgorithm.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index 27ee13ab4eafc..591d3c0a7a5f6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -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)