ExploreMapFragment.java: fix performMapReadyActions to center to user's last known location

Before this commit, fixing a previous bug caused performMapReadyActions to center the map
on a default location rather than the available last known location.

This commit adds code which will attempt to get the last known user location. If it cannot
be retrieved, the default location is used. The map now centers properly.
This commit is contained in:
Jason Whitmore 2025-05-02 18:34:22 -07:00
parent df8585d877
commit a6b0ecc0b2

View file

@ -340,7 +340,12 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
!locationPermissionsHelper.checkLocationPermission(getActivity())) {
isPermissionDenied = true;
}
lastKnownLocation = getLastLocation();
if (lastKnownLocation == null) {
lastKnownLocation = MapUtils.getDefaultLatLng();
}
// if we came from 'Show in Explore' in Nearby, load Nearby map center and zoom
if (isCameFromNearbyMap()) {