Make Width Calculation Exact

Bug: 394355070
Test: Verified locally that indicator dots are not cut off with 6 pages. See screen recording on https://buganizer.corp.google.com/issues/394355070#comment28
Flag: com.android.launcher3.enable_launcher_visual_refresh
Change-Id: I5b0ac0441201e8dafcba10ff52ac24e1821815b9
This commit is contained in:
Stefan Andonian
2025-04-15 11:09:44 -07:00
parent 4753b6e83e
commit e0dffed77b
@@ -427,7 +427,10 @@ public class PageIndicatorDots extends View implements Insettable, PageIndicator
// Add extra spacing of mDotRadius on all sides so than entry animation could be run
int width = MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY ?
MeasureSpec.getSize(widthMeasureSpec)
: (int) ((mNumPages * WIDTH_MULTIPLIER + 2) * mDotRadius);
: enableLauncherVisualRefresh()
// #ofGaps*gap_size + (#ofDots + 1 for double size dot)*dot_size
? (int) (((mNumPages - 1) * mGapWidth) + ((1 + mNumPages) * mDotRadius * 2))
: (int) ((mNumPages * WIDTH_MULTIPLIER + 2) * mDotRadius);
int height = MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.EXACTLY
? MeasureSpec.getSize(heightMeasureSpec)
: (int) (HEIGHT_MULTIPLIER * mDotRadius);