summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author omarmt <omarmt@google.com> 2022-12-06 20:35:12 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-12-06 20:35:12 +0000
commit83159404c5924a3cc826ec1adcdd213e416d5909 (patch)
tree59d25bfa60144327d1c7a2cf8bea8ad1edb7ce2e
parentf308e211fa6ea1f21114a64fcd68bac36ba28066 (diff)
parent41fa9e4e38814d01f1c6e7e7b5b2110acd066267 (diff)
Invalidate NotificationChildrenContainer whenever NotificationHeaderViewWrapper.applyRoundnessAndInvalidate() am: 3e69219a37 am: 41fa9e4e38
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20582020 Change-Id: I11d9efc97569f245dba9bcdd953cc77de4e1f1d0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java10
2 files changed, 35 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java
index 87a9098579a6..1f664cb16179 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java
@@ -71,6 +71,8 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
private View mFeedbackIcon;
private boolean mIsLowPriority;
private boolean mTransformLowPriorityTitle;
+ private boolean mUseRoundnessSourceTypes;
+ private RoundnessChangedListener mRoundnessChangedListener;
protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
super(ctx, view, row);
@@ -117,6 +119,20 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
return mRoundableState;
}
+ @Override
+ public void applyRoundnessAndInvalidate() {
+ if (mUseRoundnessSourceTypes && mRoundnessChangedListener != null) {
+ // We cannot apply the rounded corner to this View, so our parents (in drawChild()) will
+ // clip our canvas. So we should invalidate our parent.
+ mRoundnessChangedListener.applyRoundnessAndInvalidate();
+ }
+ Roundable.super.applyRoundnessAndInvalidate();
+ }
+
+ public void setOnRoundnessChangedListener(RoundnessChangedListener listener) {
+ mRoundnessChangedListener = listener;
+ }
+
protected void resolveHeaderViews() {
mIcon = mView.findViewById(com.android.internal.R.id.icon);
mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
@@ -345,6 +361,15 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
}
/**
+ * Enable the support for rounded corner based on the SourceType
+ *
+ * @param enabled true if is supported
+ */
+ public void useRoundnessSourceTypes(boolean enabled) {
+ mUseRoundnessSourceTypes = enabled;
+ }
+
+ /**
* Interface that handle the Roundness changes
*/
public interface RoundnessChangedListener {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index 6350e49f64df..4a8e2dbb5334 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -396,6 +396,10 @@ public class NotificationChildrenContainer extends ViewGroup
getContext(),
mNotificationHeader,
mContainingNotification);
+ mNotificationHeaderWrapper.useRoundnessSourceTypes(mUseRoundnessSourceTypes);
+ if (mUseRoundnessSourceTypes) {
+ mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
+ }
addView(mNotificationHeader, 0);
invalidate();
} else {
@@ -433,6 +437,12 @@ public class NotificationChildrenContainer extends ViewGroup
getContext(),
mNotificationHeaderLowPriority,
mContainingNotification);
+ mNotificationHeaderWrapperLowPriority.useRoundnessSourceTypes(
+ mUseRoundnessSourceTypes
+ );
+ if (mUseRoundnessSourceTypes) {
+ mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
+ }
addView(mNotificationHeaderLowPriority, 0);
invalidate();
} else {