fix ConversationLineItemDecoration (#2677)

* fix ConversationLineItemDecoration

* cleanup code a bit
This commit is contained in:
Konrad Pozniak 2022-08-22 15:17:08 +02:00 committed by GitHub
parent e68e3d1825
commit f094f84b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -20,6 +20,7 @@ import android.graphics.Canvas
import android.graphics.drawable.Drawable
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.view.forEach
import androidx.recyclerview.widget.RecyclerView
import com.keylesspalace.tusky.R
@ -31,14 +32,13 @@ class ConversationLineItemDecoration(private val context: Context) : RecyclerVie
val dividerStart = parent.paddingStart + context.resources.getDimensionPixelSize(R.dimen.status_line_margin_start)
val dividerEnd = dividerStart + divider.intrinsicWidth
val childCount = parent.childCount
val avatarMargin = context.resources.getDimensionPixelSize(R.dimen.account_avatar_margin)
for (i in 0 until childCount) {
val child = parent.getChildAt(i)
val items = (parent.adapter as ThreadAdapter).currentList
parent.forEach { child ->
val position = parent.getChildAdapterPosition(child)
val items = (parent.adapter as ThreadAdapter).currentList
val current = items.getOrNull(position)
@ -50,7 +50,7 @@ class ConversationLineItemDecoration(private val context: Context) : RecyclerVie
child.top + avatarMargin
}
val below = items.getOrNull(position + 1)
val dividerBottom = if (below != null && current.id == below.status.inReplyToId && below.isDetailed) {
val dividerBottom = if (below != null && current.id == below.status.inReplyToId && !current.isDetailed) {
child.bottom
} else {
child.top + avatarMargin