2019-06-05 17:23:57 +00:00
|
|
|
package im.vector.riotredesign.features.home.room.detail.timeline.action
|
|
|
|
|
2019-06-06 10:59:26 +00:00
|
|
|
import android.graphics.Typeface
|
2019-06-05 17:23:57 +00:00
|
|
|
import android.widget.TextView
|
|
|
|
import androidx.core.view.isVisible
|
|
|
|
import com.airbnb.epoxy.EpoxyAttribute
|
|
|
|
import com.airbnb.epoxy.EpoxyModelClass
|
|
|
|
import com.airbnb.epoxy.EpoxyModelWithHolder
|
|
|
|
import im.vector.riotredesign.R
|
|
|
|
import im.vector.riotredesign.core.epoxy.VectorEpoxyHolder
|
|
|
|
|
2019-06-06 10:59:26 +00:00
|
|
|
/**
|
|
|
|
* Item displaying an emoji reaction (single line with emoji, author, time)
|
|
|
|
*/
|
2019-06-05 17:23:57 +00:00
|
|
|
@EpoxyModelClass(layout = R.layout.item_simple_reaction_info)
|
|
|
|
abstract class ReactionInfoSimpleItem : EpoxyModelWithHolder<ReactionInfoSimpleItem.Holder>() {
|
|
|
|
|
|
|
|
@EpoxyAttribute
|
|
|
|
lateinit var reactionKey: CharSequence
|
|
|
|
@EpoxyAttribute
|
|
|
|
lateinit var authorDisplayName: CharSequence
|
|
|
|
@EpoxyAttribute
|
|
|
|
var timeStamp: CharSequence? = null
|
|
|
|
|
2019-06-06 10:59:26 +00:00
|
|
|
@EpoxyAttribute
|
|
|
|
var emojiTypeFace: Typeface? = null
|
|
|
|
|
2019-06-05 17:23:57 +00:00
|
|
|
override fun bind(holder: Holder) {
|
2019-06-06 10:59:26 +00:00
|
|
|
holder.emojiReactionView.text = reactionKey
|
|
|
|
holder.emojiReactionView.typeface = emojiTypeFace ?: Typeface.DEFAULT
|
2019-06-05 17:23:57 +00:00
|
|
|
holder.displayNameView.text = authorDisplayName
|
|
|
|
timeStamp?.let {
|
|
|
|
holder.timeStampView.text = it
|
|
|
|
holder.timeStampView.isVisible = true
|
|
|
|
} ?: run {
|
|
|
|
holder.timeStampView.isVisible = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Holder : VectorEpoxyHolder() {
|
2019-06-06 10:59:26 +00:00
|
|
|
val emojiReactionView by bind<TextView>(R.id.itemSimpleReactionInfoKey)
|
2019-06-05 17:23:57 +00:00
|
|
|
val displayNameView by bind<TextView>(R.id.itemSimpleReactionInfoMemberName)
|
|
|
|
val timeStampView by bind<TextView>(R.id.itemSimpleReactionInfoTime)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|