Loading core/java/android/view/NotificationHeaderView.java +36 −4 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public class NotificationHeaderView extends ViewGroup { private boolean mExpanded; private boolean mShowExpandButtonAtEnd; private boolean mShowWorkBadgeAtEnd; private int mHeaderTextMarginEnd; private Drawable mBackground; private boolean mEntireHeaderClickable; private boolean mExpandOnlyOnButton; Loading Loading @@ -133,7 +134,8 @@ public class NotificationHeaderView extends ViewGroup { MeasureSpec.AT_MOST); int wrapContentHeightSpec = MeasureSpec.makeMeasureSpec(givenHeight, MeasureSpec.AT_MOST); int totalWidth = getPaddingStart() + getPaddingEnd(); int totalWidth = getPaddingStart(); int iconWidth = getPaddingEnd(); for (int i = 0; i < getChildCount(); i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { Loading @@ -146,10 +148,19 @@ public class NotificationHeaderView extends ViewGroup { int childHeightSpec = getChildMeasureSpec(wrapContentHeightSpec, lp.topMargin + lp.bottomMargin, lp.height); child.measure(childWidthSpec, childHeightSpec); if ((child == mExpandButton && mShowExpandButtonAtEnd) || child == mProfileBadge || child == mAppOps) { iconWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth(); } else { totalWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth(); } if (totalWidth > givenWidth) { int overFlow = totalWidth - givenWidth; } // Ensure that there is at least enough space for the icons int endMargin = Math.max(mHeaderTextMarginEnd, iconWidth); if (totalWidth > givenWidth - endMargin) { int overFlow = totalWidth - givenWidth + endMargin; // We are overflowing, lets shrink the app name first overFlow = shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mAppName, mChildMinWidth); Loading @@ -161,6 +172,7 @@ public class NotificationHeaderView extends ViewGroup { shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mSecondaryHeaderText, 0); } totalWidth += getPaddingEnd(); mTotalWidth = Math.min(totalWidth, givenWidth); setMeasuredDimension(givenWidth, givenHeight); } Loading Loading @@ -383,6 +395,26 @@ public class NotificationHeaderView extends ViewGroup { return mIcon; } /** * Sets the margin end for the text portion of the header, excluding right-aligned elements * @param headerTextMarginEnd margin size */ @RemotableViewMethod public void setHeaderTextMarginEnd(int headerTextMarginEnd) { if (mHeaderTextMarginEnd != headerTextMarginEnd) { mHeaderTextMarginEnd = headerTextMarginEnd; requestLayout(); } } /** * Get the current margin end value for the header text * @return margin size */ public int getHeaderTextMarginEnd() { return mHeaderTextMarginEnd; } public class HeaderTouchListener implements View.OnTouchListener { private final ArrayList<Rect> mTouchRects = new ArrayList<>(); Loading core/java/com/android/internal/widget/MediaNotificationView.java +10 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.widget; import android.annotation.Nullable; import android.content.Context; import android.util.AttributeSet; import android.view.NotificationHeaderView; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; Loading @@ -37,7 +38,7 @@ public class MediaNotificationView extends FrameLayout { private final int mNotificationContentImageMarginEnd; private ImageView mRightIcon; private View mActions; private View mHeader; private NotificationHeaderView mHeader; private View mMainColumn; private View mMediaContent; private int mImagePushIn; Loading Loading @@ -94,7 +95,14 @@ public class MediaNotificationView extends FrameLayout { mMainColumn.setLayoutParams(params); reMeasure = true; } int headerMarginEnd = size + imageEndMargin; // margin for the entire header line int headerMarginEnd = imageEndMargin; // margin for the header text (not including the expand button and other icons) int headerTextMarginEnd = size + imageEndMargin; if (headerTextMarginEnd != mHeader.getHeaderTextMarginEnd()) { mHeader.setHeaderTextMarginEnd(headerTextMarginEnd); reMeasure = true; } params = (MarginLayoutParams) mHeader.getLayoutParams(); if (params.getMarginEnd() != headerMarginEnd) { params.setMarginEnd(headerMarginEnd); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +4 −16 Original line number Diff line number Diff line Loading @@ -328,22 +328,10 @@ public class NotificationContentView extends FrameLayout { if (mExpandedChild != null && mExpandedWrapper.getNotificationHeader() != null) { NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader(); int expandedSize = expandedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd(); int collapsedSize = contractedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd(); if (expandedSize != collapsedSize) { int paddingEnd = contractedHeader.getMeasuredWidth() - expandedSize; contractedHeader.setPadding( contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom()); contractedHeader.setShowWorkBadgeAtEnd(true); int headerTextMargin = expandedHeader.getHeaderTextMarginEnd(); if (headerTextMargin != contractedHeader.getHeaderTextMarginEnd()) { contractedHeader.setHeaderTextMarginEnd(headerTextMargin); return true; } } else { Loading Loading
core/java/android/view/NotificationHeaderView.java +36 −4 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ public class NotificationHeaderView extends ViewGroup { private boolean mExpanded; private boolean mShowExpandButtonAtEnd; private boolean mShowWorkBadgeAtEnd; private int mHeaderTextMarginEnd; private Drawable mBackground; private boolean mEntireHeaderClickable; private boolean mExpandOnlyOnButton; Loading Loading @@ -133,7 +134,8 @@ public class NotificationHeaderView extends ViewGroup { MeasureSpec.AT_MOST); int wrapContentHeightSpec = MeasureSpec.makeMeasureSpec(givenHeight, MeasureSpec.AT_MOST); int totalWidth = getPaddingStart() + getPaddingEnd(); int totalWidth = getPaddingStart(); int iconWidth = getPaddingEnd(); for (int i = 0; i < getChildCount(); i++) { final View child = getChildAt(i); if (child.getVisibility() == GONE) { Loading @@ -146,10 +148,19 @@ public class NotificationHeaderView extends ViewGroup { int childHeightSpec = getChildMeasureSpec(wrapContentHeightSpec, lp.topMargin + lp.bottomMargin, lp.height); child.measure(childWidthSpec, childHeightSpec); if ((child == mExpandButton && mShowExpandButtonAtEnd) || child == mProfileBadge || child == mAppOps) { iconWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth(); } else { totalWidth += lp.leftMargin + lp.rightMargin + child.getMeasuredWidth(); } if (totalWidth > givenWidth) { int overFlow = totalWidth - givenWidth; } // Ensure that there is at least enough space for the icons int endMargin = Math.max(mHeaderTextMarginEnd, iconWidth); if (totalWidth > givenWidth - endMargin) { int overFlow = totalWidth - givenWidth + endMargin; // We are overflowing, lets shrink the app name first overFlow = shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mAppName, mChildMinWidth); Loading @@ -161,6 +172,7 @@ public class NotificationHeaderView extends ViewGroup { shrinkViewForOverflow(wrapContentHeightSpec, overFlow, mSecondaryHeaderText, 0); } totalWidth += getPaddingEnd(); mTotalWidth = Math.min(totalWidth, givenWidth); setMeasuredDimension(givenWidth, givenHeight); } Loading Loading @@ -383,6 +395,26 @@ public class NotificationHeaderView extends ViewGroup { return mIcon; } /** * Sets the margin end for the text portion of the header, excluding right-aligned elements * @param headerTextMarginEnd margin size */ @RemotableViewMethod public void setHeaderTextMarginEnd(int headerTextMarginEnd) { if (mHeaderTextMarginEnd != headerTextMarginEnd) { mHeaderTextMarginEnd = headerTextMarginEnd; requestLayout(); } } /** * Get the current margin end value for the header text * @return margin size */ public int getHeaderTextMarginEnd() { return mHeaderTextMarginEnd; } public class HeaderTouchListener implements View.OnTouchListener { private final ArrayList<Rect> mTouchRects = new ArrayList<>(); Loading
core/java/com/android/internal/widget/MediaNotificationView.java +10 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.internal.widget; import android.annotation.Nullable; import android.content.Context; import android.util.AttributeSet; import android.view.NotificationHeaderView; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; Loading @@ -37,7 +38,7 @@ public class MediaNotificationView extends FrameLayout { private final int mNotificationContentImageMarginEnd; private ImageView mRightIcon; private View mActions; private View mHeader; private NotificationHeaderView mHeader; private View mMainColumn; private View mMediaContent; private int mImagePushIn; Loading Loading @@ -94,7 +95,14 @@ public class MediaNotificationView extends FrameLayout { mMainColumn.setLayoutParams(params); reMeasure = true; } int headerMarginEnd = size + imageEndMargin; // margin for the entire header line int headerMarginEnd = imageEndMargin; // margin for the header text (not including the expand button and other icons) int headerTextMarginEnd = size + imageEndMargin; if (headerTextMarginEnd != mHeader.getHeaderTextMarginEnd()) { mHeader.setHeaderTextMarginEnd(headerTextMarginEnd); reMeasure = true; } params = (MarginLayoutParams) mHeader.getLayoutParams(); if (params.getMarginEnd() != headerMarginEnd) { params.setMarginEnd(headerMarginEnd); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentView.java +4 −16 Original line number Diff line number Diff line Loading @@ -328,22 +328,10 @@ public class NotificationContentView extends FrameLayout { if (mExpandedChild != null && mExpandedWrapper.getNotificationHeader() != null) { NotificationHeaderView expandedHeader = mExpandedWrapper.getNotificationHeader(); int expandedSize = expandedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd(); int collapsedSize = contractedHeader.getMeasuredWidth() - expandedHeader.getPaddingEnd(); if (expandedSize != collapsedSize) { int paddingEnd = contractedHeader.getMeasuredWidth() - expandedSize; contractedHeader.setPadding( contractedHeader.isLayoutRtl() ? paddingEnd : contractedHeader.getPaddingLeft(), contractedHeader.getPaddingTop(), contractedHeader.isLayoutRtl() ? contractedHeader.getPaddingLeft() : paddingEnd, contractedHeader.getPaddingBottom()); contractedHeader.setShowWorkBadgeAtEnd(true); int headerTextMargin = expandedHeader.getHeaderTextMarginEnd(); if (headerTextMargin != contractedHeader.getHeaderTextMarginEnd()) { contractedHeader.setHeaderTextMarginEnd(headerTextMargin); return true; } } else { Loading