Replace route-row overflow with centered long-press menus#1891
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis change replaces overflow-based route schedule actions with long-press menus, adds centered Compose menu infrastructure and icons, migrates existing long-press menus, and adds an instrumented test for opening a route schedule. ChangesLong-press menu interactions
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Rider
participant RouteArrivalRow
participant RouteActionsMenu
participant ArrivalRowCallbacks
Rider->>RouteArrivalRow: Long-press arrival row
RouteArrivalRow->>RouteActionsMenu: Display schedule action
Rider->>RouteActionsMenu: Select show route schedule
RouteActionsMenu->>ArrivalRowCallbacks: Open schedule URL
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
5158f8e to
e2295d1
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/RouteArrivalRowLongPressTest.kt`:
- Around line 37-39: Update the `@Suppress`("DEPRECATION") annotation on
composeRule in RouteArrivalRowLongPressTest to include the required one-line
rationale and tracking issue link, matching the format used by nearby Compose
tests; retain the suppression only if the deprecated API remains necessary.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6ef87a30-ee5c-465f-a1ea-6ff91d855fc8
📒 Files selected for processing (9)
onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/RouteArrivalRowLongPressTest.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/arrivals/components/ArrivalRows.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/arrivals/components/EtaStrip.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/compose/components/CenteredLongPressMenu.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/compose/components/MaterialSymbols.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/mylists/MyListScreen.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/routeinfo/RouteInfoScreen.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/search/RouteSearchContent.ktonebusaway-android/src/main/java/org/onebusaway/android/ui/search/StopSearchContent.kt
| @Suppress("DEPRECATION") | ||
| @get:Rule | ||
| val composeRule = createComposeRule() |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n -C2 '`@Suppress`\("DEPRECATION"\)|createComposeRule\s*\(' \
onebusaway-androidRepository: OneBusAway/onebusaway-android
Length of output: 15365
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n== RouteArrivalRowLongPressTest.kt ==\n'
sed -n '1,120p' onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/RouteArrivalRowLongPressTest.kt
printf '\n== Nearby compose tests with similar suppression ==\n'
sed -n '1,120p' onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/ArrivalAlertIndicatorTest.kt
printf '\n---\n'
sed -n '1,120p' onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/ArrivalsPanelHeaderTest.kt
printf '\n---\n'
sed -n '1,120p' onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/compose/components/SlideBoxTest.kt
printf '\n---\n'
sed -n '1,120p' onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/EtaStripJustifyTest.ktRepository: OneBusAway/onebusaway-android
Length of output: 20852
Document this suppression or remove it. @Suppress("DEPRECATION") needs the required one-line rationale and tracking issue link here, matching the nearby Compose tests; otherwise it violates the Kotlin warning policy.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@onebusaway-android/src/androidTest/java/org/onebusaway/android/ui/arrivals/RouteArrivalRowLongPressTest.kt`
around lines 37 - 39, Update the `@Suppress`("DEPRECATION") annotation on
composeRule in RouteArrivalRowLongPressTest to include the required one-line
rationale and tracking issue link, matching the format used by nearby Compose
tests; retain the suppression only if the deprecated API remains necessary.
Source: Coding guidelines
The centered long-press menu renders in a Dialog (a separate window). On slower devices such as the CI emulator, the main composition can report idle a frame before the dialog window is laid out, so the immediate assertIsDisplayed() ran against an unplaced node and failed (it passed on a faster physical device). Wait for the schedule item to appear before clicking it, and document the createComposeRule() deprecation suppression to match the sibling Compose tests (#1792).
|
Addressed the CI failure and the review comment:
Compiled clean with |
The connected test longPressOpensScheduleWithoutOverflowButton failed on the API-33 CI emulator (the physical-device pass in the PR was against the earlier DropdownMenu version, before the switch to the Dialog-based centered menu). Two compounding fragilities: the injected longClick() relied on the long-press timeout elapsing against the test's virtual frame clock, which was racy on the emulator (the hold sometimes registered as a plain tap, so the menu never opened); and the Dialog's separate-window content is timing-sensitive to observe. Across the two failing runs this showed up as the schedule item being either present-but-"not displayed" or absent within the 5s wait. Invoke the row's OnLongClick semantics action directly instead. combinedClickable registers the same lambda as both the gesture and the accessibility action, so this exercises the real long-press-opens-schedule wiring deterministically, without the timeout race. onLongClickLabel disambiguates the row's schedule action from the ETA pill's own trip-actions long press. Then wait for the Dialog's schedule item and click it as before. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Why
The route-level overflow contained only one secondary action, but its dedicated corner button added visual noise and reduced room for direction text. Once that action moved to long press, the existing anchor-based popup behavior also made otherwise equivalent context menus appear in different places depending on the row or horizontally scrolled ETA pill that launched them.
A single centered presentation makes these secondary actions predictable and keeps positioning, shape, border, width, and elevation isolated from screen-specific action logic.
User impact
Tapping route rows and ETA pills retains its existing behavior. Long-pressing a schedule-capable route row or another menu-bearing row now opens a consistent centered menu. The arrivals actions have recognizable leading icons, and rows without an available secondary action do not expose an empty menu.
Validation
./gradlew test :onebusaway-android:compileObaGoogleDebugKotlin :onebusaway-android:compileObaMaplibreDebugKotlin :onebusaway-android:compileObaGoogleDebugAndroidTestKotlin -PwarningsAsErrors=true./gradlew connectedObaGoogleDebugAndroidTest --no-build-cache -Pandroid.testInstrumentationRunnerArguments.class=org.onebusaway.android.ui.arrivals.RouteArrivalRowLongPressTestBased directly on
mainafter #1865 landed.Summary by CodeRabbit