5195: Fix upload wizard crash on tapping target icon (#5306)

* LocationPickerActivity: fix crash on setting location for pictures with no EXIF location

* strings.xml: remove extra string introduced

* optimise constants

* LocationPickerActivity: request for permission only on tapping target icon

* remove newline

* handle location permissions using LocationPermissionsHelper

* add null check to prevent crash
This commit is contained in:
Ritika Pahwa 2023-09-25 13:30:46 +05:30 committed by GitHub
parent 70f8256565
commit 2282ce3d02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -483,14 +483,17 @@ public class LocationPickerActivity extends BaseActivity implements OnMapReadyCa
@Override
public void onLocationPermissionGranted() {
fr.free.nrw.commons.location.LatLng currLocation = locationManager.getLastLocation();
if (currLocation != null) {
final CameraPosition position;
position = new CameraPosition.Builder()
.target(new com.mapbox.mapboxsdk.geometry.LatLng(currLocation.getLatitude(), currLocation.getLongitude(), 0)) // Sets the new camera position
.target(new com.mapbox.mapboxsdk.geometry.LatLng(currLocation.getLatitude(),
currLocation.getLongitude(), 0)) // Sets the new camera position
.zoom(mapboxMap.getCameraPosition().zoom) // Same zoom level
.build();
mapboxMap.animateCamera(CameraUpdateFactory.newCameraPosition(position), 1000);
}
}
});
locationPermissionsHelper.handleLocationPermissions(locationAccessDialog, locationOffDialog);
}