Skip to content

Map: extract pure selectedTripStyle() for selected-trip color/underlay#1916

Merged
bmander merged 1 commit into
mainfrom
fix-1902-selected-trip-style
Jul 16, 2026
Merged

Map: extract pure selectedTripStyle() for selected-trip color/underlay#1916
bmander merged 1 commit into
mainfrom
fix-1902-selected-trip-style

Conversation

@bmander

@bmander bmander commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes Map: #1899 fix keys selected-trip styling off a palette-lookup null-check — extract a pure, tested selectedTripStyle() #1902: publishMapPresentation() decided "am I in stop focus with this route emphasized?" by checking whether routeColors[selected.routeDirection] happened to return non-null — a proxy, not the real stopFocusSession state one line up. An opposite-direction selected vehicle inside stop focus (its direction absent from the focused stop's own trip set) would silently degrade to GTFS color + the generic underlay — the exact visual Keep stop-focus color when a vehicle is selected (#1893 regression) #1899 fixed.
  • Extracts a pure selectedTripStyle(stopFocusActive, selectedRouteDirection, routeColors, gtfsColor) -> SelectedTripStyle(color, includeUnderlay) into RouteViewGeometry.kt, alongside the sibling presentation logic that already lives (and is tested) there. The underlay decision now keys off real stop-focus state; the color still falls back to the GTFS color on an adjacency-color miss.
  • Bonus: the selected-trip branch of publishMapPresentation() computed badges unconditionally even though it's provably always empty on that path (emphasizedRoute is always non-null when a trip is selected) — that computation now only runs when actually needed.

Test plan

  • ./gradlew :onebusaway-android:compileObaGoogleDebugKotlin -PwarningsAsErrors=true — builds clean, zero warnings
  • ./gradlew :onebusaway-android:testObaGoogleDebugUnitTest --tests "org.onebusaway.android.map.RouteViewGeometryTest" — passes, including a new table test over all four (stopFocusActive, adjacency-color-present) combinations

🤖 Generated with Claude Code

)

publishMapPresentation() decided "am I in stop focus with this route
emphasized?" by checking whether an adjacency-color lookup happened to
return non-null — a proxy for the real stopFocusSession state one line
up. An opposite-direction selected vehicle inside stop focus (its
direction absent from the focused stop's trip set) would silently fall
back to GTFS color + the generic underlay, the exact regression #1899
fixed.

Extract selectedTripStyle() into RouteViewGeometry.kt: the underlay
decision now keys off stopFocusActive directly, while the color still
falls back to the GTFS color on an adjacency-color miss. Table-tested
across all four (stopFocusActive x adjacency-color-present)
combinations. Also drops the always-empty badges computation on the
selected-trip path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@bmander
bmander merged commit bba2e57 into main Jul 16, 2026
2 checks passed
@bmander
bmander deleted the fix-1902-selected-trip-style branch July 16, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map: #1899 fix keys selected-trip styling off a palette-lookup null-check — extract a pure, tested selectedTripStyle()

1 participant