Refactor TripDetailsActivity launch to use Builder pattern #1442
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.
Fix: Preserve stop selection state when navigating back from trip details
Summary
This PR fixes a UX issue where the selected stop would lose its selection state when navigating back from the "Show trip status" screen, affecting both arrival list navigation and vehicle info bubble navigation.
Problem Description
When users followed these flows, the selected stop would become unselected upon returning to the map:
The root cause was that
TripDetailsActivitywas being launched without proper up navigation mode, causing the back button to recreateHomeActivityinstead of returning to the existing instance, which lost the preserved stop selection state.Solution
Replace static
TripDetailsActivity.start()calls with the Builder pattern and setUP_MODE_BACKto ensure proper back navigation:Changes Made
1. ArrivalsListFragment.java
goToTripDetails()method to use Builder pattern.setUpMode(NavHelp.UP_MODE_BACK)for proper navigation2. VehicleOverlay.java
onInfoWindowClick()method to use Builder pattern.setUpMode("back")for both with/without focused stop scenariosTechnical Details
TripDetailsActivity.Builderinstead of staticstart()methodsNavHelp.goUp()callactivity.finish()instead of recreating HomeActivity