ExploreMapPresenter.java: fix map update code to search for Nearby LatLng when appropriate

Before this commit, when the user selected "Show in explore" in Nearby when no pins were
on the map, Explore would only search for markers at the user's current GPS location,
rather than those at the Nearby map center.

After this commit, code was added to check if the user recently came from the Nearby map.
If so, the stored coordinates of the Nearby map is searched rather than the user's current
GPS coordinates. Additionally, the boolean that indicates that the user recently came
from the Nearby map is set to false. This ensures that the stored Nearby map center
coordinates are not used when the user taps the icon to focus the map on their
current location.
This commit is contained in:
Jason Whitmore 2025-05-19 16:14:08 -07:00
parent f8f9b09e37
commit 3207477521

View file

@ -74,9 +74,22 @@ public class ExploreMapPresenter
*/
if (locationChangeType.equals(LOCATION_SIGNIFICANTLY_CHANGED)) {
Timber.d("LOCATION_SIGNIFICANTLY_CHANGED");
LatLng populateLatLng = exploreMapFragmentView.getMapCenter();
//If "Show in Explore" was selected in Nearby, use the previous LatLng
if (exploreMapFragmentView instanceof ExploreMapFragment) {
ExploreMapFragment exploreMapFragment = (ExploreMapFragment)exploreMapFragmentView;
if (exploreMapFragment.recentlyCameFromNearbyMap()) {
//Ensure this LatLng will not be used again if user searches their GPS location
exploreMapFragment.setRecentlyCameFromNearbyMap(false);
populateLatLng = exploreMapFragment.getPreviousLatLng();
}
}
lockUnlockNearby(true);
exploreMapFragmentView.setProgressBarVisibility(true);
exploreMapFragmentView.populatePlaces(exploreMapFragmentView.getMapCenter());
exploreMapFragmentView.populatePlaces(populateLatLng);
} else if (locationChangeType.equals(SEARCH_CUSTOM_AREA)) {
Timber.d("SEARCH_CUSTOM_AREA");
lockUnlockNearby(true);