From 37658d86a616076baed716a87e269876dcd7f296 Mon Sep 17 00:00:00 2001 From: Chumva Date: Tue, 4 Sep 2018 18:55:23 +0300 Subject: [PATCH] Fix group gray icon and bot description --- .../osmand/telegram/ui/LiveNowTabFragment.kt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt index bc529c9365..ebbbc8ec7e 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt @@ -419,8 +419,13 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage val openOnMapView = holder.getOpenOnMapClickView() val staleLocation = System.currentTimeMillis() / 1000 - item.lastUpdated > settings.staleLocTime - if (staleLocation && item.userId != 0) { - TelegramUiHelper.setupPhoto(app, holder.icon, item.grayscalePhotoPath, item.placeholderId, false) + if (staleLocation) { + val photoPath = if (settings.liveNowSortType.isSortByGroup() && item is ChatItem && !item.privateChat) { + item.photoPath + } else { + item.grayscalePhotoPath + } + TelegramUiHelper.setupPhoto(app, holder.icon, photoPath, item.placeholderId, false) } else { TelegramUiHelper.setupPhoto(app, holder.icon, item.photoPath, R.drawable.img_user_picture_active, false) } @@ -482,7 +487,13 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage private fun getChatItemDescription(item: ChatItem): String { return when { - item.chatWithBot -> getString(R.string.shared_string_bot) + item.chatWithBot -> { + if (settings.liveNowSortType.isSortByGroup()) { + getString(R.string.shared_string_bot) + } else { + OsmandFormatter.getListItemLiveTimeDescr(app, item.lastUpdated, lastResponseStr) + } + } item.privateChat -> OsmandFormatter.getListItemLiveTimeDescr(app, item.lastUpdated, lastResponseStr) else -> { if (settings.liveNowSortType.isSortByGroup()) {