diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index b5fb935a0d1c9..018ae82b34135 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -152,11 +152,11 @@ 16dp - 24dp + 16dp - 24dp + 16dp @@ -166,7 +166,7 @@ content end margin. Keep equal to (notification_content_picture_margin + notification_content_margin_end)! --> - 80dp + 72dp 16dp diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index d4de816f318e7..7a3da15d42b55 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -102,10 +102,7 @@ 188dp - 8dp - - - @dimen/notification_lockscreen_side_paddings + 4dp @@ -121,7 +118,7 @@ 40dp - 21dp + 13dp @@ -226,7 +223,7 @@ 48dp - 8dp + @dimen/notification_side_paddings 124dp diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml index dd31365a2c391..fed97c57ce09c 100644 --- a/packages/SystemUI/res/values/ids.xml +++ b/packages/SystemUI/res/values/ids.xml @@ -86,10 +86,6 @@ - - - - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index ff0357a3e2c0e..e59c703afdd8b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -930,13 +930,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView return calculateBgColor(true /* withTint */, true /* withOverRide */); } - @Override - public void setCurrentSidePaddings(float currentSidePaddings) { - super.setCurrentSidePaddings(currentSidePaddings); - mBackgroundNormal.setCurrentSidePaddings(currentSidePaddings); - mBackgroundDimmed.setCurrentSidePaddings(currentSidePaddings); - } - @Override protected boolean childNeedsClipping(View child) { if (child instanceof NotificationBackgroundView && isClippingNeeded()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index f53eb4897ad52..d1e6dcc9e4802 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -2362,16 +2362,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView NotificationContentView contentView = (NotificationContentView) child; if (isClippingNeeded()) { return true; - } else if (!hasNoRoundingAndNoPadding() && contentView.shouldClipToSidePaddings()) { + } else if (!hasNoRounding() && contentView.shouldClipToRounding()) { return true; } } else if (child == mChildrenContainer) { - if (isClippingNeeded() || ((isGroupExpanded() || isGroupExpansionChanging()) - && getClipBottomAmount() != 0.0f && getCurrentBottomRoundness() != 0.0f)) { + if (isClippingNeeded() || !hasNoRounding()) { return true; } } else if (child instanceof NotificationGuts) { - return !hasNoRoundingAndNoPadding(); + return !hasNoRounding(); } return super.childNeedsClipping(child); } @@ -2401,9 +2400,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView return super.getCustomClipPath(child); } - private boolean hasNoRoundingAndNoPadding() { - return mCurrentSidePaddings == 0 && getCurrentBottomRoundness() == 0.0f - && getCurrentTopRoundness() == 0.0f; + private boolean hasNoRounding() { + return getCurrentBottomRoundness() == 0.0f && getCurrentTopRoundness() == 0.0f; } public boolean isShowingAmbient() { @@ -2418,20 +2416,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } } - @Override - public void setCurrentSidePaddings(float currentSidePaddings) { - if (mIsSummaryWithChildren) { - List notificationChildren = - mChildrenContainer.getNotificationChildren(); - int size = notificationChildren.size(); - for (int i = 0; i < size; i++) { - ExpandableNotificationRow row = notificationChildren.get(i); - row.setCurrentSidePaddings(currentSidePaddings); - } - } - super.setCurrentSidePaddings(currentSidePaddings); - } - public static class NotificationViewState extends ExpandableViewState { private final StackScrollState mOverallState; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java index db19d2f0cac9a..8a3645affcd50 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java @@ -69,7 +69,6 @@ public abstract class ExpandableOutlineView extends ExpandableView { private float mBottomRoundness; private float mTopRoundness; private int mBackgroundTop; - protected int mCurrentSidePaddings; /** * {@code true} if the children views of the {@link ExpandableOutlineView} are translated when @@ -83,9 +82,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { if (!mCustomOutline && mCurrentTopRoundness == 0.0f && mCurrentBottomRoundness == 0.0f && !mAlwaysRoundBothCorners) { int translation = mShouldTranslateContents ? (int) getTranslation() : 0; - int left = Math.max(translation + mCurrentSidePaddings, mCurrentSidePaddings); + int left = Math.max(translation, 0); int top = mClipTopAmount + mBackgroundTop; - int right = getWidth() - mCurrentSidePaddings + Math.min(translation, 0); + int right = getWidth() + Math.min(translation, 0); int bottom = Math.max(getActualHeight() - mClipBottomAmount, top); outline.setRect(left, top, right, bottom); } else { @@ -115,9 +114,9 @@ public abstract class ExpandableOutlineView extends ExpandableView { if (!mCustomOutline) { int translation = mShouldTranslateContents && !ignoreTranslation ? (int) getTranslation() : 0; - left = Math.max(translation + mCurrentSidePaddings, mCurrentSidePaddings); + left = Math.max(translation, 0); top = mClipTopAmount + mBackgroundTop; - right = getWidth() - mCurrentSidePaddings + Math.min(translation, 0); + right = getWidth() + Math.min(translation, 0); bottom = Math.max(getActualHeight(), top); int intersectBottom = Math.max(getActualHeight() - mClipBottomAmount, top); if (bottom != intersectBottom) { @@ -135,8 +134,6 @@ public abstract class ExpandableOutlineView extends ExpandableView { top = mOutlineRect.top; right = mOutlineRect.right; bottom = mOutlineRect.bottom; - left = Math.max(mCurrentSidePaddings, left); - right = Math.min(getWidth() - mCurrentSidePaddings, right); } height = bottom - top; if (height == 0) { @@ -162,13 +159,6 @@ public abstract class ExpandableOutlineView extends ExpandableView { return roundedRectPath; } - protected Path getRoundedRectPath(int left, int top, int right, int bottom, float topRoundness, - float bottomRoundness) { - getRoundedRectPath(left, top, right, bottom, topRoundness, bottomRoundness, - mTmpPath); - return mTmpPath; - } - private void getRoundedRectPath(int left, int top, int right, int bottom, float topRoundness, float bottomRoundness, Path outPath) { outPath.reset(); @@ -395,10 +385,4 @@ public abstract class ExpandableOutlineView extends ExpandableView { public Path getCustomClipPath(View child) { return null; } - - public void setCurrentSidePaddings(float currentSidePaddings) { - mCurrentSidePaddings = (int) currentSidePaddings; - invalidateOutline(); - invalidate(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java index 68cf51c04d4b9..45b35d014e705 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationBackgroundView.java @@ -41,7 +41,6 @@ public class NotificationBackgroundView extends View { private int mClipBottomAmount; private int mTintColor; private float[] mCornerRadii = new float[8]; - private int mCurrentSidePaddings; private boolean mBottomIsRounded; private int mBackgroundTop; private boolean mBottomAmountClips = true; @@ -68,8 +67,7 @@ public class NotificationBackgroundView extends View { if (mBottomIsRounded && mBottomAmountClips) { bottom -= mClipBottomAmount; } - drawable.setBounds(mCurrentSidePaddings, mBackgroundTop, - getWidth() - mCurrentSidePaddings, bottom); + drawable.setBounds(0, mBackgroundTop, getWidth(), bottom); drawable.draw(canvas); } } @@ -206,11 +204,6 @@ public class NotificationBackgroundView extends View { } } - public void setCurrentSidePaddings(float currentSidePaddings) { - mCurrentSidePaddings = (int) currentSidePaddings; - invalidate(); - } - public void setBackgroundTop(int backgroundTop) { mBackgroundTop = backgroundTop; invalidate(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java index 39c21313d378c..c73e548eaa17b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java @@ -136,7 +136,6 @@ public class NotificationContentView extends FrameLayout { private int mClipBottomAmount; private boolean mIsLowPriority; private boolean mIsContentExpandable; - private int mCustomViewSidePaddings; public NotificationContentView(Context context, AttributeSet attrs) { @@ -150,8 +149,6 @@ public class NotificationContentView extends FrameLayout { R.dimen.min_notification_layout_height); mNotificationContentMarginEnd = getResources().getDimensionPixelSize( com.android.internal.R.dimen.notification_content_margin_end); - mCustomViewSidePaddings = getResources().getDimensionPixelSize( - R.dimen.notification_content_custom_view_side_padding); } public void setHeights(int smallHeight, int headsUpMaxHeight, int maxHeight, @@ -391,22 +388,6 @@ public class NotificationContentView extends FrameLayout { mContractedWrapper = NotificationViewWrapper.wrap(getContext(), child, mContainingNotification); mContractedWrapper.setDark(mDark, false /* animate */, 0 /* delay */); - updateMargins(child); - } - - private void updateMargins(View child) { - if (child == null) { - return; - } - NotificationViewWrapper wrapper = getWrapperForView(child); - boolean isCustomView = wrapper instanceof NotificationCustomViewWrapper; - boolean needsMargins = isCustomView && - child.getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.P; - int padding = needsMargins ? mCustomViewSidePaddings : 0; - MarginLayoutParams layoutParams = (MarginLayoutParams) child.getLayoutParams(); - layoutParams.setMarginStart(padding); - layoutParams.setMarginEnd(padding); - child.setLayoutParams(layoutParams); } private NotificationViewWrapper getWrapperForView(View child) { @@ -456,7 +437,6 @@ public class NotificationContentView extends FrameLayout { mExpandedChild = child; mExpandedWrapper = NotificationViewWrapper.wrap(getContext(), child, mContainingNotification); - updateMargins(child); } public void setHeadsUpChild(View child) { @@ -490,7 +470,6 @@ public class NotificationContentView extends FrameLayout { mHeadsUpChild = child; mHeadsUpWrapper = NotificationViewWrapper.wrap(getContext(), child, mContainingNotification); - updateMargins(child); } public void setAmbientChild(View child) { @@ -1510,19 +1489,19 @@ public class NotificationContentView extends FrameLayout { return false; } - public boolean shouldClipToSidePaddings() { - boolean needsPaddings = shouldClipToSidePaddings(getVisibleType()); + public boolean shouldClipToRounding() { + boolean needsPaddings = shouldClipToRounding(getVisibleType()); if (mUserExpanding) { - needsPaddings |= shouldClipToSidePaddings(mTransformationStartVisibleType); + needsPaddings |= shouldClipToRounding(mTransformationStartVisibleType); } return needsPaddings; } - private boolean shouldClipToSidePaddings(int visibleType) { + private boolean shouldClipToRounding(int visibleType) { NotificationViewWrapper visibleWrapper = getVisibleWrapper(visibleType); if (visibleWrapper == null) { return false; } - return visibleWrapper.shouldClipToSidePaddings(); + return visibleWrapper.shouldClipToRounding(); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java index b2604fe07a59e..037eeb2d298bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationMenuRow.java @@ -176,8 +176,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl final Resources res = mContext.getResources(); mHorizSpaceForIcon = res.getDimensionPixelSize(R.dimen.notification_menu_icon_size); mVertSpaceForIcons = res.getDimensionPixelSize(R.dimen.notification_min_height); - mSidePadding = res.getDimensionPixelSize(R.dimen.notification_lockscreen_side_paddings); - mIconPadding = res.getDimensionPixelSize(R.dimen.notification_menu_icon_padding); mMenuItems.clear(); // Construct the menu items based on the notification if (mParent != null && mParent.getStatusBarNotification() != null) { @@ -498,8 +496,8 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl final int count = mMenuContainer.getChildCount(); for (int i = 0; i < count; i++) { final View v = mMenuContainer.getChildAt(i); - final float left = mSidePadding + i * mHorizSpaceForIcon; - final float right = mParent.getWidth() - (mHorizSpaceForIcon * (i + 1)) - mSidePadding; + final float left = i * mHorizSpaceForIcon; + final float right = mParent.getWidth() - (mHorizSpaceForIcon * (i + 1)); v.setX(showOnLeft ? left : right); } mOnLeft = showOnLeft; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java index 66682e4c54f28..0d22095690935 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationCustomViewWrapper.java @@ -38,7 +38,6 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper { private final Paint mGreyPaint = new Paint(); private boolean mIsLegacy; private int mLegacyColor; - private boolean mBeforeP; protected NotificationCustomViewWrapper(Context ctx, View view, ExpandableNotificationRow row) { super(ctx, view, row); @@ -119,15 +118,7 @@ public class NotificationCustomViewWrapper extends NotificationViewWrapper { } @Override - public boolean shouldClipToSidePaddings() { - // Before P we ensure that they are now drawing inside out content bounds since we inset - // the view. If they target P, then we don't have that guarantee and we need to be safe. - return !mBeforeP; - } - - @Override - public void onContentUpdated(ExpandableNotificationRow row) { - super.onContentUpdated(row); - mBeforeP = row.getEntry().targetSdk < Build.VERSION_CODES.P; + public boolean shouldClipToRounding() { + return true; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java index 060e6d653402d..d7c08cc89c25a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationMediaTemplateViewWrapper.java @@ -62,7 +62,7 @@ public class NotificationMediaTemplateViewWrapper extends NotificationTemplateVi } @Override - public boolean shouldClipToSidePaddings() { + public boolean shouldClipToRounding() { return true; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java index e07112f983e77..fd085d9c23913 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationTemplateViewWrapper.java @@ -265,11 +265,6 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp updateActionOffset(); } - @Override - public boolean shouldClipToSidePaddings() { - return mActionsContainer != null && mActionsContainer.getVisibility() != View.GONE; - } - private void updateActionOffset() { if (mActionsContainer != null) { // We should never push the actions higher than they are in the headsup view. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java index 8a767bb718b05..c71d604c91227 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationViewWrapper.java @@ -195,7 +195,7 @@ public abstract class NotificationViewWrapper implements TransformableView { return 0; } - public boolean shouldClipToSidePaddings() { + public boolean shouldClipToRounding() { return false; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 61dd22fc45716..751db1445299d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -309,7 +309,7 @@ public class NotificationPanelView extends PanelView implements mIndicationBottomPadding = getResources().getDimensionPixelSize( R.dimen.keyguard_indication_bottom_padding); mQsNotificationTopPadding = getResources().getDimensionPixelSize( - R.dimen.qs_notification_keyguard_padding); + R.dimen.qs_notification_padding); } public void updateResources() { @@ -451,7 +451,8 @@ public class NotificationPanelView extends PanelView implements boolean animate = mNotificationStackScroller.isAddOrRemoveAnimationPending(); int stackScrollerPadding; if (mStatusBarState != StatusBarState.KEYGUARD) { - stackScrollerPadding = (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight; + stackScrollerPadding = (mQs != null ? mQs.getHeader().getHeight() : 0) + mQsPeekHeight + + mQsNotificationTopPadding; mTopPaddingAdjustment = 0; } else { mClockPositionAlgorithm.setup( @@ -1381,7 +1382,7 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller.getIntrinsicPadding(), mQsMaxExpansionHeight + mQsNotificationTopPadding); } else { - return mQsExpansionHeight; + return mQsExpansionHeight + mQsNotificationTopPadding; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index fe39a894a0946..1d2baf14f3eba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -76,7 +76,6 @@ import com.android.systemui.statusbar.ActivatableNotificationView; import com.android.systemui.statusbar.DismissView; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; -import com.android.systemui.statusbar.ExpandableOutlineView; import com.android.systemui.statusbar.ExpandableView; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationGuts; @@ -84,10 +83,8 @@ import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.NotificationSnooze; import com.android.systemui.statusbar.StackScrollerDecorView; import com.android.systemui.statusbar.StatusBarState; -import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.notification.FakeShadowView; import com.android.systemui.statusbar.notification.NotificationUtils; -import com.android.systemui.statusbar.notification.PropertyAnimator; import com.android.systemui.statusbar.notification.VisibilityLocationProvider; import com.android.systemui.statusbar.phone.NotificationGroupManager; import com.android.systemui.statusbar.phone.StatusBar; @@ -123,16 +120,7 @@ public class NotificationStackScrollLayout extends ViewGroup /** * Sentinel value for no current active pointer. Used by {@link #mActivePointerId}. */ - private static final int INVALID_POINTER = -1; - private static final AnimatableProperty SIDE_PADDINGS = AnimatableProperty.from( - "sidePaddings", - NotificationStackScrollLayout::setCurrentSidePadding, - NotificationStackScrollLayout::getCurrentSidePadding, - R.id.side_padding_animator_tag, - R.id.side_padding_animator_end_tag, - R.id.side_padding_animator_start_tag); - private static final AnimationProperties SIDE_PADDING_PROPERTIES = - new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD); + private static final int INVALID_POINTER = -1;; private ExpandHelper mExpandHelper; private NotificationSwipeHelper mSwipeHelper; @@ -140,7 +128,6 @@ public class NotificationStackScrollLayout extends ViewGroup private int mCurrentStackHeight = Integer.MAX_VALUE; private final Paint mBackgroundPaint = new Paint(); private final Path mBackgroundPath = new Path(); - private final float[] mBackgroundRadii = new float[8]; private final boolean mShouldDrawNotificationBackground; private float mExpandedHeight; @@ -171,7 +158,6 @@ public class NotificationStackScrollLayout extends ViewGroup private int mTopPadding; private int mBottomMargin; private int mBottomInset = 0; - private float mCurrentSidePadding; /** * The algorithm which calculates the properties for our children @@ -399,7 +385,6 @@ public class NotificationStackScrollLayout extends ViewGroup private boolean mHeadsUpGoingAwayAnimationsAllowed = true; private Runnable mAnimateScroll = this::animateScroll; private int mCornerRadius; - private int mLockscreenSidePaddings; private int mSidePaddings; public NotificationStackScrollLayout(Context context) { @@ -437,8 +422,7 @@ public class NotificationStackScrollLayout extends ViewGroup res.getBoolean(R.bool.config_fadeNotificationsOnDismiss); updateWillNotDraw(); - mBackgroundPaint.setAntiAlias(true); - mBackgroundPaint.setStyle(Paint.Style.FILL); + mBackgroundPaint.setAntiAlias(true);; if (DEBUG) { mDebugPaint = new Paint(); mDebugPaint.setColor(0xffff0000); @@ -486,7 +470,8 @@ public class NotificationStackScrollLayout extends ViewGroup protected void onDraw(Canvas canvas) { if (mShouldDrawNotificationBackground && !mAmbientState.isDark() && mCurrentBounds.top < mCurrentBounds.bottom) { - canvas.drawPath(mBackgroundPath, mBackgroundPaint); + canvas.drawRoundRect(mSidePaddings, mCurrentBounds.top, getWidth() - mSidePaddings, + mCurrentBounds.bottom, mCornerRadius, mCornerRadius, mBackgroundPaint); } if (DEBUG) { @@ -539,8 +524,7 @@ public class NotificationStackScrollLayout extends ViewGroup R.dimen.min_top_overscroll_to_qs); mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height); mBottomMargin = res.getDimensionPixelSize(R.dimen.notification_panel_margin_bottom); - mLockscreenSidePaddings = res.getDimensionPixelSize( - R.dimen.notification_lockscreen_side_paddings); + mSidePaddings = res.getDimensionPixelSize(R.dimen.notification_side_paddings); mMinInteractionHeight = res.getDimensionPixelSize( R.dimen.notification_min_interaction_height); mCornerRadius = res.getDimensionPixelSize( @@ -571,11 +555,15 @@ public class NotificationStackScrollLayout extends ViewGroup @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); + + int width = MeasureSpec.getSize(widthMeasureSpec); + int childWidthSpec = MeasureSpec.makeMeasureSpec(width - mSidePaddings * 2, + MeasureSpec.getMode(widthMeasureSpec)); // We need to measure all children even the GONE ones, such that the heights are calculated // correctly as they are used to calculate how many we can fit on the screen. final int size = getChildCount(); for (int i = 0; i < size; i++) { - measureChild(getChildAt(i), widthMeasureSpec, heightMeasureSpec); + measureChild(getChildAt(i), childWidthSpec, heightMeasureSpec); } } @@ -2242,31 +2230,9 @@ public class NotificationStackScrollLayout extends ViewGroup mScrimController.setExcludedBackgroundArea( mFadingOut || mParentNotFullyVisible || mAmbientState.isDark() || mIsClipped ? null : mCurrentBounds); - updateBackgroundPath(); invalidate(); } - private void updateBackgroundPath() { - mBackgroundPath.reset(); - float topRoundness = 0; - if (mFirstVisibleBackgroundChild != null) { - topRoundness = mFirstVisibleBackgroundChild.getCurrentBackgroundRadiusTop(); - } - topRoundness = onKeyguard() ? mCornerRadius : topRoundness; - float bottomRoundNess = mCornerRadius; - mBackgroundRadii[0] = topRoundness; - mBackgroundRadii[1] = topRoundness; - mBackgroundRadii[2] = topRoundness; - mBackgroundRadii[3] = topRoundness; - mBackgroundRadii[4] = bottomRoundNess; - mBackgroundRadii[5] = bottomRoundNess; - mBackgroundRadii[6] = bottomRoundNess; - mBackgroundRadii[7] = bottomRoundNess; - mBackgroundPath.addRoundRect(mCurrentSidePadding, mCurrentBounds.top, - getWidth() - mCurrentSidePadding, mCurrentBounds.bottom, mBackgroundRadii, - Path.Direction.CCW); - } - /** * Update the background bounds to the new desired bounds */ @@ -2279,8 +2245,8 @@ public class NotificationStackScrollLayout extends ViewGroup mBackgroundBounds.left = mTempInt2[0]; mBackgroundBounds.right = mTempInt2[0] + getWidth(); } - mBackgroundBounds.left += mCurrentSidePadding; - mBackgroundBounds.right -= mCurrentSidePadding; + mBackgroundBounds.left += mSidePaddings; + mBackgroundBounds.right -= mSidePaddings; if (!mIsExpanded) { mBackgroundBounds.top = 0; mBackgroundBounds.bottom = 0; @@ -2892,8 +2858,7 @@ public class NotificationStackScrollLayout extends ViewGroup private void applyRoundedNess() { if (mFirstVisibleBackgroundChild != null) { - mFirstVisibleBackgroundChild.setTopRoundness( - mStatusBarState == StatusBarState.KEYGUARD ? 1.0f : 0.0f, + mFirstVisibleBackgroundChild.setTopRoundness(1.0f, mFirstVisibleBackgroundChild.isShown() && !mChildrenToAddAnimated.contains(mFirstVisibleBackgroundChild)); } @@ -2902,7 +2867,6 @@ public class NotificationStackScrollLayout extends ViewGroup mLastVisibleBackgroundChild.isShown() && !mChildrenToAddAnimated.contains(mLastVisibleBackgroundChild)); } - updateBackgroundPath(); invalidate(); } @@ -2912,7 +2876,6 @@ public class NotificationStackScrollLayout extends ViewGroup generateAddAnimation(child, false /* fromMoreCard */); updateAnimationState(child); updateChronometerForChild(child); - updateCurrentSidePaddings(child); } private void updateHideSensitiveForChild(View child) { @@ -4359,43 +4322,6 @@ public class NotificationStackScrollLayout extends ViewGroup public void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; mAmbientState.setStatusBarState(statusBarState); - applyRoundedNess(); - updateSidePaddings(); - } - - private void updateSidePaddings() { - int sidePaddings = mStatusBarState == StatusBarState.KEYGUARD ? mLockscreenSidePaddings : 0; - if (sidePaddings != mSidePaddings) { - boolean animate = isShown(); - mSidePaddings = sidePaddings; - PropertyAnimator.setProperty(this, SIDE_PADDINGS, sidePaddings, - SIDE_PADDING_PROPERTIES, animate); - } - } - - protected void setCurrentSidePadding(float sidePadding) { - mCurrentSidePadding = sidePadding; - updateBackground(); - applySidePaddingsToChildren(); - } - - private void applySidePaddingsToChildren() { - for (int i = 0; i < getChildCount(); i++) { - View view = getChildAt(i); - updateCurrentSidePaddings(view); - } - } - - private void updateCurrentSidePaddings(View view) { - if (!(view instanceof ExpandableOutlineView)) { - return; - } - ExpandableOutlineView outlineView = (ExpandableOutlineView) view; - outlineView.setCurrentSidePaddings(mCurrentSidePadding); - } - - protected float getCurrentSidePadding() { - return mCurrentSidePadding; } public void setExpandingVelocity(float expandingVelocity) {