Commit 56422eca authored by Shailesh Baldaniya's avatar Shailesh Baldaniya

feat: Add room-type in room-name

parent 8bab94e9
package chat.rocket.android.chatroom.ui
import DrawableHelper
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.app.AppCompatActivity
import chat.rocket.android.R
import chat.rocket.android.util.extensions.addFragment
import chat.rocket.android.util.extensions.textContent
import chat.rocket.common.model.RoomType
import dagger.android.AndroidInjection
import dagger.android.AndroidInjector
import dagger.android.DispatchingAndroidInjector
......@@ -73,6 +74,24 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowTitleEnabled(false)
text_room_name.textContent = chatRoomName
when (chatRoomType) {
RoomType.CHANNEL.toString() -> {
text_room_name.textContent = "#" + chatRoomName
}
RoomType.PRIVATE_GROUP.toString() -> {
val drawable = DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, this)
DrawableHelper.wrapDrawable(drawable)
DrawableHelper.tintDrawable(drawable, this, R.color.white)
DrawableHelper.compoundDrawable(text_room_name, drawable)
text_room_name.textContent = chatRoomName
}
RoomType.DIRECT_MESSAGE.toString() -> {
text_room_name.textContent = "@" + chatRoomName
}
else -> {
text_room_name.textContent = chatRoomName
}
}
toolbar.setNavigationOnClickListener {
finishActivity()
}
......
package chat.rocket.android.chatrooms.ui
import DateTimeHelper
import DrawableHelper
import android.content.Context
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
......@@ -69,7 +70,21 @@ class ChatRoomsAdapter(private val context: Context,
}
private fun bindName(chatRoom: ChatRoom, textView: TextView) {
textView.content = chatRoom.name
when (chatRoom.type) {
is RoomType.Channel -> {
textView.textContent = "#" + chatRoom.name
}
is RoomType.PrivateGroup -> {
DrawableHelper.compoundDrawable(textView, DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, context))
textView.textContent = chatRoom.name
}
is RoomType.DirectMessage -> {
textView.textContent = "@" + chatRoom.name
}
else -> {
textView.textContent = chatRoom.name
}
}
}
private fun bindLastMessageDateTime(chatRoom: ChatRoom, textView: TextView) {
......
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