Skip to content

Commit

Permalink
Fixes blue dot disappearance on first install
Browse files Browse the repository at this point in the history
  • Loading branch information
srishti-R committed Oct 6, 2023
1 parent 0cca15a commit 41dbca0
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private void onClickModifyLocation() {
/**
* Show the location in map app
*/
public void showInMap(){
public void showInMap() {
Utils.handleGeoCoordinates(this,
new fr.free.nrw.commons.location.LatLng(cameraPosition.target.getLatitude(),
cameraPosition.target.getLongitude(), 0.0f));
Expand Down Expand Up @@ -387,6 +387,8 @@ public void onFailure(@NonNull Exception exception) {
});


} else {
requestLocationPermissions();
}
}

Expand Down Expand Up @@ -458,13 +460,13 @@ void placeSelected() {
*/
private void addCenterOnGPSButton(){
fabCenterOnLocation = findViewById(R.id.center_on_gps);
fabCenterOnLocation.setOnClickListener(view -> getCenter());
fabCenterOnLocation.setOnClickListener(view -> requestLocationPermissions());
}

/**
* Center the map at user's current location
*/
private void getCenter() {
private void requestLocationPermissions() {
LocationPermissionsHelper.Dialog locationAccessDialog = new Dialog(
R.string.location_permission_title,
R.string.upload_map_location_access
Expand Down Expand Up @@ -539,6 +541,9 @@ public void onLocationPermissionDenied(String toastMessage) {

@Override
public void onLocationPermissionGranted() {
if (mapboxMap.getStyle() != null) {
enableLocationComponent(mapboxMap.getStyle());
}
fr.free.nrw.commons.location.LatLng currLocation = locationManager.getLastLocation();
if (currLocation != null) {
final CameraPosition position;
Expand Down

0 comments on commit 41dbca0

Please sign in to comment.