@@ -314,7 +314,7 @@ private void onClickModifyLocation() {
314
314
/**
315
315
* Show the location in map app
316
316
*/
317
- public void showInMap (){
317
+ public void showInMap () {
318
318
Utils .handleGeoCoordinates (this ,
319
319
new fr .free .nrw .commons .location .LatLng (cameraPosition .target .getLatitude (),
320
320
cameraPosition .target .getLongitude (), 0.0f ));
@@ -387,6 +387,8 @@ public void onFailure(@NonNull Exception exception) {
387
387
});
388
388
389
389
390
+ } else {
391
+ requestLocationPermissions ();
390
392
}
391
393
}
392
394
@@ -458,13 +460,13 @@ void placeSelected() {
458
460
*/
459
461
private void addCenterOnGPSButton (){
460
462
fabCenterOnLocation = findViewById (R .id .center_on_gps );
461
- fabCenterOnLocation .setOnClickListener (view -> getCenter ());
463
+ fabCenterOnLocation .setOnClickListener (view -> requestLocationPermissions ());
462
464
}
463
465
464
466
/**
465
467
* Center the map at user's current location
466
468
*/
467
- private void getCenter () {
469
+ private void requestLocationPermissions () {
468
470
LocationPermissionsHelper .Dialog locationAccessDialog = new Dialog (
469
471
R .string .location_permission_title ,
470
472
R .string .upload_map_location_access
@@ -539,6 +541,9 @@ public void onLocationPermissionDenied(String toastMessage) {
539
541
540
542
@ Override
541
543
public void onLocationPermissionGranted () {
544
+ if (mapboxMap .getStyle () != null ) {
545
+ enableLocationComponent (mapboxMap .getStyle ());
546
+ }
542
547
fr .free .nrw .commons .location .LatLng currLocation = locationManager .getLastLocation ();
543
548
if (currLocation != null ) {
544
549
final CameraPosition position ;
0 commit comments