Unverified Commit 3525893c authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #2110 from eliezer-of/fix-2109

[IMPROVEMENT] Chat list UI improvements
parents 7ad32331 caf47221
......@@ -8,6 +8,7 @@ import android.view.View
import androidx.annotation.DrawableRes
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import chat.rocket.android.chatrooms.adapter.RoomsAdapter
/**
* Adds a default or custom divider to specific item views from the adapter's data set.
......@@ -50,13 +51,13 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
for (i in 0 until childCount) {
val child = parent.getChildAt(i)
if (isLastView(child, parent))
if (isLastView(child, parent) || isViewTypeHeader(child, parent))
continue
val params = child.layoutParams as RecyclerView.LayoutParams
val top = child.bottom + params.bottomMargin
val bottom = top + (divider?.intrinsicHeight ?: 0)
val bottom = child.bottom + params.bottomMargin
val top = bottom - (divider?.intrinsicHeight ?: 0)
divider?.setBounds(left, top, right, bottom)
divider?.draw(c)
......@@ -67,4 +68,9 @@ class DividerItemDecoration() : RecyclerView.ItemDecoration() {
val position = parent.getChildAdapterPosition(view)
return position == parent.adapter?.itemCount?.minus(1) ?: false
}
}
\ No newline at end of file
private fun isViewTypeHeader(view: View, parent: RecyclerView): Boolean {
val position = parent.getChildViewHolder(view).itemViewType
return position == RoomsAdapter.VIEW_TYPE_HEADER
}
}
......@@ -4,24 +4,14 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<!--<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/darkGray" />-->
<TextView
android:id="@+id/text_chatroom_header"
style="@style/ChatRooms.Header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:padding="16dp"
android:paddingEnd="@dimen/screen_edge_left_and_right_padding"
android:paddingStart="@dimen/screen_edge_left_and_right_padding"
android:text="@string/chatroom_header" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/quoteBar" />
</LinearLayout>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
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