From a6c6bfb61ba14b0467b73082d591c834576cddf4 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 29 Oct 2015 16:27:08 -0700 Subject: [PATCH] Follow up CL for notification children change The CLs of the notification children change have been quite overlapping, so a few comments are addressed in this change. Bug: 24866646 Change-Id: If3cd029f5a97302fc33f3e2b6b6b147938ddcd3e --- .../ActivatableNotificationView.java | 2 +- .../statusbar/ExpandableNotificationRow.java | 36 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 147c3dbbf0666..6f8cd8c10c8bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -380,7 +380,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView updateBackgroundTint(); } - private void updateBackgroundTint() { + protected void updateBackgroundTint() { int color = getBgColor(); int rippleColor = getRippleColor(); if (color == mNormalColor) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 5f14bbfe895da..360390023df3a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -16,6 +16,7 @@ package com.android.systemui.statusbar; +import android.app.Notification; import android.content.Context; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.AnimationDrawable; @@ -103,7 +104,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private boolean mJustClicked; private NotificationData.Entry mEntry; private boolean mShowNoBackground; - private boolean mChildInGroup; private ExpandableNotificationRow mNotificationParent; public NotificationContentView getPrivateLayout() { @@ -218,7 +218,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } public boolean isChildInGroup() { - return mChildInGroup; + return mNotificationParent != null; } public ExpandableNotificationRow getNotificationParent() { @@ -229,12 +229,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { * @param isChildInGroup Is this notification now in a group * @param parent the new parent notification */ - public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) { - mChildInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup; - mNotificationParent = isChildInGroup ? parent : null; - mShowNoBackground = mChildInGroup && hasSameBgColor(parent); - mPrivateLayout.setIsChildInGroup(mShowNoBackground); - updateBackground(); + public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {; + boolean childInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup; + mNotificationParent = childInGroup ? parent : null; + mPrivateLayout.setIsChildInGroup(childInGroup); + updateNoBackgroundState(); } @Override @@ -663,7 +662,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } else { return Math.max(mRowMinHeight, mHeadsUpHeight); } - } else if (!inExpansionState || (mChildInGroup && !isGroupExpanded())) { + } else if (!inExpansionState || (isChildInGroup() && !isGroupExpanded())) { return getMinHeight(); } else { return getMaxExpandHeight(); @@ -929,6 +928,25 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mPublicLayout.setShowingLegacyBackground(showing); } + @Override + protected void updateBackgroundTint() { + super.updateBackgroundTint(); + updateNoBackgroundState(); + if (mIsSummaryWithChildren) { + List notificationChildren = + mChildrenContainer.getNotificationChildren(); + for (int i = 0; i < notificationChildren.size(); i++) { + ExpandableNotificationRow child = notificationChildren.get(i); + child.updateNoBackgroundState(); + } + } + } + + private void updateNoBackgroundState() { + mShowNoBackground = isChildInGroup() && hasSameBgColor(mNotificationParent); + updateBackground(); + } + public void setExpansionLogger(ExpansionLogger logger, String key) { mLogger = logger; mLoggingKey = key;