diff options
| author | Gus Prevas <kprevas@google.com> | 2018-12-27 15:46:00 -0500 |
|---|---|---|
| committer | Gus Prevas <kprevas@google.com> | 2018-12-27 15:46:00 -0500 |
| commit | c79816b005f351037bdce95a8b803a277fdaf65e (patch) | |
| tree | 9c16ad665dba2a084bcbbee6ef897e80e2414cfd /core/java/android/view/NotificationHeaderView.java | |
| parent | ab1ad60ec8615b6d1d5a2950a25c738848635495 (diff) | |
Fixes NotificationHeaderView layout.
The layout method in NotificationHeaderView was incorrectly adding the
margins, width, etc. of views laid out on the right side to the position
it was tracking for views being laid out on the left side. This change
fixes that error.
Test: manual
Change-Id: I747b318c621e6cf518e0752020ca8909c36c2ed7
Fixes: 122036911
Diffstat (limited to 'core/java/android/view/NotificationHeaderView.java')
| -rw-r--r-- | core/java/android/view/NotificationHeaderView.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index 60eeeeaa77ff..f8d5014a29c9 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -195,12 +195,10 @@ public class NotificationHeaderView extends ViewGroup { } int childHeight = child.getMeasuredHeight(); MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams(); - left += params.getMarginStart(); - int right = left + child.getMeasuredWidth(); + int layoutLeft; + int layoutRight; int top = (int) (getPaddingTop() + (ownHeight - childHeight) / 2.0f); int bottom = top + childHeight; - int layoutLeft = left; - int layoutRight = right; if ((child == mExpandButton && mShowExpandButtonAtEnd) || child == mProfileBadge || child == mAppOps) { @@ -211,6 +209,12 @@ public class NotificationHeaderView extends ViewGroup { } layoutLeft = layoutRight - child.getMeasuredWidth(); end = layoutLeft - params.getMarginStart(); + } else { + left += params.getMarginStart(); + int right = left + child.getMeasuredWidth(); + layoutLeft = left; + layoutRight = right; + left = right + params.getMarginEnd(); } if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { int ltrLeft = layoutLeft; @@ -218,7 +222,6 @@ public class NotificationHeaderView extends ViewGroup { layoutRight = getWidth() - ltrLeft; } child.layout(layoutLeft, top, layoutRight, bottom); - left = right + params.getMarginEnd(); } updateTouchListener(); } |
