Timeline : re-add hasReachedEnd condition to get a better display
This commit is contained in:
parent
2b66b4c4b7
commit
02254d5d31
|
@ -23,15 +23,19 @@ class TimelineEventController(private val roomId: String,
|
|||
|
||||
private var isLoadingForward: Boolean = false
|
||||
private var isLoadingBackward: Boolean = false
|
||||
private var hasReachedEnd: Boolean = false
|
||||
|
||||
var callback: Callback? = null
|
||||
|
||||
fun update(timelineData: TimelineData?) {
|
||||
isLoadingForward = timelineData?.isLoadingForward ?: false
|
||||
isLoadingBackward = timelineData?.isLoadingBackward ?: false
|
||||
submitList(timelineData?.events)
|
||||
timelineData?.let {
|
||||
isLoadingForward = it.isLoadingForward
|
||||
isLoadingBackward = it.isLoadingBackward
|
||||
hasReachedEnd = it.events.lastOrNull()?.root?.type == EventType.STATE_ROOM_CREATE
|
||||
submitList(it.events)
|
||||
requestModelBuild()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun buildItemModels(currentPosition: Int, items: List<EnrichedEvent?>): List<EpoxyModel<*>> {
|
||||
|
@ -72,7 +76,7 @@ class TimelineEventController(private val roomId: String,
|
|||
|
||||
LoadingItemModel_()
|
||||
.id(roomId + "backward_loading_item")
|
||||
.addIf(isLoadingBackward, this)
|
||||
.addIf(!hasReachedEnd, this)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue