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.
This commit is contained in:
Saifuddin 2025-02-22 16:17:51 +05:30
parent a4109eb37c
commit 7175b7021f

View file

@ -1699,7 +1699,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
} }
@Override @Override
public void onLocationChangedSignificantly(final LatLng latLng) { public void onLocationChangedSignificantly(@Nullable final LatLng latLng) {
Timber.d("Location significantly changed"); Timber.d("Location significantly changed");
if (latLng != null) { if (latLng != null) {
handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED); handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED);
@ -1707,7 +1707,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
} }
@Override @Override
public void onLocationChangedSlightly(final LatLng latLng) { public void onLocationChangedSlightly(@Nullable final LatLng latLng) {
Timber.d("Location slightly changed"); Timber.d("Location slightly changed");
if (latLng != null) {//If the map has never ever shown the current location, lets do it know if (latLng != null) {//If the map has never ever shown the current location, lets do it know
handleLocationUpdate(latLng, LOCATION_SLIGHTLY_CHANGED); handleLocationUpdate(latLng, LOCATION_SLIGHTLY_CHANGED);
@ -1715,7 +1715,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
} }
@Override @Override
public void onLocationChangedMedium(final LatLng latLng) { public void onLocationChangedMedium(@Nullable final LatLng latLng) {
Timber.d("Location changed medium"); Timber.d("Location changed medium");
if (latLng != null) {//If the map has never ever shown the current location, lets do it know if (latLng != null) {//If the map has never ever shown the current location, lets do it know
handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED); handleLocationUpdate(latLng, LOCATION_SIGNIFICANTLY_CHANGED);