diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt index 72ac5181eb..c218b1778e 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt @@ -187,11 +187,11 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage } private fun convertToLocationItems(messages: List): List { - return mutableListOf().apply { - messages.forEach { message -> - TelegramUiHelper.messageToLocationItem(telegramHelper, message)?.also { add(it) } - } + val res = mutableListOf() + messages.forEach { message -> + TelegramUiHelper.messageToLocationItem(telegramHelper, message)?.also { res.add(it) } } + return res } inner class LiveNowListAdapter : RecyclerView.Adapter() { @@ -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( diff --git a/OsmAnd-telegram/src/net/osmand/telegram/utils/UiUtils.kt b/OsmAnd-telegram/src/net/osmand/telegram/utils/UiUtils.kt index dbb98fd781..2bd59b5697 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/utils/UiUtils.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/utils/UiUtils.kt @@ -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 ) }