From 3b6a3ecb25e6c7be2cea29f4a3c9f0a2aa2925aa Mon Sep 17 00:00:00 2001 From: Jay Aliomer Date: Thu, 24 Jun 2021 12:16:15 -0400 Subject: [PATCH] Notification footer shows when there are zero notifications Fixes: 191960604 Test: visual Change-Id: Ib4b41890b6a0eb7e9b445b64c30b500eebc1a52f --- .../statusbar/notification/row/FooterView.java | 9 +++++++++ .../notification/stack/StackScrollAlgorithm.java | 15 +++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java index 8e24890c88121..86c90c7bcb2eb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java @@ -25,6 +25,7 @@ import android.view.View; import com.android.systemui.R; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; +import com.android.systemui.statusbar.notification.stack.ViewState; public class FooterView extends StackScrollerDecorView { private final int mClearAllTopPadding; @@ -121,6 +122,14 @@ public class FooterView extends StackScrollerDecorView { */ public boolean hideContent; + @Override + public void copyFrom(ViewState viewState) { + super.copyFrom(viewState); + if (viewState instanceof FooterViewState) { + hideContent = ((FooterViewState) viewState).hideContent; + } + } + @Override public void applyToView(View view) { super.applyToView(view); 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 add6fda4f8b98..3fc8b8d9aef11 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,12 +399,15 @@ public class StackScrollAlgorithm { if (view instanceof FooterView) { final boolean shadeClosed = !ambientState.isShadeExpanded(); final boolean isShelfShowing = algorithmState.firstViewInShelf != null; - - final float footerEnd = algorithmState.mCurrentExpandedYPosition - + view.getIntrinsicHeight(); - final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight(); - ((FooterView.FooterViewState) viewState).hideContent = - shadeClosed || isShelfShowing || noSpaceForFooter; + if (shadeClosed) { + viewState.hidden = true; + } else { + final float footerEnd = algorithmState.mCurrentExpandedYPosition + + view.getIntrinsicHeight(); + final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight(); + ((FooterView.FooterViewState) viewState).hideContent = + isShelfShowing || noSpaceForFooter; + } } else { if (view != ambientState.getTrackedHeadsUpRow()) { if (ambientState.isExpansionChanging()) {