feat(DotsIndicator): per-dot color API for classic View indicator - #227
Open
tbuonomo-agnt wants to merge 4 commits into
Open
feat(DotsIndicator): per-dot color API for classic View indicator#227tbuonomo-agnt wants to merge 4 commits into
tbuonomo-agnt wants to merge 4 commits into
Conversation
Closes #193 ## What changed - Add `selectedDotColors: IntArray?` — per-index selected color, falls back to global `selectedDotColor` for out-of-range indices - Add `dotColors: IntArray?` — per-index unselected color, falls back to global `dotsColor` for out-of-range indices - Add `resolveColor(colors, index, fallback)` static helper (pure, JVM-safe, Java-callable via @JvmStatic) - Wire per-index resolution into addDot, refreshDotColor and the onPageScrolled color-interpolation path ## Scope Classic `DotsIndicator` (View-based) only. Spring, Worm and Compose indicators are intentionally unchanged in this PR. ## Tests - DotsIndicatorColorTest — 18 pure-JVM unit tests for resolveColor fallback, partial arrays, independence of selected/unselected paths - DotsIndicatorViewRenderTest — 12 Robolectric tests verifying color values on GradientDrawable + 4 screenshot golden scenarios ## Docs & sample - README: Kotlin + Java usage examples - Sample app: per-dot rainbow demo on the classic ViewPager fragment
The per-dot color feature doesn't touch Spring/Worm/Compose rendering paths, but Roborazzi regenerated all goldens when running recordRoborazziDebug (minor PNG re-encoding differences). Commit updated goldens so verifyRoborazziDebug stays green on CI. Note: goldens for the new DotsIndicatorViewRenderTest screenshot tests (dots_view_*.png) will be committed in the follow-up PR that stabilises the Roborazzi pipeline for View-based indicator screenshots.
…issue_comments - .claude/settings.json grants Read/Edit/Write/Bash permissions needed for agent-driven development in this repo - .gitignore: add .tmp_issue_comments/ to ignored paths
tommybuonomo
approved these changes
Jun 20, 2026
…iew-goldens chore: stabilise Roborazzi screenshot pipeline for View-based indicator goldens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds first-class per-dot color support to the classic View-based
DotsIndicator, addressing the long-standing request in #193.What's new
Java-friendly setters:
API design
selectedDotColors: IntArray?— per-index selected colors, falls back to globalselectedDotColorfor out-of-range or nulldotColors: IntArray?— per-index unselected colors, falls back to globaldotsColorresolveColor(colors, index, fallback)static helper (@JvmStatic, pure, no Android context required)addDot,refreshDotColorand theonPageScrolledcolor-interpolation path (per-index endpoints)Scope
Classic
DotsIndicator(View-based) only.SpringDotsIndicator,WormDotsIndicatorand Compose indicators are intentionally unchanged.Tests
DotsIndicatorColorTest) —resolveColorboundary cases, partial arrays, selected/unselected independenceDotsIndicatorViewRenderTest) — assert actualGradientDrawablecolors set on dots; covers global, per-index, partial, runtime refresh scenariosAll tests pass locally (
./gradlew :viewpagerdotsindicator:testDebugUnitTest— BUILD SUCCESSFUL).Follow-up (separate PR)
dots_view_*.png)Closes #193