Slight refactoring of notification groups
For the preparation of the bigger UI rewamp.
Bug: 24866646
Change-Id: Id5760ba6e5bae88c052bdd30ae47d9671a2a19c2
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 33f21ff..27401ab 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -97,6 +97,7 @@
private NotificationGroupManager mGroupManager;
private View mExpandButtonContainer;
private boolean mChildrenExpanded;
+ private boolean mIsSummaryWithChildren;
private NotificationChildrenContainer mChildrenContainer;
private ValueAnimator mChildExpandAnimator;
private float mChildrenExpandProgress;
@@ -115,6 +116,7 @@
private FalsingManager mFalsingManager;
private boolean mJustClicked;
+ private boolean mChildInGroup;
public NotificationContentView getPrivateLayout() {
return mPrivateLayout;
@@ -175,6 +177,7 @@
mStatusBarNotification = statusBarNotification;
updateVetoButton();
updateExpandButton();
+ onChildrenCountChanged();
}
public StatusBarNotification getStatusBarNotification() {
@@ -213,12 +216,33 @@
mChildrenContainerStub.inflate();
}
mChildrenContainer.addNotification(row, childIndex);
+ onChildrenCountChanged();
+ row.setIsChildInGroup(true, this);
}
public void removeChildNotification(ExpandableNotificationRow row) {
if (mChildrenContainer != null) {
mChildrenContainer.removeNotification(row);
}
+ onChildrenCountChanged();
+ row.setIsChildInGroup(false, null);
+ }
+
+ public boolean isChildInGroup() {
+ return mChildInGroup;
+ }
+
+ /**
+ * @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;
+ }
+
+ @Override
+ public boolean isSummaryWithChildren() {
+ return mIsSummaryWithChildren;
}
@Override
@@ -663,6 +687,15 @@
return BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && !mIsHeadsUp;
}
+ private void onChildrenCountChanged() {
+ mIsSummaryWithChildren = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS
+ && mGroupManager.hasGroupChildren(mStatusBarNotification);
+ if (mIsSummaryWithChildren && mChildrenContainer == null) {
+ mChildrenContainerStub.inflate();
+ }
+ updateChildrenVisibility(true);
+ }
+
/**
* Check whether the view state is currently expanded. This is given by the system in {@link
* #setSystemExpanded(boolean)} and can be overridden by user expansion or
@@ -696,15 +729,6 @@
mWasReset = false;
}
- @Override
- protected boolean isChildInvisible(View child) {
-
- // We don't want to layout the ChildrenContainer if this is a heads-up view, otherwise the
- // view will get too high and the shadows will be off.
- boolean isInvisibleChildContainer = child == mChildrenContainer && mIsHeadsUp;
- return super.isChildInvisible(child) || isInvisibleChildContainer;
- }
-
private void updateMaxHeights() {
int intrinsicBefore = getIntrinsicHeight();
View expandedChild = mPrivateLayout.getExpandedChild();
@@ -747,7 +771,8 @@
mPublicLayout.setAlpha(1f);
mPrivateLayout.setAlpha(1f);
mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
- mPrivateLayout.setVisibility(mShowingPublic ? View.INVISIBLE : View.VISIBLE);
+ mPrivateLayout.setVisibility(!mShowingPublic && !mIsSummaryWithChildren ? View.VISIBLE
+ : View.INVISIBLE);
} else {
animateShowingPublic(delay, duration);
}
@@ -945,6 +970,11 @@
}
@Override
+ protected boolean shouldLimitViewHeight() {
+ return !mIsSummaryWithChildren;
+ }
+
+ @Override
public void setClipTopAmount(int clipTopAmount) {
super.setClipTopAmount(clipTopAmount);
mPrivateLayout.setClipTopAmount(clipTopAmount);