Inline replace notification views when layout changes
Instead of going through a full remove / add when a notification
is updated with a different layout, only re-inflate the inner views.
Bug: 15869868
Change-Id: Ie18c431e7b3e2a6209d4a9b6418b3150781a063f
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index c6000af..280bade 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -58,6 +58,23 @@
super(context, attrs);
}
+ /**
+ * Resets this view so it can be re-used for an updated notification.
+ */
+ public void reset() {
+ mRowMinHeight = 0;
+ mRowMaxHeight = 0;
+ mExpandable = false;
+ mHasUserChangedExpansion = false;
+ mUserLocked = false;
+ mShowingPublic = false;
+ mIsSystemExpanded = false;
+ mExpansionDisabled = false;
+ mPublicLayout.reset();
+ mPrivateLayout.reset();
+ mMaxExpandHeight = 0;
+ }
+
@Override
protected void onFinishInflate() {
super.onFinishInflate();
@@ -110,6 +127,7 @@
* @param userExpanded whether the user wants this notification to be expanded
*/
public void setUserExpanded(boolean userExpanded) {
+ if (userExpanded && !mExpandable) return;
mHasUserChangedExpansion = true;
mUserExpanded = userExpanded;
}