From f0c79e105bc6d8ead4dec7793f9a60b1350dd97d Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 14 May 2018 17:17:31 -0700 Subject: [PATCH] Keeping the header hidden while the hun is going away Previously we were showing the Hun header immediately again when the heads up times out, but we now also factor in if it's animating away. Test: add hun, click on it, header is still hidden Change-Id: I2e5714c9282f0dd76d17511485c002010be169bb Fixes: 77219603 --- .../phone/HeadsUpAppearanceController.java | 7 ++++--- .../stack/NotificationStackScrollLayout.java | 13 +++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java index 9ec56095b3938..06f3c508585a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java @@ -36,7 +36,7 @@ import java.util.function.Consumer; /** * Controls the appearance of heads up notifications in the icon area and the header itself. */ -class HeadsUpAppearanceController implements OnHeadsUpChangedListener, +public class HeadsUpAppearanceController implements OnHeadsUpChangedListener, DarkIconDispatcher.DarkReceiver { public static final int CONTENT_FADE_DURATION = 110; public static final int CONTENT_FADE_DELAY = 100; @@ -92,6 +92,7 @@ class HeadsUpAppearanceController implements OnHeadsUpChangedListener, panelView.setHeadsUpAppearanceController(this); mStackScroller.addOnExpandedHeightListener(mSetExpandedHeight); mStackScroller.addOnLayoutChangeListener(mStackScrollLayoutChangeListener); + mStackScroller.setHeadsUpAppearanceController(this); mClockView = clockView; mDarkIconDispatcher = Dependency.get(DarkIconDispatcher.class); mDarkIconDispatcher.addDarkReceiver(this); @@ -226,10 +227,10 @@ class HeadsUpAppearanceController implements OnHeadsUpChangedListener, }); } - private void updateHeader(NotificationData.Entry entry) { + public void updateHeader(NotificationData.Entry entry) { ExpandableNotificationRow row = entry.row; float headerVisibleAmount = 1.0f; - if (row.isPinned() || row == mTrackedChild) { + if (row.isPinned() || row.isHeadsUpAnimatingAway() || row == mTrackedChild) { headerVisibleAmount = mExpandFraction; } row.setHeaderVisibleAmount(headerVisibleAmount); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index eeaa6cb586810..3b3b4caeb291e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -99,6 +99,7 @@ import com.android.systemui.statusbar.notification.FakeShadowView; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.phone.DozeParameters; +import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.ScrimController; @@ -416,6 +417,7 @@ public class NotificationStackScrollLayout extends ViewGroup private int mAntiBurnInOffsetX; private ArrayList> mExpandedHeightListeners = new ArrayList<>(); private int mHeadsUpInset; + private HeadsUpAppearanceController mHeadsUpAppearanceController; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -3078,8 +3080,10 @@ public class NotificationStackScrollLayout extends ViewGroup @Override public void bindRow(ExpandableNotificationRow row) { - row.setHeadsUpAnimatingAwayListener(animatingAway - -> mRoundnessManager.onHeadsupAnimatingAwayChanged(row, animatingAway)); + row.setHeadsUpAnimatingAwayListener(animatingAway -> { + mRoundnessManager.onHeadsupAnimatingAwayChanged(row, animatingAway); + mHeadsUpAppearanceController.updateHeader(row.getEntry()); + }); } @Override @@ -4653,6 +4657,11 @@ public class NotificationStackScrollLayout extends ViewGroup mExpandedHeightListeners.remove(listener); } + public void setHeadsUpAppearanceController( + HeadsUpAppearanceController headsUpAppearanceController) { + mHeadsUpAppearanceController = headsUpAppearanceController; + } + /** * A listener that is notified when the empty space below the notifications is clicked on */