From 246f1c9206819ed516711029234517f08d46fb18 Mon Sep 17 00:00:00 2001 From: fbaron Date: Thu, 29 Jun 2023 16:40:50 -0700 Subject: [PATCH] Fix pageindicator for RTL mode Fix: 288981846 Test: Verify that in RTL the page indicator dots and the selected page dot align Flag: no flag Change-Id: I103b27c936e59b66ce5a55e1e197cfce594d72d5 --- .../launcher3/pageindicators/PageIndicatorDots.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java index b2c64b3a0d..073e5234f9 100644 --- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java +++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java @@ -381,7 +381,9 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator // Draw all page indicators; float circleGap = mCircleGap; - float startX = (getWidth() - (mNumPages * circleGap) + mDotRadius) / 2; + float startX = ((float) getWidth() / 2) + - (mCircleGap * (((float) mNumPages - 1) / 2)) + - mDotRadius; float x = startX + mDotRadius; float y = getHeight() / 2; @@ -420,9 +422,9 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator float startCircle = (int) mCurrentPosition; float delta = mCurrentPosition - startCircle; float diameter = 2 * mDotRadius; - float startX; - - startX = ((getWidth() - (mNumPages * mCircleGap) + mDotRadius) / 2); + float startX = ((float) getWidth() / 2) + - (mCircleGap * (((float) mNumPages - 1) / 2)) + - mDotRadius; sTempRect.top = (getHeight() * 0.5f) - mDotRadius; sTempRect.bottom = (getHeight() * 0.5f) + mDotRadius; sTempRect.left = startX + (startCircle * mCircleGap);