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 isLoadingForward: Boolean = false
|
||||||
private var isLoadingBackward: Boolean = false
|
private var isLoadingBackward: Boolean = false
|
||||||
|
private var hasReachedEnd: Boolean = false
|
||||||
|
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
|
||||||
fun update(timelineData: TimelineData?) {
|
fun update(timelineData: TimelineData?) {
|
||||||
isLoadingForward = timelineData?.isLoadingForward ?: false
|
timelineData?.let {
|
||||||
isLoadingBackward = timelineData?.isLoadingBackward ?: false
|
isLoadingForward = it.isLoadingForward
|
||||||
submitList(timelineData?.events)
|
isLoadingBackward = it.isLoadingBackward
|
||||||
|
hasReachedEnd = it.events.lastOrNull()?.root?.type == EventType.STATE_ROOM_CREATE
|
||||||
|
submitList(it.events)
|
||||||
requestModelBuild()
|
requestModelBuild()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun buildItemModels(currentPosition: Int, items: List<EnrichedEvent?>): List<EpoxyModel<*>> {
|
override fun buildItemModels(currentPosition: Int, items: List<EnrichedEvent?>): List<EpoxyModel<*>> {
|
||||||
|
@ -72,7 +76,7 @@ class TimelineEventController(private val roomId: String,
|
||||||
|
|
||||||
LoadingItemModel_()
|
LoadingItemModel_()
|
||||||
.id(roomId + "backward_loading_item")
|
.id(roomId + "backward_loading_item")
|
||||||
.addIf(isLoadingBackward, this)
|
.addIf(!hasReachedEnd, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue