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

Updates chat list widgets styles.

parent d1e0e9e1
......@@ -10,6 +10,7 @@ import chat.rocket.android.R
import chat.rocket.android.chatrooms.adapter.model.RoomUiModel
import chat.rocket.common.model.RoomType
import chat.rocket.common.model.UserStatus
import chat.rocket.common.util.ifNull
import kotlinx.android.synthetic.main.item_chat.view.*
import kotlinx.android.synthetic.main.unread_messages_badge.view.*
......@@ -29,6 +30,12 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
image_avatar.setImageURI(room.avatar)
text_chat_name.text = room.name
if (room.status != null && room.type is RoomType.DirectMessage) {
image_chat_icon.setImageDrawable(getStatusDrawable(room.status))
} else {
image_chat_icon.setImageDrawable(getRoomDrawable(room.type))
}
if (room.lastMessage != null) {
text_last_message.text = room.lastMessage
text_last_message.isVisible = true
......@@ -37,10 +44,10 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
}
if (room.date != null) {
text_last_message_date_time.text = room.date
text_last_message_date_time.isVisible = true
text_timestamp.text = room.date
text_timestamp.isVisible = true
} else {
text_last_message_date_time.isInvisible = true
text_timestamp.isInvisible = true
}
if (room.unread != null) {
......@@ -50,10 +57,17 @@ class RoomViewHolder(itemView: View, private val listener: (RoomUiModel) -> Unit
text_total_unread_messages.isInvisible = true
}
if (room.status != null && room.type is RoomType.DirectMessage) {
image_chat_icon.setImageDrawable(getStatusDrawable(room.status))
} else {
image_chat_icon.setImageDrawable(getRoomDrawable(room.type))
if (room.alert || room.unread != null) {
text_timestamp.setTextAppearance(
context,
R.style.ChatList_Timestamp_Unread_TextView
)
text_last_message.setTextAppearance(
context,
R.style.ChatList_LastMessage_Unread_TextView
)
text_total_unread_messages.text = "!"
text_total_unread_messages.isVisible = true
}
setOnClickListener { listener(room) }
......
......@@ -31,19 +31,19 @@
<TextView
android:id="@+id/text_chat_name"
style="@style/ChatRoom.Name.TextView"
style="@style/ChatList.ChatName.TextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/text_view_drawable_padding"
android:textDirection="locale"
app:layout_constraintEnd_toStartOf="@+id/text_last_message_date_time"
app:layout_constraintEnd_toStartOf="@+id/text_timestamp"
app:layout_constraintStart_toEndOf="@+id/image_chat_icon"
app:layout_constraintTop_toTopOf="parent"
tools:text="Margaret Hanson" />
<TextView
android:id="@+id/text_last_message_date_time"
style="@style/Timestamp.TextView"
android:id="@+id/text_timestamp"
style="@style/ChatList.Timestamp.TextView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:textDirection="locale"
......@@ -53,7 +53,7 @@
<TextView
android:id="@+id/text_last_message"
style="@style/ChatRoom.LastMessage.TextView"
style="@style/ChatList.LastMessage.TextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
......
......@@ -102,7 +102,7 @@
<TextView
android:id="@+id/text_message_time"
style="@style/Timestamp.TextView"
style="@style/ChatList.Timestamp.TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
......
......@@ -131,7 +131,7 @@
<TextView
android:id="@+id/text_message_time"
style="@style/Timestamp.TextView"
style="@style/ChatList.Timestamp.TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
......
......@@ -37,7 +37,7 @@
<TextView
android:id="@+id/text_message_time"
style="@style/Timestamp.TextView"
style="@style/ChatList.Timestamp.TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
......
......@@ -6,7 +6,7 @@
<TextView
android:id="@+id/text_total_unread_messages"
style="@style/Badge.TextView"
style="@style/ChatList.Badge.TextView"
android:layout_width="21dp"
android:layout_height="21dp"
android:background="@drawable/style_total_unread_messages"
......
......@@ -10,7 +10,8 @@
<color name="colorPrimaryText">#DE000000</color>
<color name="colorSecondaryText">#FF787878</color>
<color name="colorSecondaryTextLight">#FFC1C1C1</color>
<color name="colorTimestampText">#FF5699FF</color>
<color name="colorTimestampText">#FF9DA2A9</color>
<color name="colorTimestampTextUnread">#FF5699FF</color>
<color name="colorLastMessageText">#99000000</color>
<!-- User status colors -->
......
......@@ -96,12 +96,59 @@
<item name="android:fontFamily">sans-serif</item>
</style>
// REMARK: To be removed as soon as we have our loading view.
<style name="Authentication.AVLoadingIndicatorView" parent="AVLoadingIndicatorView">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="indicatorColor">@color/colorPrimary</item>
<item name="indicatorName">BallPulseIndicator</item>
</style>
<!-- End Authentication -->
<!-- Chat list -->
<style name="ChatList.ChatName.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
</style>
<style name="ChatList.LastMessage.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorLastMessageText</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">2</item>
</style>
<style name="ChatList.LastMessage.Unread.TextView" parent="ChatList.LastMessage.TextView">
<item name="android:fontFamily">sans-serif-medium</item>
</style>
<style name="ChatList.Timestamp.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorTimestampText</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
</style>
<style name="ChatList.Timestamp.Unread.TextView" parent="ChatList.Timestamp.TextView">
<item name="android:textColor">@color/colorTimestampTextUnread</item>
</style>
<style name="ChatList.Badge.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorWhite</item>
<item name="android:gravity">center</item>
</style>
<!-- End chat list -->
<style name="EditText.Password" parent="TextAppearance.AppCompat">
<!-- Hint color and label color in FALSE state -->
......@@ -111,13 +158,6 @@
<item name="colorControlActivated">@color/colorPrimaryDark</item>
</style>
<style name="AuthenticationLabel" parent="TextAppearance.AppCompat.Medium">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">50dp</item>
<item name="android:layout_marginStart">@dimen/screen_edge_left_and_right_margins</item>
<item name="android:paddingStart">@dimen/edit_text_margin</item>
</style>
<style name="ChatRoom.SearchView" parent="Widget.AppCompat.SearchView">
<item name="queryHint">@string/title_search_message</item>
<item name="searchIcon">@drawable/ic_search_white_24dp</item>
......@@ -129,24 +169,6 @@
<item name="android:textSize">16sp</item>
</style>
<style name="ChatRoom.Name.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
</style>
<style name="ChatRoom.LastMessage.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorLastMessageText</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">2</item>
</style>
<style name="Sender.Name.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
......@@ -168,23 +190,6 @@
<item name="android:textColor">@color/colorPrimaryText</item>
</style>
<style name="Timestamp.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorTimestampText</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">1</item>
</style>
<style name="Badge.TextView" parent="TextAppearance.AppCompat.Title">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/colorWhite</item>
<item name="android:gravity">center</item>
</style>
// REMARK: To be removed.
<style name="Profile.EditText" parent="Authentication.EditText.Border">
<item name="android:background">@drawable/style_edit_text_profile</item>
......
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