I am using the Paging library from Android Jetpack to have a paged loading behavior in my RecyclerView
. I'm loading directly from network so I don't have any intermediate in-memory cache or database. Whenever something changes I call invalidate()
on DataSource
(in my case PositionalDataSource
) so that the list is refreshed.
What I need is very simple thing - once I call invalidate()
the recycler view is fully cleaned up and shows empty data. I need the recycler view to keep the old data and update normally once the new data comes in. In most of the cases the update might be very small, like a button color change in couple of rows, it looks ugly when the RecyclerView
shows empty content for couple of seconds while I'm loading data from backend.
Can this somehow be done or is there a conceptual limitation of the current Paging library architecture forcing me to implement my own caching?