Skip to content

Give FocusedStop a GeoPoint instead of loose lat/lon (#1949)#1950

Merged
bmander merged 1 commit into
mainfrom
focusedstop-geopoint-1949
Jul 18, 2026
Merged

Give FocusedStop a GeoPoint instead of loose lat/lon (#1949)#1950
bmander merged 1 commit into
mainfrom
focusedstop-geopoint-1949

Conversation

@bmander

@bmander bmander commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Closes #1949.

Important

Stacked on #1948 — base branch is geopoint-reform-1944, not main. Review/merge #1948 first; I'll rebase this onto main once it lands (the diff below is only this change's commit).

What

Follow-up to the GeoPoint reform. #1948 standardized the loose (lat, lon) data-class carriers on GeoPoint, but deliberately stopped short of the type they all cluster around: FocusedStop, which still modeled position as two bare Doubles. That left a ring of wrap/unwrap churn around it.

This replaces FocusedStop.lat/lon with a single point: GeoPoint, so the carriers speak GeoPoint end-to-end:

  • HomeViewModel emits RecenterOnFocusedStop(it.point) — was re-wrapping GeoPoint(it.lat, it.lon).
  • HomeNavHost builds the stop straight from reveal.point — was unwrapping it into FocusedStop(..., reveal.point.latitude, reveal.point.longitude).
  • ReportTarget.Stop now sits consistently beside its ReportTarget.Location(point: GeoPoint) sibling.

Boundaries kept (intentional)

The sites that read/write a genuine boundary keep their conversion there — only the in-memory type changed, the wire/persistence keys are untouched:

  • HomeActivity.fromIntent — from Intent extras (CENTER_LAT/LON)
  • CurrentFocusPersistence — the persisted home.focusedStop.lat/lon keys
  • ReportLauncher.start(..., lat, lon) — Intent-extras launch (still unwraps it.point.latitude/longitude)

Verification

  • compileObaGoogleDebugKotlin + compileObaMaplibreDebugKotlin + both test source sets compile with -PwarningsAsErrors=true.
  • Full testObaGoogleDebugUnitTest (JVM) suite passes (the ~48 FocusedStop(...) test constructions were updated).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Improvements
    • Improved consistency when selecting, restoring, and reporting a focused stop’s map location.
    • Preserved focused-stop locations more reliably across navigation and app state restoration.
  • Tests
    • Updated coverage for map focus, stop selection, saved state restoration, and reporting workflows.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c40b4369-f7c7-4d2b-b3bb-4854ea40ab1a

📥 Commits

Reviewing files that changed from the base of the PR and between ed54a13 and 382992c.

📒 Files selected for processing (9)
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/HomeActivity.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/CurrentFocusPersistence.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/FocusedStop.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeNavHost.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeViewModel.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/map/MapFeature.kt
  • onebusaway-android/src/test/java/org/onebusaway/android/ui/home/HomeSheetLogicTest.kt
  • onebusaway-android/src/test/java/org/onebusaway/android/ui/home/HomeViewModelTest.kt
  • onebusaway-android/src/test/java/org/onebusaway/android/ui/home/map/MapStopsBannerTest.kt

📝 Walkthrough

Walkthrough

FocusedStop now carries a GeoPoint instead of separate latitude and longitude values. Construction, persistence, map/report flows, and affected test fixtures were updated accordingly.

Changes

FocusedStop GeoPoint migration

Layer / File(s) Summary
FocusedStop coordinate contract
onebusaway-android/src/main/java/org/onebusaway/android/ui/home/FocusedStop.kt
Replaces lat and lon with a single point: GeoPoint property.
Focused-stop flows and persistence
onebusaway-android/src/main/java/org/onebusaway/android/ui/HomeActivity.kt, onebusaway-android/src/main/java/org/onebusaway/android/ui/home/{CurrentFocusPersistence,HomeNavHost,HomeViewModel}.kt, onebusaway-android/src/main/java/org/onebusaway/android/ui/home/map/MapFeature.kt
Updates focused-stop construction, saved-state encoding, report coordinates, map reveal, map clicks, and recentering to use GeoPoint.
Focused-stop test fixtures
onebusaway-android/src/test/java/org/onebusaway/android/ui/home/HomeSheetLogicTest.kt, onebusaway-android/src/test/java/org/onebusaway/android/ui/home/HomeViewModelTest.kt, onebusaway-android/src/test/java/org/onebusaway/android/ui/home/map/MapStopsBannerTest.kt
Migrates focused-stop fixtures to the new constructor shape without changing test logic.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: replacing FocusedStop's loose lat/lon with GeoPoint.
Linked Issues check ✅ Passed The changes match #1949: FocusedStop now uses GeoPoint, and callers pass or unwrap points only at boundaries.
Out of Scope Changes check ✅ Passed The diff stays focused on the GeoPoint refactor and test fixture updates; no unrelated code paths were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch focusedstop-geopoint-1949

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Base automatically changed from geopoint-reform-1944 to main July 18, 2026 18:36
@bmander
bmander force-pushed the focusedstop-geopoint-1949 branch from 3ab1e7a to 0ef7a86 Compare July 18, 2026 18:38
Follow-up to the GeoPoint reform (#1944): `FocusedStop` was the type its
now-`GeoPoint`-carrying neighbours (`MapDirective.RecenterOnFocusedStop`,
`ReportTarget.Location`, `StopReveal`) clustered around, but it still modeled
position as two bare `Double`s — leaving a ring of wrap/unwrap churn.

Replace `FocusedStop.lat`/`lon` with `point: GeoPoint`. This lets the carriers
speak `GeoPoint` end-to-end:
- `HomeViewModel` emits `RecenterOnFocusedStop(it.point)` (was re-wrapping
  `GeoPoint(it.lat, it.lon)`), and `HomeNavHost` builds the stop straight from
  `reveal.point` (was unwrapping it).
- `ReportTarget.Stop` now sits consistently beside `ReportTarget.Location`.

The construction/read sites that touch a genuine boundary keep their conversion
there: Intent extras (`HomeActivity.fromIntent`), the persisted
`home.focusedStop.lat`/`lon` keys (`CurrentFocusPersistence`), and
`ReportLauncher.start(..., lat, lon)` — only the in-memory type changed; the
persistence/extra keys are untouched.

Stacked on #1948 (base `geopoint-reform-1944`); rebase to `main` once it lands.

Verified: `compile{ObaGoogle,ObaMaplibre}DebugKotlin` + both test source sets
compile with `-PwarningsAsErrors=true`; full `testObaGoogleDebugUnitTest` passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bmander
bmander force-pushed the focusedstop-geopoint-1949 branch from 0ef7a86 to 382992c Compare July 18, 2026 18:41
@bmander
bmander merged commit b65f43c into main Jul 18, 2026
3 checks passed
@bmander
bmander deleted the focusedstop-geopoint-1949 branch July 18, 2026 18:49
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.

GeoPoint reform follow-up: give FocusedStop a GeoPoint

1 participant