2018-10-29 16:48:31 +00:00
|
|
|
package im.vector.riotredesign.features.home.room.detail
|
2018-10-19 13:30:40 +00:00
|
|
|
|
|
|
|
import com.airbnb.epoxy.EpoxyAsyncUtil
|
|
|
|
import com.airbnb.epoxy.EpoxyModel
|
|
|
|
import com.airbnb.epoxy.paging.PagedListEpoxyController
|
|
|
|
import im.vector.matrix.android.api.session.events.model.Event
|
2018-10-28 18:18:14 +00:00
|
|
|
import im.vector.riotredesign.features.home.LoadingItemModel_
|
2018-10-19 13:30:40 +00:00
|
|
|
|
|
|
|
class TimelineEventController : PagedListEpoxyController<Event>(
|
2018-10-19 18:34:54 +00:00
|
|
|
diffingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler()
|
2018-10-19 13:30:40 +00:00
|
|
|
) {
|
|
|
|
|
|
|
|
override fun buildItemModel(currentPosition: Int, item: Event?): EpoxyModel<*> {
|
|
|
|
return if (item == null) {
|
|
|
|
LoadingItemModel_().id(-currentPosition)
|
|
|
|
} else {
|
2018-10-22 17:36:29 +00:00
|
|
|
TimelineEventItem(item.toString()).id(item.eventId)
|
2018-10-19 13:30:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
init {
|
|
|
|
isDebugLoggingEnabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onExceptionSwallowed(exception: RuntimeException) {
|
|
|
|
throw exception
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|