Do now show location arrow and text without location; try to fix distance text

This commit is contained in:
Alex Sytnyk 2018-07-06 19:17:16 +03:00
parent 50286c32e3
commit 8a7a18f909
2 changed files with 7 additions and 7 deletions

View file

@ -187,11 +187,11 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
}
private fun convertToLocationItems(messages: List<TdApi.Message>): List<LocationItem> {
return mutableListOf<LocationItem>().apply {
val res = mutableListOf<LocationItem>()
messages.forEach { message ->
TelegramUiHelper.messageToLocationItem(telegramHelper, message)?.also { add(it) }
}
TelegramUiHelper.messageToLocationItem(telegramHelper, message)?.also { res.add(it) }
}
return res
}
inner class LiveNowListAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
@ -234,7 +234,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
TelegramUiHelper.setupPhoto(app, holder.icon, item.photoPath, item.placeholderId)
holder.title?.text = chatTitle
if (location != null) {
if (location != null && item.latLon != null) {
holder.locationViewContainer?.visibility = View.VISIBLE
// TODO: locationViewCache.outdatedLocation
app.uiUtils.updateLocationView(
@ -255,7 +255,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
} else if (item is LocationItem && holder is ContactViewHolder) {
TelegramUiHelper.setupPhoto(app, holder.icon, item.photoPath, item.placeholderId)
holder.title?.text = item.name
if (location != null) {
if (location != null && item.latLon != null) {
holder.locationViewContainer?.visibility = View.VISIBLE
// TODO: locationViewCache.outdatedLocation
app.uiUtils.updateLocationView(

View file

@ -147,7 +147,7 @@ class UiUtils(private val app: TelegramApplication) {
if (fromLoc != null && toLoc != null) {
Location.distanceBetween(
fromLoc.latitude, fromLoc.longitude, toLoc.latitude, toLoc.longitude, mes
toLoc.latitude, toLoc.longitude, fromLoc.latitude, fromLoc.longitude, mes
)
}