Skip to content

Long-press the home map for "directions from/to here"#1938

Merged
bmander merged 1 commit into
mainfrom
feature/directions-long-press
Jul 18, 2026
Merged

Long-press the home map for "directions from/to here"#1938
bmander merged 1 commit into
mainfrom
feature/directions-long-press

Conversation

@bmander

@bmander bmander commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1872 (the trip-planner → home-map directions work).

Summary

Long-pressing anywhere on the home map opens a modal menu — "Directions from here" and "Directions to here" — which enters the directions focus and fills that endpoint with the pressed point. Once the other endpoint is set, the plan auto-fires (with the error / no-route feedback from the base PR).

Changes

  • ObaMapCallbacks.onMapLongClick(GeoPoint) (default no-op).
  • Wired setOnMapLongClickListener (Google) / addOnMapLongClickListener (MapLibre) in the two compose adapters.
  • Surfaced through MapFeature (onMapLongPress) to HomeScreen, which shows DirectionsLongPressMenu (a ModalBottomSheet) and, on selection, enterDirections() + setFrom/setTo(MapPoint).

Notes

Summary by CodeRabbit

  • New Features
    • Added long-press support on maps.
    • Long-pressing a location now offers options to get directions from or to that point.
    • Added localized labels for both directions options.
    • Works across supported Google Maps and MapLibre map views.

@coderabbitai

coderabbitai Bot commented Jul 17, 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: 534d57a4-6ffc-4069-9a55-b7d8b18d37e7

📥 Commits

Reviewing files that changed from the base of the PR and between 91591c3 and c770515.

📒 Files selected for processing (7)
  • onebusaway-android/src/google/java/org/onebusaway/android/map/googlemapsv2/compose/GoogleComposeAdapter.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/map/compose/ObaMapCallbacks.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeScreen.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/directions/DirectionsFeature.kt
  • onebusaway-android/src/main/java/org/onebusaway/android/ui/home/map/MapFeature.kt
  • onebusaway-android/src/main/res/values/strings.xml
  • onebusaway-android/src/maplibre/java/org/onebusaway/android/map/maplibre/compose/MapLibreComposeAdapter.kt

📝 Walkthrough

Walkthrough

Map long-press events are added to both map providers, forwarded through MapFeature, and handled by HomeScreen with a modal menu for selecting directions from or to the pressed location.

Changes

Map long-press directions

Layer / File(s) Summary
Map long-press callback contract and adapters
onebusaway-android/src/main/java/org/onebusaway/android/map/compose/ObaMapCallbacks.kt, onebusaway-android/src/google/.../GoogleComposeAdapter.kt, onebusaway-android/src/maplibre/.../MapLibreComposeAdapter.kt
Adds an optional onMapLongClick callback and dispatches long-press coordinates as GeoPoint values from both map implementations.
Compose map callback forwarding
onebusaway-android/src/main/java/org/onebusaway/android/ui/home/map/MapFeature.kt
Adds the onMapLongPress parameter and forwards current map long-press events through a remembered callback.
Directions long-press selection flow
onebusaway-android/src/main/java/org/onebusaway/android/ui/home/HomeScreen.kt, onebusaway-android/src/main/java/org/onebusaway/android/ui/home/directions/DirectionsFeature.kt, onebusaway-android/src/main/res/values/strings.xml
Stores the pressed point, displays “from here” and “to here” actions, updates the trip endpoint, and adds localized labels.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MapProvider
  participant MapFeature
  participant HomeScreen
  participant DirectionsLongPressMenu
  participant TripPlanViewModel
  MapProvider->>MapFeature: long press with coordinates
  MapFeature->>HomeScreen: provide GeoPoint
  HomeScreen->>DirectionsLongPressMenu: show endpoint options
  DirectionsLongPressMenu->>HomeScreen: select from or to here
  HomeScreen->>TripPlanViewModel: set MapPoint endpoint
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding long-press directions actions to the home map.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feature/directions-long-press

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 feature/trip-plan-map-overlay to main July 18, 2026 04:45
Add onMapLongClick(GeoPoint) to ObaMapCallbacks, wired via setOnMapLongClickListener
(Google) / addOnMapLongClickListener (MapLibre) and surfaced through MapFeature
(onMapLongPress) to HomeScreen. A long-press opens a modal menu — "Directions from
here" / "Directions to here" — that enters directions focus and fills the pressed
point as that endpoint (which auto-plans once both endpoints are set).
@bmander
bmander force-pushed the feature/directions-long-press branch from 44a18f8 to c770515 Compare July 18, 2026 04:50
@bmander
bmander merged commit f3bd405 into main Jul 18, 2026
3 checks passed
@bmander
bmander deleted the feature/directions-long-press branch July 18, 2026 04:58
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.

1 participant