From 6eb868a5e56716f5abc23ea3495a86c43a2e7555 Mon Sep 17 00:00:00 2001 From: felkachang Date: Thu, 26 Jul 2018 19:06:30 +0800 Subject: [PATCH] Fix the wrong number of icons in shelf for RTL In NotificationShelf, mShelfIcons.setActualLayoutWidth's parameter comes from the return value of mCollapsedIcons.getFinalTranslationX. both of mCollapsedIcons.getFinalTranslationX and 'start' has the operator '+' and mCollapsedIcons.getFinalTranslationX should return the value that doesn't translate to the xTranslation. The root cause is that mCollapsedIcons.getFinalTranslationX should return the 'start tranlation' rather xTranslation. The solution is to make the mixing usage between 'start tranlation' and xTranslation to be seperated. And, 'start translation' is called xAnchorStart. To get the 'start translation' by counting (getWidth() - mLastVisibleIconState.xTranslation - iconWidth) to get xAnchorStart. Change-Id: Iec6893446ba161cce50e9b018e43f94782b91f11 Merged-In: Iec6893446ba161cce50e9b018e43f94782b91f11 Fixes: 111861498 Test: manual test (cherry picked from commit b623343f1324b0d1c5baa01260d789c371ad0849) --- .../systemui/statusbar/phone/NotificationIconContainer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java index 5dee2a6000c7f..753cac5da5581 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java @@ -536,7 +536,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { return 0; } - int translation = (int) (mLastVisibleIconState.xTranslation + mIconSize); + int translation = (int) (isLayoutRtl() ? getWidth() - mLastVisibleIconState.xTranslation + : mLastVisibleIconState.xTranslation + mIconSize); // There's a chance that last translation goes beyond the edge maybe return Math.min(getWidth(), translation); }