OSDN Git Service

SysUI: Reset background treatment when re-using Entries
authorChristoph Studer <chstuder@google.com>
Tue, 29 Jul 2014 20:57:21 +0000 (22:57 +0200)
committerChristoph Studer <chstuder@google.com>
Wed, 30 Jul 2014 11:40:24 +0000 (11:40 +0000)
Bug: 16220667
Change-Id: I8fd2770fa5ea554728eb8cd70ce4a6171e28ece5

packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java

index 944a407..4d7698a 100644 (file)
@@ -660,6 +660,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
         mOnActivatedListener = onActivatedListener;
     }
 
+    public void reset() {
+        setTintColor(0);
+        setShowingLegacyBackground(false);
+        setBelowSpeedBump(false);
+    }
+
     public interface OnActivatedListener {
         void onActivated(ActivatableNotificationView view);
         void onActivationReset(ActivatableNotificationView view);
index 48fc4ec..dff3f55 100644 (file)
@@ -1025,7 +1025,7 @@ public abstract class BaseStatusBar extends SystemUI implements
             hasUserChangedExpansion = row.hasUserChangedExpansion();
             userExpanded = row.isUserExpanded();
             userLocked = row.isUserLocked();
-            row.reset();
+            entry.reset();
             if (hasUserChangedExpansion) {
                 row.setUserExpanded(userExpanded);
             }
@@ -1369,10 +1369,6 @@ public abstract class BaseStatusBar extends SystemUI implements
         updateNotifications();
     }
 
-    private void addNotificationViews(StatusBarNotification notification, RankingMap ranking) {
-        addNotificationViews(createNotificationViews(notification), ranking);
-    }
-
     /**
      * @return The number of notifications we show on Keyguard.
      */
@@ -1615,6 +1611,13 @@ public abstract class BaseStatusBar extends SystemUI implements
                 } else {
                     if (DEBUG) Log.d(TAG, "rebuilding update in place for key: " + key);
                     oldEntry.notification = notification;
+                    final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(),
+                            notification.getUser(),
+                            notification.getNotification().icon,
+                            notification.getNotification().iconLevel,
+                            notification.getNotification().number,
+                            notification.getNotification().tickerText);
+                    oldEntry.icon.set(ic);
                     inflateViews(oldEntry, mStackScroller, wasHeadsUp);
                     updateNotifications();
                 }
index 3410834..e042a53 100644 (file)
@@ -62,7 +62,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     /**
      * Resets this view so it can be re-used for an updated notification.
      */
+    @Override
     public void reset() {
+        super.reset();
         mRowMinHeight = 0;
         mRowMaxHeight = 0;
         mExpandable = false;
index ed3ebf5..a1ab7ec 100644 (file)
@@ -72,6 +72,22 @@ public class NotificationData {
         public boolean hasInterrupted() {
             return interruption;
         }
+
+        /**
+         * Resets the notification entry to be re-used.
+         */
+        public void reset() {
+            // NOTE: Icon needs to be preserved for now.
+            // We should fix this at some point.
+            expanded = null;
+            expandedPublic = null;
+            expandedBig = null;
+            autoRedacted = false;
+            legacy = false;
+            if (row != null) {
+                row.reset();
+            }
+        }
     }
 
     private final ArrayList<Entry> mEntries = new ArrayList<Entry>();