From 8a7a18f9097db807103590279e8147ed24f3c789 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Fri, 6 Jul 2018 19:17:16 +0300 Subject: [PATCH] Do now show location arrow and text without location; try to fix distance text --- .../src/net/osmand/telegram/ui/LiveNowTabFragment.kt | 12 ++++++------ .../src/net/osmand/telegram/utils/UiUtils.kt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) 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 ) }