OSDN Git Service

Overflow number supports RTL layout
authorSelim Cinek <cinek@google.com>
Tue, 30 Aug 2016 18:28:19 +0000 (11:28 -0700)
committerSelim Cinek <cinek@google.com>
Sat, 10 Sep 2016 00:07:51 +0000 (17:07 -0700)
Fix overlapping issue of overflow number view in RTL layout.
And also, fit the width of overflow Single-line view to match_parent.

Change-Id: I436a3770c8a0001b7a577e3f726bb52cd978298e
Fixes: 31181327

packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java

index 9fd09d9..78e56c0 100644 (file)
@@ -205,7 +205,7 @@ public class NotificationContentView extends FrameLayout {
                     && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
                 singleLineWidthSpec = MeasureSpec.makeMeasureSpec(
                         width - mSingleLineWidthIndention + mSingleLineView.getPaddingEnd(),
-                        MeasureSpec.AT_MOST);
+                        MeasureSpec.EXACTLY);
             }
             mSingleLineView.measure(singleLineWidthSpec,
                     MeasureSpec.makeMeasureSpec(maxSize, MeasureSpec.AT_MOST));
index 3c9373b..d7920a9 100644 (file)
@@ -123,8 +123,10 @@ public class NotificationChildrenContainer extends ViewGroup {
             mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight);
         }
         if (mOverflowNumber != null) {
-            mOverflowNumber.layout(getWidth() - mOverflowNumber.getMeasuredWidth(), 0, getWidth(),
-                    mOverflowNumber.getMeasuredHeight());
+            boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
+            int left = (isRtl ? 0 : getWidth() - mOverflowNumber.getMeasuredWidth());
+            int right = left + mOverflowNumber.getMeasuredWidth();
+            mOverflowNumber.layout(left, 0, right, mOverflowNumber.getMeasuredHeight());
         }
         if (mNotificationHeader != null) {
             mNotificationHeader.layout(0, 0, mNotificationHeader.getMeasuredWidth(),