From d1c849af364e20353a6525dc44fb14eca9792afe Mon Sep 17 00:00:00 2001 From: Jason Whitmore Date: Tue, 28 May 2024 19:08:04 -0700 Subject: [PATCH] LocationPickerActivity.java: remove redundant method, renaming method Before this change, there were two methods with the same behavior. This change removes the newer method and renames the old method to the descriptive name the newer one had. Additionally, code which calls this method has been changed to reflect the new name. --- .../LocationPickerActivity.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 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 c110ba646..eae51d1db 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 @@ -272,19 +272,6 @@ public class LocationPickerActivity extends BaseActivity implements } } - /** - * Moves the center of the map to the media's location (likely EXIF data), if that data - * is available. - */ - private void moveMapToMediaLocation(){ - if(cameraPosition != null){ - double latitude = cameraPosition.getLatitude(); - double longitude = cameraPosition.getLongitude(); - - moveMapTo(latitude, longitude); - } - } - /** * For showing credits */ @@ -340,7 +327,7 @@ public class LocationPickerActivity extends BaseActivity implements } private void setupMapView() { - adjustCameraBasedOnOptions(); + moveMapToMediaLocation(); modifyLocationButton.setOnClickListener(v -> onClickModifyLocation()); removeLocationButton.setOnClickListener(v -> onClickRemoveLocation()); showInMapButton.setOnClickListener(v -> showInMap()); @@ -416,12 +403,16 @@ public class LocationPickerActivity extends BaseActivity implements } /** - * move the location to the current media coordinates + * Moves the center of the map to the media's location (likely EXIF data), if that data + * is available. */ - private void adjustCameraBasedOnOptions() { + private void moveMapToMediaLocation() { if (cameraPosition != null) { - mapView.getController().setCenter(new GeoPoint(cameraPosition.getLatitude(), - cameraPosition.getLongitude())); + + GeoPoint point = new GeoPoint(cameraPosition.getLatitude(), + cameraPosition.getLongitude()); + + moveMapTo(point); } }