mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Adding helper methods for ViewState
This commit is contained in:
parent
4f5d151f0b
commit
171717bcd1
@ -30,4 +30,7 @@ data class RoomPollsViewState(
|
|||||||
) : MavericksState {
|
) : MavericksState {
|
||||||
|
|
||||||
constructor(roomProfileArgs: RoomProfileArgs) : this(roomId = roomProfileArgs.roomId)
|
constructor(roomProfileArgs: RoomProfileArgs) : this(roomId = roomProfileArgs.roomId)
|
||||||
|
|
||||||
|
fun hasNoPolls() = polls.isEmpty()
|
||||||
|
fun hasNoPollsAndCanLoadMore() = !isSyncing && hasNoPolls() && canLoadMore
|
||||||
}
|
}
|
||||||
|
@ -119,11 +119,10 @@ abstract class RoomPollsListFragment :
|
|||||||
canLoadMore = viewState.canLoadMore,
|
canLoadMore = viewState.canLoadMore,
|
||||||
nbLoadedDays = viewState.nbLoadedDays,
|
nbLoadedDays = viewState.nbLoadedDays,
|
||||||
)
|
)
|
||||||
views.roomPollsEmptyTitle.isVisible = viewState.polls.isEmpty() && !viewState.isSyncing
|
views.roomPollsEmptyTitle.isVisible = !viewState.isSyncing && viewState.hasNoPolls()
|
||||||
views.roomPollsLoadMoreWhenEmpty.isVisible = viewState.polls.isEmpty() && viewState.canLoadMore && !viewState.isSyncing
|
views.roomPollsLoadMoreWhenEmpty.isVisible = viewState.hasNoPollsAndCanLoadMore()
|
||||||
views.roomPollsLoadMoreWhenEmptyProgress.isVisible = viewState.polls.isEmpty() && viewState.canLoadMore &&
|
views.roomPollsLoadMoreWhenEmpty.isEnabled = !viewState.isLoadingMore
|
||||||
viewState.isLoadingMore && !viewState.isSyncing
|
views.roomPollsLoadMoreWhenEmptyProgress.isVisible = viewState.hasNoPollsAndCanLoadMore() && viewState.isLoadingMore
|
||||||
views.roomPollsLoadMoreWhenEmptyProgress.isEnabled = !viewState.isLoadingMore
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPollClicked(pollId: String) {
|
override fun onPollClicked(pollId: String) {
|
||||||
|
Loading…
Reference in New Issue
Block a user