Commit 98812bdf authored by Shailesh Baldaniya's avatar Shailesh Baldaniya

feat: Add svgs for room type symbol

temp
parent 56422eca
...@@ -3,6 +3,7 @@ package chat.rocket.android.chatroom.ui ...@@ -3,6 +3,7 @@ package chat.rocket.android.chatroom.ui
import DrawableHelper import DrawableHelper
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Drawable
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
import chat.rocket.android.R import chat.rocket.android.R
...@@ -74,24 +75,26 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector { ...@@ -74,24 +75,26 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
supportActionBar?.setDisplayShowTitleEnabled(false) supportActionBar?.setDisplayShowTitleEnabled(false)
text_room_name.textContent = chatRoomName text_room_name.textContent = chatRoomName
var drawable: Drawable? = null
when (chatRoomType) { when (chatRoomType) {
RoomType.CHANNEL.toString() -> { RoomType.CHANNEL.toString() -> {
text_room_name.textContent = "#" + chatRoomName drawable = DrawableHelper.getDrawableFromId(R.drawable.ic_room_channel, this)
} }
RoomType.PRIVATE_GROUP.toString() -> { RoomType.PRIVATE_GROUP.toString() -> {
val drawable = DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, this) drawable = DrawableHelper.getDrawableFromId(R.drawable.ic_room_lock, 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() -> { RoomType.DIRECT_MESSAGE.toString() -> {
text_room_name.textContent = "@" + chatRoomName drawable = DrawableHelper.getDrawableFromId(R.drawable.ic_room_dm, this)
}
else -> {
text_room_name.textContent = chatRoomName
} }
} }
drawable?.let {
DrawableHelper.wrapDrawable(it)
DrawableHelper.tintDrawable(it, this, R.color.white)
DrawableHelper.compoundDrawable(text_room_name, it)
}
toolbar.setNavigationOnClickListener { toolbar.setNavigationOnClickListener {
finishActivity() finishActivity()
} }
......
...@@ -72,19 +72,16 @@ class ChatRoomsAdapter(private val context: Context, ...@@ -72,19 +72,16 @@ class ChatRoomsAdapter(private val context: Context,
private fun bindName(chatRoom: ChatRoom, textView: TextView) { private fun bindName(chatRoom: ChatRoom, textView: TextView) {
when (chatRoom.type) { when (chatRoom.type) {
is RoomType.Channel -> { is RoomType.Channel -> {
textView.textContent = "#" + chatRoom.name DrawableHelper.compoundDrawable(textView, DrawableHelper.getDrawableFromId(R.drawable.ic_room_channel, context))
} }
is RoomType.PrivateGroup -> { is RoomType.PrivateGroup -> {
DrawableHelper.compoundDrawable(textView, DrawableHelper.getDrawableFromId(R.drawable.ic_lock_black_24dp, context)) DrawableHelper.compoundDrawable(textView, DrawableHelper.getDrawableFromId(R.drawable.ic_room_lock, context))
textView.textContent = chatRoom.name
} }
is RoomType.DirectMessage -> { is RoomType.DirectMessage -> {
textView.textContent = "@" + chatRoom.name DrawableHelper.compoundDrawable(textView, DrawableHelper.getDrawableFromId(R.drawable.ic_room_dm, context))
}
else -> {
textView.textContent = chatRoom.name
} }
} }
textView.textContent = chatRoom.name
} }
private fun bindLastMessageDateTime(chatRoom: ChatRoom, textView: TextView) { private fun bindLastMessageDateTime(chatRoom: ChatRoom, textView: TextView) {
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M22.548,9l0.452,-2h-5.364l1.364,-6h-2l-1.364,6h-5l1.364,-6h-2l-1.364,6h-6.184l-0.452,2h6.182l-1.364,6h-5.36l-0.458,2h5.364l-1.364,6h2l1.364,-6h5l-1.364,6h2l1.364,-6h6.185l0.451,-2h-6.182l1.364,-6h5.366zM13.818,15h-5l1.364,-6h5l-1.364,6z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportHeight="20.0"
android:viewportWidth="20.0">
<path
android:fillColor="#FF000000"
android:pathData="M13.6,13.47c-0.91,0.953 -2.191,1.545 -3.61,1.545 -2.756,0 -4.99,-2.234 -4.99,-4.99 0,-0.009 0,-0.018 0,-0.026v0.001c0,-2.761 2.239,-5 5,-5 1.131,0 2.175,0.376 3.013,1.009l-0.013,-0.009v-1h2v6.5c0,0.828 0.672,1.5 1.5,1.5s1.5,-0.672 1.5,-1.5v0,-1.5c-0.003,-4.416 -3.584,-7.994 -8,-7.994 -4.418,0 -8,3.582 -8,8s3.582,8 8,8c1.305,0 2.537,-0.312 3.625,-0.867l-0.045,0.021 0.9,1.79c-1.305,0.668 -2.847,1.06 -4.48,1.06 -5.523,0 -10,-4.477 -10,-10s4.477,-10 10,-10c5.519,0 9.994,4.472 10,9.99v0.001h-0.01v1.5c0,0.003 0,0.007 0,0.01 0,1.933 -1.567,3.5 -3.5,3.5 -1.202,0 -2.262,-0.606 -2.892,-1.528l-0.008,-0.012zM10,13c1.657,0 3,-1.343 3,-3s-1.343,-3 -3,-3v0c-1.657,0 -3,1.343 -3,3s1.343,3 3,3v0z" />
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M18,10v-4c0,-3.313 -2.687,-6 -6,-6s-6,2.687 -6,6v4h-3v14h18v-14h-3zM8,6c0,-2.206 1.794,-4 4,-4s4,1.794 4,4v4h-8v-4zM19,22h-14v-10h14v10z" />
</vector>
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:drawablePadding="@dimen/text_view_drawable_padding"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/white" android:textColor="@color/white"
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
style="@style/ChatRoom.Name.TextView" style="@style/ChatRoom.Name.TextView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="@dimen/text_view_drawable_padding"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/text_last_message_date_time" app:layout_constraintRight_toLeftOf="@+id/text_last_message_date_time"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<dimen name="edit_text_margin">10dp</dimen> <dimen name="edit_text_margin">10dp</dimen>
<dimen name="edit_text_drawable_padding">16dp</dimen> <dimen name="edit_text_drawable_padding">16dp</dimen>
<dimen name="text_view_drawable_padding">4dp</dimen>
<dimen name="fab_elevation">6dp</dimen> <dimen name="fab_elevation">6dp</dimen>
<dimen name="divider_item_decorator_bound_start">72dp</dimen> <dimen name="divider_item_decorator_bound_start">72dp</dimen>
......
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