From 7175b7021f9b9ac28b7e246532a7e952b94937bd Mon Sep 17 00:00:00 2001 From: Saifuddin Date: Sat, 22 Feb 2025 16:17:51 +0530 Subject: [PATCH] Refactor: Update `onLocationChanged` methods to accept nullable `LatLng` The `onLocationChangedSignificantly`, `onLocationChangedSlightly`, and `onLocationChangedMedium` methods in `NearbyParentFragment.java` have been updated to accept a nullable `LatLng` parameter. This change allows for cases where the location may not be available or valid. The methods previously required a non-null `LatLng` object. If the location is found to be valid then the location is handled by calling `handleLocationUpdate` method. --- .../nrw/commons/nearby/fragments/NearbyParentFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java index 2b64f0e37..0bef6c894 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java @@ -1699,7 +1699,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment } @Override - public void onLocationChangedSignificantly(final LatLng latLng) { + public void onLocationChangedSignificantly(@Nullable final LatLng latLng) { Timber.d("Location significantly changed"); if (latLng != null) { handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED); @@ -1707,7 +1707,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment } @Override - public void onLocationChangedSlightly(final LatLng latLng) { + public void onLocationChangedSlightly(@Nullable final LatLng latLng) { Timber.d("Location slightly changed"); if (latLng != null) {//If the map has never ever shown the current location, lets do it know handleLocationUpdate(latLng, LOCATION_SLIGHTLY_CHANGED); @@ -1715,7 +1715,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment } @Override - public void onLocationChangedMedium(final LatLng latLng) { + public void onLocationChangedMedium(@Nullable final LatLng latLng) { Timber.d("Location changed medium"); if (latLng != null) {//If the map has never ever shown the current location, lets do it know handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED);