|
40 | 40 | import fr.free.nrw.commons.Utils;
|
41 | 41 | import fr.free.nrw.commons.auth.SessionManager;
|
42 | 42 | import fr.free.nrw.commons.auth.csrf.CsrfTokenClient;
|
43 |
| -import fr.free.nrw.commons.auth.csrf.InvalidLoginTokenException; |
44 | 43 | import fr.free.nrw.commons.coordinates.CoordinateEditHelper;
|
45 | 44 | import fr.free.nrw.commons.filepicker.Constants;
|
46 | 45 | import fr.free.nrw.commons.kvstore.BasicKvStore;
|
47 | 46 | import fr.free.nrw.commons.kvstore.JsonKvStore;
|
48 |
| -import fr.free.nrw.commons.location.LatLng; |
49 | 47 | import fr.free.nrw.commons.location.LocationPermissionsHelper;
|
50 | 48 | import fr.free.nrw.commons.location.LocationPermissionsHelper.LocationPermissionCallback;
|
51 | 49 | import fr.free.nrw.commons.location.LocationServiceManager;
|
@@ -606,26 +604,25 @@ public void onLocationPermissionGranted() {
|
606 | 604 | locationManager.requestLocationUpdatesFromProvider(
|
607 | 605 | LocationManager.NETWORK_PROVIDER);
|
608 | 606 | locationManager.requestLocationUpdatesFromProvider(LocationManager.GPS_PROVIDER);
|
609 |
| - getLocation(); |
| 607 | + addMarkerAtGPSLocation(); |
610 | 608 | } else {
|
611 |
| - getLocation(); |
| 609 | + addMarkerAtGPSLocation(); |
612 | 610 | locationPermissionsHelper.showLocationOffDialog(this,
|
613 | 611 | R.string.ask_to_turn_location_on_text);
|
614 | 612 | }
|
615 | 613 | }
|
616 | 614 | }
|
617 | 615 |
|
618 | 616 | /**
|
619 |
| - * Gets new location if locations services are on, else gets last location |
| 617 | + * Adds a marker to the map at the most recent GPS location |
| 618 | + * (which may be the current GPS location). |
620 | 619 | */
|
621 |
| - private void getLocation() { |
| 620 | + private void addMarkerAtGPSLocation() { |
622 | 621 | fr.free.nrw.commons.location.LatLng currLocation = locationManager.getLastLocation();
|
623 | 622 | if (currLocation != null) {
|
624 | 623 | GeoPoint currLocationGeopoint = new GeoPoint(currLocation.getLatitude(),
|
625 | 624 | currLocation.getLongitude());
|
626 | 625 | addLocationMarker(currLocationGeopoint);
|
627 |
| - mapView.getController().setCenter(currLocationGeopoint); |
628 |
| - mapView.getController().animateTo(currLocationGeopoint); |
629 | 626 | markerImage.setTranslationY(0);
|
630 | 627 | }
|
631 | 628 | }
|
|
0 commit comments