Loading packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +7 −0 Original line number Diff line number Diff line Loading @@ -515,6 +515,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } @Override public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); mBackgroundNormal.setDistanceToTopRoundness(distanceToTopRoundness); mBackgroundDimmed.setDistanceToTopRoundness(distanceToTopRoundness); } /** * Set an override tint color that is used for the background. * Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +18 −0 Original line number Diff line number Diff line Loading @@ -2794,6 +2794,24 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } @Override public boolean topAmountNeedsClipping() { if (isGroupExpanded()) { return true; } if (isGroupExpansionChanging()) { return true; } if (getShowingLayout().shouldClipToRounding(true /* topRounded */, false /* bottomRounded */)) { return true; } if (mGuts != null && mGuts.getAlpha() != 0.0f) { return true; } return false; } @Override protected boolean childNeedsClipping(View child) { if (child instanceof NotificationContentView) { Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +17 −8 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { * it is moved. Otherwise, the translation is set on the {@code ExpandableOutlineView} itself. */ protected boolean mShouldTranslateContents; private boolean mClipRoundedToClipTopAmount; private boolean mTopAmountRounded; private float mDistanceToTopRoundness = -1; private float mExtraWidthForClipping; private int mMinimumHeightForClipping = 0; Loading @@ -85,7 +85,8 @@ public abstract class ExpandableOutlineView extends ExpandableView { @Override public void getOutline(View view, Outline outline) { if (!mCustomOutline && mCurrentTopRoundness == 0.0f && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners) { && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners && !mTopAmountRounded) { int translation = mShouldTranslateContents ? (int) getTranslation() : 0; int left = Math.max(translation, 0); int top = mClipTopAmount + mBackgroundTop; Loading Loading @@ -145,9 +146,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { return EMPTY_PATH; } float topRoundness = mAlwaysRoundBothCorners ? mOutlineRadius : mCurrentTopRoundness * mOutlineRadius; ? mOutlineRadius : getCurrentBackgroundRadiusTop(); float bottomRoundness = mAlwaysRoundBothCorners ? mOutlineRadius : mCurrentBottomRoundness * mOutlineRadius; ? mOutlineRadius : getCurrentBackgroundRadiusBottom(); if (topRoundness + bottomRoundness > height) { float overShoot = topRoundness + bottomRoundness - height; topRoundness -= overShoot * mCurrentTopRoundness Loading Loading @@ -203,7 +204,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { protected boolean drawChild(Canvas canvas, View child, long drawingTime) { canvas.save(); Path intersectPath = null; if (mClipRoundedToClipTopAmount) { if (mTopAmountRounded && topAmountNeedsClipping()) { int left = (int) (- mExtraWidthForClipping / 2.0f); int top = (int) (mClipTopAmount - mDistanceToTopRoundness); int right = getWidth() + (int) (mExtraWidthForClipping + left); Loading Loading @@ -248,9 +249,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); if (distanceToTopRoundness != mDistanceToTopRoundness) { mClipRoundedToClipTopAmount = distanceToTopRoundness >= 0; mTopAmountRounded = distanceToTopRoundness >= 0; mDistanceToTopRoundness = distanceToTopRoundness; invalidate(); applyRoundness(); } } Loading @@ -258,9 +259,12 @@ public abstract class ExpandableOutlineView extends ExpandableView { return false; } public boolean topAmountNeedsClipping() { return true; } protected boolean isClippingNeeded() { return mAlwaysRoundBothCorners || mCustomOutline || getTranslation() != 0 ; } private void initDimens() { Loading Loading @@ -296,6 +300,11 @@ public abstract class ExpandableOutlineView extends ExpandableView { } public float getCurrentBackgroundRadiusTop() { // If this view is top amount notification view, it should always has round corners on top. // It will be applied with applyRoundness() if (mTopAmountRounded) { return mOutlineRadius; } return mCurrentTopRoundness * mOutlineRadius; } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +23 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ public class NotificationBackgroundView extends View { private int mDrawableAlpha = 255; private boolean mIsPressedAllowed; private boolean mTopAmountRounded; private float mDistanceToTopRoundness; public NotificationBackgroundView(Context context, AttributeSet attrs) { super(context, attrs); mDontModifyCorners = getResources().getBoolean( Loading @@ -74,6 +77,7 @@ public class NotificationBackgroundView extends View { private void draw(Canvas canvas, Drawable drawable) { if (drawable != null) { int top = mBackgroundTop; int bottom = mActualHeight; if (mBottomIsRounded && mBottomAmountClips && !mExpandAnimationRunning) { bottom -= mClipBottomAmount; Loading @@ -84,7 +88,14 @@ public class NotificationBackgroundView extends View { left = (int) ((getWidth() - mActualWidth) / 2.0f); right = (int) (left + mActualWidth); } drawable.setBounds(left, mBackgroundTop, right, bottom); if (mTopAmountRounded) { int clipTop = (int) (mClipTopAmount - mDistanceToTopRoundness); top += clipTop; if (clipTop >= 0) { bottom += clipTop; } } drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); } } Loading Loading @@ -165,6 +176,14 @@ public class NotificationBackgroundView extends View { invalidate(); } public void setDistanceToTopRoundness(float distanceToTopRoundness) { if (distanceToTopRoundness != mDistanceToTopRoundness) { mTopAmountRounded = distanceToTopRoundness >= 0; mDistanceToTopRoundness = distanceToTopRoundness; invalidate(); } } @Override public boolean hasOverlappingRendering() { Loading Loading @@ -198,6 +217,9 @@ public class NotificationBackgroundView extends View { } public void setRoundness(float topRoundness, float bottomRoundNess) { if (topRoundness == mCornerRadii[0] && bottomRoundNess == mCornerRadii[4]) { return; } mBottomIsRounded = bottomRoundNess != 0.0f; mCornerRadii[0] = topRoundness; mCornerRadii[1] = topRoundness; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +7 −0 Original line number Diff line number Diff line Loading @@ -515,6 +515,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView } } @Override public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); mBackgroundNormal.setDistanceToTopRoundness(distanceToTopRoundness); mBackgroundDimmed.setDistanceToTopRoundness(distanceToTopRoundness); } /** * Set an override tint color that is used for the background. * Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +18 −0 Original line number Diff line number Diff line Loading @@ -2794,6 +2794,24 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } @Override public boolean topAmountNeedsClipping() { if (isGroupExpanded()) { return true; } if (isGroupExpansionChanging()) { return true; } if (getShowingLayout().shouldClipToRounding(true /* topRounded */, false /* bottomRounded */)) { return true; } if (mGuts != null && mGuts.getAlpha() != 0.0f) { return true; } return false; } @Override protected boolean childNeedsClipping(View child) { if (child instanceof NotificationContentView) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +17 −8 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { * it is moved. Otherwise, the translation is set on the {@code ExpandableOutlineView} itself. */ protected boolean mShouldTranslateContents; private boolean mClipRoundedToClipTopAmount; private boolean mTopAmountRounded; private float mDistanceToTopRoundness = -1; private float mExtraWidthForClipping; private int mMinimumHeightForClipping = 0; Loading @@ -85,7 +85,8 @@ public abstract class ExpandableOutlineView extends ExpandableView { @Override public void getOutline(View view, Outline outline) { if (!mCustomOutline && mCurrentTopRoundness == 0.0f && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners) { && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners && !mTopAmountRounded) { int translation = mShouldTranslateContents ? (int) getTranslation() : 0; int left = Math.max(translation, 0); int top = mClipTopAmount + mBackgroundTop; Loading Loading @@ -145,9 +146,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { return EMPTY_PATH; } float topRoundness = mAlwaysRoundBothCorners ? mOutlineRadius : mCurrentTopRoundness * mOutlineRadius; ? mOutlineRadius : getCurrentBackgroundRadiusTop(); float bottomRoundness = mAlwaysRoundBothCorners ? mOutlineRadius : mCurrentBottomRoundness * mOutlineRadius; ? mOutlineRadius : getCurrentBackgroundRadiusBottom(); if (topRoundness + bottomRoundness > height) { float overShoot = topRoundness + bottomRoundness - height; topRoundness -= overShoot * mCurrentTopRoundness Loading Loading @@ -203,7 +204,7 @@ public abstract class ExpandableOutlineView extends ExpandableView { protected boolean drawChild(Canvas canvas, View child, long drawingTime) { canvas.save(); Path intersectPath = null; if (mClipRoundedToClipTopAmount) { if (mTopAmountRounded && topAmountNeedsClipping()) { int left = (int) (- mExtraWidthForClipping / 2.0f); int top = (int) (mClipTopAmount - mDistanceToTopRoundness); int right = getWidth() + (int) (mExtraWidthForClipping + left); Loading Loading @@ -248,9 +249,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { public void setDistanceToTopRoundness(float distanceToTopRoundness) { super.setDistanceToTopRoundness(distanceToTopRoundness); if (distanceToTopRoundness != mDistanceToTopRoundness) { mClipRoundedToClipTopAmount = distanceToTopRoundness >= 0; mTopAmountRounded = distanceToTopRoundness >= 0; mDistanceToTopRoundness = distanceToTopRoundness; invalidate(); applyRoundness(); } } Loading @@ -258,9 +259,12 @@ public abstract class ExpandableOutlineView extends ExpandableView { return false; } public boolean topAmountNeedsClipping() { return true; } protected boolean isClippingNeeded() { return mAlwaysRoundBothCorners || mCustomOutline || getTranslation() != 0 ; } private void initDimens() { Loading Loading @@ -296,6 +300,11 @@ public abstract class ExpandableOutlineView extends ExpandableView { } public float getCurrentBackgroundRadiusTop() { // If this view is top amount notification view, it should always has round corners on top. // It will be applied with applyRoundness() if (mTopAmountRounded) { return mOutlineRadius; } return mCurrentTopRoundness * mOutlineRadius; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +23 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ public class NotificationBackgroundView extends View { private int mDrawableAlpha = 255; private boolean mIsPressedAllowed; private boolean mTopAmountRounded; private float mDistanceToTopRoundness; public NotificationBackgroundView(Context context, AttributeSet attrs) { super(context, attrs); mDontModifyCorners = getResources().getBoolean( Loading @@ -74,6 +77,7 @@ public class NotificationBackgroundView extends View { private void draw(Canvas canvas, Drawable drawable) { if (drawable != null) { int top = mBackgroundTop; int bottom = mActualHeight; if (mBottomIsRounded && mBottomAmountClips && !mExpandAnimationRunning) { bottom -= mClipBottomAmount; Loading @@ -84,7 +88,14 @@ public class NotificationBackgroundView extends View { left = (int) ((getWidth() - mActualWidth) / 2.0f); right = (int) (left + mActualWidth); } drawable.setBounds(left, mBackgroundTop, right, bottom); if (mTopAmountRounded) { int clipTop = (int) (mClipTopAmount - mDistanceToTopRoundness); top += clipTop; if (clipTop >= 0) { bottom += clipTop; } } drawable.setBounds(left, top, right, bottom); drawable.draw(canvas); } } Loading Loading @@ -165,6 +176,14 @@ public class NotificationBackgroundView extends View { invalidate(); } public void setDistanceToTopRoundness(float distanceToTopRoundness) { if (distanceToTopRoundness != mDistanceToTopRoundness) { mTopAmountRounded = distanceToTopRoundness >= 0; mDistanceToTopRoundness = distanceToTopRoundness; invalidate(); } } @Override public boolean hasOverlappingRendering() { Loading Loading @@ -198,6 +217,9 @@ public class NotificationBackgroundView extends View { } public void setRoundness(float topRoundness, float bottomRoundNess) { if (topRoundness == mCornerRadii[0] && bottomRoundNess == mCornerRadii[4]) { return; } mBottomIsRounded = bottomRoundNess != 0.0f; mCornerRadii[0] = topRoundness; mCornerRadii[1] = topRoundness; Loading