So, I am currently supporting development efforts for an Android App that was previously developed by an entirely different group of developers.
As part of my ongoing support efforts, we had upgraded the TargetSdkVersion from 23 to 28, and accordingly, all the dependencies and support-libraries, and appcompat-libraries as well.
However, with the upgrade of recyclerview library, we have begun noticing a peculiar problem with the Infinite Scrolling enabled implementation for RecyclerView in the App.
Following is observed.
Launch the App. Visit any Activity, Fragment or View that hosts a RecyclerView.
Scroll-up. Tap on any card displayed in the RecyclerView. Will launch a new Activity or Fragment with details of info inside that tapped Card.
Go back, close the existing Details Info view.
In v28, the RecyclerView just comes back showing from the beginning of the scroll. The View does not auto-scroll or anything, it just presents itself with the very first item only.
In v23, the RecyclerView retained the previous state, as in the set of Children that was displayed prior to tapping on a Card and launching a new Activity, Fragment or View, was what is displayed without any changes or auto-scrolls.
The worst part, v28, nothing will retain the RecyclerView's state. Such as, invoking LayoutManager.onSaveInstanceState() in onPause(), storing that as a Parcelable and applying that in onResume() as LayoutManager.onRestoreInstanceState(Parcelable state) won't work. Otherwise, LayoutManager.findFirstVisibleItemPosition(), followed by calculating the firstVisibleItemPositionOffset in the onPause(), and using them both on LayoutManager.smoothScrollWithOffset in onResume(), none of the strategies seem to work.
Is GridLayoutManager broken and not retaining state in RecyclerView-v7:28.0.0?
What was the last version when RecyclerView retained it's state between activities and windows, and even orientation changes?