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
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index b2c64b3..073e523 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -381,7 +381,9 @@
// 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 @@
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);