Commit c743db76 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update ChatListAdapter.kt

parent cd86f1d1
...@@ -27,21 +27,16 @@ class ChatListAdapter(private var dataSet: MutableList<Chat>, private val contex ...@@ -27,21 +27,16 @@ class ChatListAdapter(private var dataSet: MutableList<Chat>, private val contex
holder.userAvatar.setImageURI(chat.userAvatarUri) holder.userAvatar.setImageURI(chat.userAvatarUri)
holder.chatName.text = chat.name holder.chatName.text = chat.name
holder.lastMessage.text = chat.lastMessage holder.lastMessage.text = chat.lastMessage
holder.lastMessageTimestamp.text = chat.lastMessageTimestamp holder.lastMessageTimestamp.text = DateTimeHelper.getDate(chat.lastMessageDateTime, context)
when (chat.type) { when (chat.type) {
"p" -> DrawableHelper.compoundDrawable(holder.chatName, DrawableHelper.getDrawableFromId(R.drawable.ic_lock_outline_black, context)) "p" -> DrawableHelper.compoundDrawable(holder.chatName, DrawableHelper.getDrawableFromId(R.drawable.ic_lock_outline_black, context))
"c" -> DrawableHelper.compoundDrawable(holder.chatName, DrawableHelper.getDrawableFromId(R.drawable.ic_hashtag_black, context)) "c" -> DrawableHelper.compoundDrawable(holder.chatName, DrawableHelper.getDrawableFromId(R.drawable.ic_hashtag_black, context))
"d" -> { "d" -> {
val userStatusDrawable = DrawableHelper.getDrawableFromId(R.drawable.ic_user_status_black, context).mutate() val userStatus = chat.userStatus
DrawableHelper.wrapDrawable(userStatusDrawable) if (userStatus != null) {
when (chat.userStatus) { DrawableHelper.compoundDrawable(holder.chatName, DrawableHelper.getUserStatusDrawable(userStatus, context))
"online" -> DrawableHelper.tintDrawable(userStatusDrawable, context, R.color.colorUserStatusOnline)
"busy" -> DrawableHelper.tintDrawable(userStatusDrawable, context, R.color.colorUserStatusBusy)
"away" -> DrawableHelper.tintDrawable(userStatusDrawable, context, R.color.colorUserStatusAway)
"offline" -> DrawableHelper.tintDrawable(userStatusDrawable, context, R.color.colorUserStatusOffline)
} }
DrawableHelper.compoundDrawable(holder.chatName, userStatusDrawable)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment