From 373a9983742b3d2370c36183aca3cde4614e6185 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 30 Nov 2010 12:03:59 -0500 Subject: When updating notifications, always reuse the last row. Ordinarily, changing the "when" slot when updating a Notification will move its expanded payload to the bottom of the notification panel's list. But if it's already at the bottom, this causes an unsightly out-then-in animation sequence. We now check for that exact situation. Bug: 3222274 Bug: 3162218 Change-Id: I8b643b3f8bce64e57a22bdbb06d92c196c2484c2 --- .../com/android/systemui/statusbar/tablet/TabletStatusBar.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index c55c87e..31311a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -496,7 +496,7 @@ public class TabletStatusBar extends StatusBar { final RemoteViews contentView = notification.notification.contentView; - if (false) { + if (DEBUG) { Slog.d(TAG, "old notification: when=" + oldNotification.notification.when + " ongoing=" + oldNotification.isOngoing() + " expanded=" + oldEntry.expanded @@ -508,7 +508,7 @@ public class TabletStatusBar extends StatusBar { // Can we just reapply the RemoteViews in place? If when didn't change, the order // didn't change. - if (notification.notification.when == oldNotification.notification.when + boolean orderUnchanged = (notification.notification.when == oldNotification.notification.when && notification.isOngoing() == oldNotification.isOngoing() && oldEntry.expanded != null && contentView != null @@ -516,7 +516,10 @@ public class TabletStatusBar extends StatusBar { && contentView.getPackage() != null && oldContentView.getPackage() != null && oldContentView.getPackage().equals(contentView.getPackage()) - && oldContentView.getLayoutId() == contentView.getLayoutId()) { + && oldContentView.getLayoutId() == contentView.getLayoutId()); + ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent(); + boolean isLastAnyway = rowParent.indexOfChild(oldEntry.row) == rowParent.getChildCount() - 1; + if (orderUnchanged || isLastAnyway) { if (DEBUG) Slog.d(TAG, "reusing notification for key: " + key); oldEntry.notification = notification; try { -- cgit v1.1