Skip to content

Commit 1463d02

Browse files
LocationPickerActivity.java: Fix location picker bug with incorrect map centering
This commit moves the center of the map to the image's location, if the image has location EXIF data. If the image does not have location EXIF data, the map will center on the device's current GPS location.
1 parent e7504b8 commit 1463d02

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java

+10
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) {
237237
cameraPosition.getLongitude()));
238238
}
239239
setupMapView();
240+
241+
if("UploadActivity".equals(activity)){
242+
if(mapView != null && mapView.getController() != null && cameraPosition != null){
243+
GeoPoint cameraGeoPoint = new GeoPoint(cameraPosition.getLatitude(),
244+
cameraPosition.getLongitude());
245+
246+
mapView.getController().setCenter(cameraGeoPoint);
247+
mapView.getController().animateTo(cameraGeoPoint);
248+
}
249+
}
240250
}
241251

242252
/**

0 commit comments

Comments
 (0)