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
This commit is contained in:
Selim Cinek
2017-02-03 10:09:33 -08:00
parent 245090f060
commit f20254c6f9

View File

@@ -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;