OSDN Git Service

Expanding first child in a group now if it's the only one
authorSelim Cinek <cinek@google.com>
Tue, 1 Mar 2016 03:57:35 +0000 (19:57 -0800)
committerSelim Cinek <cinek@google.com>
Tue, 1 Mar 2016 19:15:30 +0000 (19:15 +0000)
When expanding notifications, the first child is now expanded
if it's the only one in there.

Bug: 27419554
Change-Id: Icdadbb7036e4cd5964de4c2e96e6a8322052bc93

packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java

index 123a5c3..495aa7a 100644 (file)
@@ -262,10 +262,14 @@ public class NotificationChildrenContainer extends ViewGroup {
     }
 
     private void updateExpansionStates() {
-        // Let's make the first child expanded if the parent is
-        for (int i = 0; i < mChildren.size(); i++) {
+        if (mChildrenExpanded || mUserLocked) {
+            // we don't modify it the group is expanded or if we are expanding it
+            return;
+        }
+        int size = mChildren.size();
+        for (int i = 0; i < size; i++) {
             ExpandableNotificationRow child = mChildren.get(i);
-            child.setSystemChildExpanded(false);
+            child.setSystemChildExpanded(i == 0 && size == 1);
         }
     }
 
@@ -489,6 +493,7 @@ public class NotificationChildrenContainer extends ViewGroup {
 
     public void setChildrenExpanded(boolean childrenExpanded) {
         mChildrenExpanded = childrenExpanded;
+        updateExpansionStates();
     }
 
     public void setNotificationParent(ExpandableNotificationRow parent) {