Add long click support on unsupported event

This commit is contained in:
Benoit Marty 2019-08-28 18:17:37 +02:00
parent ef0362ba9c
commit c95223f5d2
2 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,7 @@ class DefaultItemFactory @Inject constructor(private val avatarRenderer: AvatarR
.avatarRenderer(avatarRenderer)
.highlighted(highlight)
.informationData(informationData)
.baseCallback(callback)
.readReceiptsCallback(callback)
}


View File

@ -34,6 +34,13 @@ abstract class DefaultItem : BaseEventItem<DefaultItem.Holder>() {
@EpoxyAttribute
lateinit var avatarRenderer: AvatarRenderer

@EpoxyAttribute
var baseCallback: TimelineEventController.BaseCallback? = null

private var longClickListener = View.OnLongClickListener {
return@OnLongClickListener baseCallback?.onEventLongClicked(informationData, null, it) == true
}

@EpoxyAttribute
var readReceiptsCallback: TimelineEventController.ReadReceiptsCallback? = null

@ -47,6 +54,7 @@ abstract class DefaultItem : BaseEventItem<DefaultItem.Holder>() {
override fun bind(holder: Holder) {
holder.messageView.text = text

holder.view.setOnLongClickListener(longClickListener)
holder.readReceiptsView.render(informationData.readReceipts, avatarRenderer, _readReceiptsClickListener)
}