Invalidate NotificationChildrenContainer whenever NotificationHeaderViewWrapper.applyRoundnessAndInvalidate()
Test: manual test Bug: 257000427 Change-Id: I8ce4567adc89552338fa6729320849fcf0b3b41c
This commit is contained in:
@@ -71,6 +71,8 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
|
|||||||
private View mFeedbackIcon;
|
private View mFeedbackIcon;
|
||||||
private boolean mIsLowPriority;
|
private boolean mIsLowPriority;
|
||||||
private boolean mTransformLowPriorityTitle;
|
private boolean mTransformLowPriorityTitle;
|
||||||
|
private boolean mUseRoundnessSourceTypes;
|
||||||
|
private RoundnessChangedListener mRoundnessChangedListener;
|
||||||
|
|
||||||
protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
|
protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
|
||||||
super(ctx, view, row);
|
super(ctx, view, row);
|
||||||
@@ -117,6 +119,20 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper imple
|
|||||||
return mRoundableState;
|
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() {
|
protected void resolveHeaderViews() {
|
||||||
mIcon = mView.findViewById(com.android.internal.R.id.icon);
|
mIcon = mView.findViewById(com.android.internal.R.id.icon);
|
||||||
mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
|
mHeaderText = mView.findViewById(com.android.internal.R.id.header_text);
|
||||||
@@ -344,6 +360,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
|
* Interface that handle the Roundness changes
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -396,6 +396,10 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
getContext(),
|
getContext(),
|
||||||
mNotificationHeader,
|
mNotificationHeader,
|
||||||
mContainingNotification);
|
mContainingNotification);
|
||||||
|
mNotificationHeaderWrapper.useRoundnessSourceTypes(mUseRoundnessSourceTypes);
|
||||||
|
if (mUseRoundnessSourceTypes) {
|
||||||
|
mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
|
||||||
|
}
|
||||||
addView(mNotificationHeader, 0);
|
addView(mNotificationHeader, 0);
|
||||||
invalidate();
|
invalidate();
|
||||||
} else {
|
} else {
|
||||||
@@ -433,6 +437,12 @@ public class NotificationChildrenContainer extends ViewGroup
|
|||||||
getContext(),
|
getContext(),
|
||||||
mNotificationHeaderLowPriority,
|
mNotificationHeaderLowPriority,
|
||||||
mContainingNotification);
|
mContainingNotification);
|
||||||
|
mNotificationHeaderWrapperLowPriority.useRoundnessSourceTypes(
|
||||||
|
mUseRoundnessSourceTypes
|
||||||
|
);
|
||||||
|
if (mUseRoundnessSourceTypes) {
|
||||||
|
mNotificationHeaderWrapper.setOnRoundnessChangedListener(this::invalidate);
|
||||||
|
}
|
||||||
addView(mNotificationHeaderLowPriority, 0);
|
addView(mNotificationHeaderLowPriority, 0);
|
||||||
invalidate();
|
invalidate();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user