Map: extract pure selectedTripStyle() for selected-trip color/underlay#1916
Merged
Conversation
) 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>
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
publishMapPresentation()decided "am I in stop focus with this route emphasized?" by checking whetherrouteColors[selected.routeDirection]happened to return non-null — a proxy, not the realstopFocusSessionstate 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.selectedTripStyle(stopFocusActive, selectedRouteDirection, routeColors, gtfsColor) -> SelectedTripStyle(color, includeUnderlay)intoRouteViewGeometry.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.publishMapPresentation()computedbadgesunconditionally even though it's provably always empty on that path (emphasizedRouteis 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