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:47:43 +05:30
parent 8739b687a2
commit bfaba0ad0e
2 changed files with 3 additions and 2471 deletions

View file

@ -1831,21 +1831,21 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(), NearbyParentFragmen
presenter!!.updateMapAndList(locationChangeType) presenter!!.updateMapAndList(locationChangeType)
} }
override fun onLocationChangedSignificantly(latLng: LatLng) { override fun onLocationChangedSignificantly(latLng: LatLng?) {
Timber.d("Location significantly changed") Timber.d("Location significantly changed")
if (latLng != null) { if (latLng != null) {
handleLocationUpdate(latLng, LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED) handleLocationUpdate(latLng, LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED)
} }
} }
override fun onLocationChangedSlightly(latLng: LatLng) { override fun onLocationChangedSlightly(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, LocationChangeType.LOCATION_SLIGHTLY_CHANGED) handleLocationUpdate(latLng, LocationChangeType.LOCATION_SLIGHTLY_CHANGED)
} }
} }
override fun onLocationChangedMedium(latLng: LatLng) { override fun onLocationChangedMedium(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, LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED) handleLocationUpdate(latLng, LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED)