Provide partial description for ChatItem

This commit is contained in:
Alex Sytnyk 2018-07-11 14:53:41 +03:00
parent a821a872df
commit 41a4d38765
2 changed files with 13 additions and 1 deletions

View file

@ -1,4 +1,6 @@
<resources>
<string name="shared_string_live">Live</string>
<string name="shared_string_bot">Bot</string>
<string name="get_telegram_title">Registration in Telegram</string>
<string name="get_telegram_account_first">You need an account in Telegram to use the capabilities of OsmAnd Location Sharing.</string>
<string name="get_telegram_description_continue">If you want to continue, please install the Telegram from Google Play and register your account.</string>

View file

@ -276,7 +276,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
val chatTitle = item.chatTitle
val stateTextInd = if (settings.isShowingChatOnMap(chatTitle)) 1 else 0
holder.description?.text = "Chat description" // FIXME
holder.description?.text = getChatItemDescription(item)
holder.imageButton?.visibility = View.GONE
holder.showOnMapRow?.setOnClickListener { showPopupMenu(holder, chatTitle) }
holder.showOnMapState?.text = menuList[stateTextInd]
@ -288,6 +288,16 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
override fun getItemCount() = items.size
private fun getChatItemDescription(item: ChatItem): String {
return when {
item.chatWithBot -> getString(R.string.shared_string_bot)
item.privateChat -> "Chat description" // FIXME
else -> "${getString(R.string.shared_string_live)}: ${item.liveMembersCount}${getString(
R.string.shared_string_all
)}: ${item.membersCount}"
}
}
private fun showPopupMenu(holder: ChatViewHolder, chatTitle: String) {
val ctx = holder.itemView.context