From 938bdaa86eb54318bd45405ce4946204dd73f66a Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 18 Nov 2016 16:31:09 -0800 Subject: [PATCH] Fixed a bug where the last notification could be invisible / faded if the last notification was small, it was already fading out in the resting state. Test: add a small notification without text and title and have it as last notification in the shade. Observe that it's not faded out. Bug: 32437839 Change-Id: I4acd429e363185276fe1f472ecbeddae8f56e45a --- .../systemui/statusbar/NotificationShelf.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 43b66b27b437e..3cf8345a78407 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -218,7 +218,8 @@ public class NotificationShelf extends ActivatableNotificationView { } } updateNotificationClipHeight(row, notificationClipEnd); - float inShelfAmount = updateIconAppearance(row, iconState, icon, expandAmount); + float inShelfAmount = updateIconAppearance(row, iconState, icon, expandAmount, + isLastChild); numViewsInShelf += inShelfAmount; int ownColorUntinted = row.getBackgroundColorWithoutTint(); if (row.getTranslationY() >= getTranslationY() && mNotGoneIndex == -1) { @@ -271,10 +272,14 @@ public class NotificationShelf extends ActivatableNotificationView { */ private float updateIconAppearance(ExpandableNotificationRow row, NotificationIconContainer.IconState iconState, StatusBarIconView icon, - float expandAmount) { + float expandAmount, boolean isLastChild) { // Let calculate how much the view is in the shelf float viewStart = row.getTranslationY(); int transformHeight = row.getActualHeight() + mPaddingBetweenElements; + if (isLastChild) { + transformHeight = + Math.min(transformHeight, row.getMinHeight() - getIntrinsicHeight()); + } float viewEnd = viewStart + transformHeight; float iconAppearAmount; float yTranslation; @@ -312,6 +317,10 @@ public class NotificationShelf extends ActivatableNotificationView { float shelfIconPosition = getTranslationY() + icon.getTop(); shelfIconPosition += ((1.0f - icon.getIconScale()) * icon.getHeight()) / 2.0f; float transitionDistance = getIntrinsicHeight() * 1.5f; + if (isLastChild) { + transitionDistance = Math.min(transitionDistance, row.getMinHeight() + - getIntrinsicHeight()); + } float transformationStartPosition = getTranslationY() - transitionDistance; float transitionAmount = 0.0f; if (viewStart < transformationStartPosition