From c6a7a5ec48478518f619a7d158c4f9913d3d8964 Mon Sep 17 00:00:00 2001 From: Jason Whitmore Date: Fri, 24 May 2024 16:56:01 -0700 Subject: [PATCH] LocationPickerActivity.java: fix "Show in Map App" bug Once the "Show in Map App" button is pressed, the Map app will center on the current photo's EXIF location, if that data is available. If not, the map app will center on where the location picker's map is centered. Javadoc updated to reflect this small change. --- .../LocationPicker/LocationPickerActivity.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java b/app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java index 59de8e0fe..bc4c05222 100644 --- a/app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/LocationPicker/LocationPickerActivity.java @@ -364,12 +364,19 @@ public class LocationPickerActivity extends BaseActivity implements } /** - * Show the location in map app + * Show the location in map app. Map will center on EXIF location, if available. */ public void showInMap() { - Utils.handleGeoCoordinates(this, - new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(), - mapView.getMapCenter().getLongitude(), 0.0f)); + //Check to see if EXIF location data is available + if(cameraPosition != null){ + Utils.handleGeoCoordinates(this, + new fr.free.nrw.commons.location.LatLng(cameraPosition.getLatitude(), + cameraPosition.getLongitude(), 0.0f)); + } else { + Utils.handleGeoCoordinates(this, + new fr.free.nrw.commons.location.LatLng(mapView.getMapCenter().getLatitude(), + mapView.getMapCenter().getLongitude(), 0.0f)); + } } /**