From f20254c6f90531858731be0c675680c10219c6dc Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 3 Feb 2017 10:09:33 -0800 Subject: [PATCH] Fixed weirdness about last icon in shelf The last icon in shelf could jump around and behave Erratically because of an optimization around it's transformation. If the maxShelfEnd changed non-continuously, for example With an expansion, the icon would jump-cut. Test: add a few notifications, while no shelf available, expand notification Before the last one, observe no jump-cut Change-Id: I4b05f340cb1715f7bf80f5e96582a56a6f62ce1b --- .../com/android/systemui/statusbar/NotificationShelf.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index e8e9d4ebec6f1..637f9a780a1fc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -388,12 +388,13 @@ public class NotificationShelf extends ActivatableNotificationView { View rowIcon = row.getNotificationIcon(); float notificationIconPosition = row.getTranslationY() + row.getContentTranslation(); - if (usingLinearInterpolation) { + boolean stayingInShelf = row.isInShelf() && !row.isTransformingIntoShelf(); + if (usingLinearInterpolation && !stayingInShelf) { // If we interpolate from the notification position, this might lead to a slightly // odd interpolation, since the notification position changes as well. Let's interpolate // from a fixed distance. We can only do this if we don't animate and the icon is // always in the interpolated positon. - notificationIconPosition = mMaxShelfEnd - getIntrinsicHeight() - iconTransformDistance; + notificationIconPosition = getTranslationY() - iconTransformDistance; } float notificationIconSize = 0.0f; int iconTopPadding; @@ -426,7 +427,7 @@ public class NotificationShelf extends ActivatableNotificationView { iconState.hidden = transitionAmount == 0.0f; iconState.alpha = alpha; iconState.yTranslation = iconYTranslation; - if (row.isInShelf() && !row.isTransformingIntoShelf()) { + if (stayingInShelf) { iconState.iconAppearAmount = 1.0f; iconState.alpha = 1.0f; iconState.scaleX = 1.0f;