Do onSaveInstanceState(@NonNull Bundle outState) and onRestoreInstanceState(@Nullable Bundle inState) work for PagedListEpoxyController?
I am able to successfully save and restore scroll state of my RecyclerViews when I use TypedEpoxyControllers, but using the same pattern for a RecyclerView with PagedListEpoxyController doesn't seem to save and restore the scroll position/state when I navigate away and return to the fragment hosting the RecyclerView.
I found the solution to my own problem. Documenting here if anyone else runs into this problem...
When the fragment is first created, I observe the LiveData returned from LivePagedListBuilder().build() to get the pagedList.
Once this pagedList is obtained, I cache it.
And when navigating back to this previous fragment if it's on the backstack, I submit the cached, existing pagedList to the PagedListEpoxyController rather than loading a new one.
By reusing the existing pagedList, identical objects and models are presented to the epoxy controller to diff, and thus RecyclerView scroll state is preserved.
Do
onSaveInstanceState(@NonNull Bundle outState)
andonRestoreInstanceState(@Nullable Bundle inState)
work for PagedListEpoxyController?I am able to successfully save and restore scroll state of my RecyclerViews when I use TypedEpoxyControllers, but using the same pattern for a RecyclerView with PagedListEpoxyController doesn't seem to save and restore the scroll position/state when I navigate away and return to the fragment hosting the RecyclerView.