Commit 8fffc648 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Using UrlHelper to get avatar URL.

parent 65ed323a
...@@ -9,10 +9,12 @@ import android.view.ViewGroup ...@@ -9,10 +9,12 @@ import android.view.ViewGroup
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.helper.UrlHelper
import chat.rocket.android.util.inflate import chat.rocket.android.util.inflate
import chat.rocket.android.util.setVisibility import chat.rocket.android.util.setVisibility
import chat.rocket.android.util.textContent import chat.rocket.android.util.textContent
import chat.rocket.common.model.BaseRoom.RoomType import chat.rocket.common.model.BaseRoom.RoomType
import chat.rocket.core.internal.rest.me
import chat.rocket.core.model.ChatRoom import chat.rocket.core.model.ChatRoom
import com.facebook.drawee.view.SimpleDraweeView import com.facebook.drawee.view.SimpleDraweeView
import kotlinx.android.synthetic.main.item_chat.view.* import kotlinx.android.synthetic.main.item_chat.view.*
...@@ -28,9 +30,9 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c ...@@ -28,9 +30,9 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c
holder.chatName.textContent = chatRoomName holder.chatName.textContent = chatRoomName
if (chatRoom.type == RoomType.ONE_TO_ONE) { if (chatRoom.type == RoomType.ONE_TO_ONE) {
// TODO Check the best way to get the current server url.
val canonicalUrl = chatRoom.client.restUrl.toString() val canonicalUrl = chatRoom.client.restUrl.toString()
// TODO get safe URL holder.userAvatar.setImageURI(UrlHelper.getAvatarUrl(canonicalUrl, chatRoomName))
holder.userAvatar.setImageURI(canonicalUrl + "avatar/" + chatRoomName)
holder.userAvatar.setVisibility(true) holder.userAvatar.setVisibility(true)
} else { } else {
holder.roomAvatar.setImageDrawable(DrawableHelper.getTextDrawable(chatRoomName)) holder.roomAvatar.setImageDrawable(DrawableHelper.getTextDrawable(chatRoomName))
...@@ -59,9 +61,9 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c ...@@ -59,9 +61,9 @@ class ChatRoomsAdapter(private var dataSet: MutableList<ChatRoom>, private val c
holder.lastMessage.textContent = message holder.lastMessage.textContent = message
} }
// TODO Change to MySelf // TODO Change to MySelf
chatRoom.user?.username -> { // chatRoom.user?.username -> {
holder.lastMessage.textContent = context.getString(R.string.msg_you) + ": $message" // holder.lastMessage.textContent = context.getString(R.string.msg_you) + ": $message"
} // }
else -> { else -> {
holder.lastMessage.textContent = "@$senderUsername: $message" holder.lastMessage.textContent = "@$senderUsername: $message"
} }
......
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