Auto review
This commit is contained in:
parent
0a0eda3e34
commit
7d910f2566
|
@ -22,11 +22,11 @@ import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import im.vector.matrix.android.api.util.MatrixItem
|
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
import im.vector.riotx.core.glide.GlideApp
|
import im.vector.riotx.core.glide.GlideApp
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.ReadReceiptData
|
import im.vector.riotx.features.home.room.detail.timeline.item.ReadReceiptData
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.item.toMatrixItem
|
||||||
import kotlinx.android.synthetic.main.view_read_receipts.view.*
|
import kotlinx.android.synthetic.main.view_read_receipts.view.*
|
||||||
|
|
||||||
private const val MAX_RECEIPT_DISPLAYED = 5
|
private const val MAX_RECEIPT_DISPLAYED = 5
|
||||||
|
@ -60,10 +60,7 @@ class ReadReceiptsView @JvmOverloads constructor(
|
||||||
receiptAvatars[index].visibility = View.INVISIBLE
|
receiptAvatars[index].visibility = View.INVISIBLE
|
||||||
} else {
|
} else {
|
||||||
receiptAvatars[index].visibility = View.VISIBLE
|
receiptAvatars[index].visibility = View.VISIBLE
|
||||||
avatarRenderer.render(
|
avatarRenderer.render(receiptData.toMatrixItem(), receiptAvatars[index])
|
||||||
MatrixItem.UserItem(receiptData.userId, receiptData.displayName, receiptData.avatarUrl),
|
|
||||||
receiptAvatars[index]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ package im.vector.riotx.features.home.room.detail.readreceipts
|
||||||
|
|
||||||
import com.airbnb.epoxy.TypedEpoxyController
|
import com.airbnb.epoxy.TypedEpoxyController
|
||||||
import im.vector.matrix.android.api.session.Session
|
import im.vector.matrix.android.api.session.Session
|
||||||
import im.vector.matrix.android.api.util.MatrixItem
|
|
||||||
import im.vector.riotx.core.date.VectorDateFormatter
|
import im.vector.riotx.core.date.VectorDateFormatter
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.ReadReceiptData
|
import im.vector.riotx.features.home.room.detail.timeline.item.ReadReceiptData
|
||||||
|
import im.vector.riotx.features.home.room.detail.timeline.item.toMatrixItem
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ class DisplayReadReceiptsController @Inject constructor(private val dateFormatte
|
||||||
val timestamp = dateFormatter.formatRelativeDateTime(it.timestamp)
|
val timestamp = dateFormatter.formatRelativeDateTime(it.timestamp)
|
||||||
DisplayReadReceiptItem_()
|
DisplayReadReceiptItem_()
|
||||||
.id(it.userId)
|
.id(it.userId)
|
||||||
.matrixItem(MatrixItem.UserItem(it.userId, it.displayName, it.avatarUrl))
|
.matrixItem(it.toMatrixItem())
|
||||||
.avatarRenderer(avatarRender)
|
.avatarRenderer(avatarRender)
|
||||||
.timestamp(timestamp)
|
.timestamp(timestamp)
|
||||||
.addIf(session.myUserId != it.userId, this)
|
.addIf(session.myUserId != it.userId, this)
|
||||||
|
|
|
@ -55,7 +55,7 @@ abstract class MergedHeaderItem : BaseEventItem<MergedHeaderItem.Holder>() {
|
||||||
val data = distinctMergeData.getOrNull(index)
|
val data = distinctMergeData.getOrNull(index)
|
||||||
if (data != null && view is ImageView) {
|
if (data != null && view is ImageView) {
|
||||||
view.visibility = View.VISIBLE
|
view.visibility = View.VISIBLE
|
||||||
attributes.avatarRenderer.render(MatrixItem.UserItem(data.userId, data.memberName, data.avatarUrl), view)
|
attributes.avatarRenderer.render(data.toMatrixItem(), view)
|
||||||
} else {
|
} else {
|
||||||
view.visibility = View.GONE
|
view.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,8 @@ abstract class MergedHeaderItem : BaseEventItem<MergedHeaderItem.Holder>() {
|
||||||
val avatarUrl: String?
|
val avatarUrl: String?
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun Data.toMatrixItem() = MatrixItem.UserItem(userId, memberName, avatarUrl)
|
||||||
|
|
||||||
data class Attributes(
|
data class Attributes(
|
||||||
val isCollapsed: Boolean,
|
val isCollapsed: Boolean,
|
||||||
val mergeData: List<Data>,
|
val mergeData: List<Data>,
|
||||||
|
|
|
@ -37,8 +37,7 @@ data class MessageInformationData(
|
||||||
val readReceipts: List<ReadReceiptData> = emptyList()
|
val readReceipts: List<ReadReceiptData> = emptyList()
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
val matrixItem: MatrixItem
|
val matrixItem = MatrixItem.UserItem(senderId, memberName?.toString(), avatarUrl)
|
||||||
get() = MatrixItem.UserItem(senderId, memberName?.toString(), avatarUrl)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
|
@ -56,3 +55,5 @@ data class ReadReceiptData(
|
||||||
val displayName: String?,
|
val displayName: String?,
|
||||||
val timestamp: Long
|
val timestamp: Long
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|
||||||
|
fun ReadReceiptData.toMatrixItem() = MatrixItem.UserItem(userId, displayName, avatarUrl)
|
||||||
|
|
Loading…
Reference in New Issue