Problem Statement: Using Paging3 library and need to show loading information in header when user swipes to refresh. I followed the sample provided in the here.
Solution: Tried adding refresh header in LoadStateAdapter
for with using pagingAdapter.withLoadStateHeaderAndFooter()
.
messagesRecyclerView.adapter = messagesAdapter.withLoadStateHeaderAndFooter(
header = MessageHeaderStateAdapter(messagesAdapter),
footer = MessageLoadStateAdapter()
)
But it does not shows the header until I swipe it 5-6 times in quick successions.
Footer, on other hand, shows just fine with loading more and error layouts based on LoadState
.
Error State
Loading More State
Any pointers as to how this can be achieved are much appreciated.