Skip to content

Commit

Permalink
Sort the map list items by the distance from the current location (#4455
Browse files Browse the repository at this point in the history
)

* Sort the map list items by the distance from current location

* Fix lint

---------

Co-authored-by: Dmitry Brant <[email protected]>
  • Loading branch information
cooltey and dbrant authored Feb 7, 2024
1 parent 59237d6 commit e81ac6e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class PlacesFragmentViewModel(bundle: Bundle) : ViewModel() {
if (it.thumbUrl().isNullOrEmpty()) null else ImageUrlUtil.getUrlForPreferredSize(it.thumbUrl()!!, PlacesFragment.THUMB_SIZE),
it.description, it.displayTitle(wikiSite.languageCode)), it.coordinates!![0].lat, it.coordinates[0].lon)
}
.sortedBy {
lastKnownLocation?.run {
it.location.distanceTo(this)
}
}
nearbyPagesLiveData.postValue(Resource.Success(pages))
}
}
Expand Down

0 comments on commit e81ac6e

Please sign in to comment.