Commit 95ad502f authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Updates getUserStatusDrawable function.

parent d40ad994
......@@ -108,46 +108,12 @@ object DrawableHelper {
* @see [UserStatus]
* @return The user status drawable.
*/
fun getUserStatusDrawable(userStatus: UserStatus?, context: Context, getSmallDrawable: Boolean = false): Drawable {
fun getUserStatusDrawable(userStatus: UserStatus?, context: Context): Drawable {
return when (userStatus) {
is UserStatus.Online -> {
getDrawableFromId(
if (getSmallDrawable) {
R.drawable.ic_status_online_12dp
} else {
R.drawable.ic_status_online_24dp
},
context
)
}
is UserStatus.Away -> {
getDrawableFromId(
if (getSmallDrawable) {
R.drawable.ic_status_away_12dp
} else {
R.drawable.ic_status_away_24dp
},
context
)
}
is UserStatus.Busy -> {
getDrawableFromId(
if (getSmallDrawable) {
R.drawable.ic_status_busy_12dp
} else {
R.drawable.ic_status_busy_24dp
},
context
)
}
else -> getDrawableFromId(
if (getSmallDrawable){
R.drawable.ic_status_invisible_12dp
} else {
R.drawable.ic_status_invisible_24dp
},
context
)
is UserStatus.Online -> getDrawableFromId(R.drawable.ic_status_online_12dp, context)
is UserStatus.Away -> getDrawableFromId(R.drawable.ic_status_away_12dp, context)
is UserStatus.Busy -> getDrawableFromId(R.drawable.ic_status_busy_12dp, context)
else -> getDrawableFromId(R.drawable.ic_status_invisible_12dp, context)
}
}
}
\ No newline at end of file
......@@ -94,8 +94,7 @@ class ChatRoomsAdapter(private val context: Context,
)
is RoomType.DirectMessage -> DrawableHelper.getUserStatusDrawable(
chatRoom.status,
context,
true
context
)
else -> null
}
......
......@@ -84,11 +84,7 @@ class MainActivity : AppCompatActivity(), MainView, HasActivityInjector, HasSupp
override fun showUserStatus(userStatus: UserStatus) {
headerLayout.apply {
image_user_status.setImageDrawable(
DrawableHelper.getUserStatusDrawable(
userStatus,
this.context,
true
)
DrawableHelper.getUserStatusDrawable(userStatus, this.context)
)
}
}
......
......@@ -15,7 +15,7 @@
android:paddingStart="16dp"
android:paddingTop="8dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_status_online_24dp"
android:drawableStart="@drawable/ic_status_online_12dp"
android:text="@string/action_online"
android:background="?selectableItemBackground"/>
......@@ -28,7 +28,7 @@
android:paddingStart="16dp"
android:paddingTop="8dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_status_away_24dp"
android:drawableStart="@drawable/ic_status_away_12dp"
android:text="@string/action_away"
android:background="?selectableItemBackground"/>
......@@ -41,7 +41,7 @@
android:paddingStart="16dp"
android:paddingTop="8dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_status_busy_24dp"
android:drawableStart="@drawable/ic_status_busy_12dp"
android:text="@string/action_busy"
android:background="?selectableItemBackground"/>
......@@ -54,7 +54,7 @@
android:paddingStart="16dp"
android:paddingTop="8dp"
android:drawablePadding="10dp"
android:drawableStart="@drawable/ic_status_invisible_24dp"
android:drawableStart="@drawable/ic_status_invisible_12dp"
android:text="@string/action_invisible"
android:background="?selectableItemBackground"/>
......
......@@ -49,8 +49,9 @@
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginStart="5dp"
app:layout_constraintBaseline_toBaselineOf="@+id/text_chat_name"
app:layout_constraintBottom_toBottomOf="@+id/image_chat_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/image_chat_icon"
tools:text="11:45 AM" />
<TextView
......@@ -65,7 +66,7 @@
app:layout_constraintEnd_toStartOf="@id/layout_unread_messages_badge"
app:layout_constraintStart_toStartOf="@id/image_chat_icon"
app:layout_constraintTop_toBottomOf="@id/text_chat_name"
tools:text="You: Type something that is very big and need at least to lines, or maybe even more" />
tools:text="Filipe de Lima Brito: Type something that is very big and need at least to lines, or maybe even more" />
<include
android:id="@+id/layout_unread_messages_badge"
......
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