Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Version used: 1.2.1
Devices/Android versions reproduced on: Any
Sample project:
Video of behavior:
In the video, I'm just changing the background to cause a layout to happen and it scrolls to the previous item on its own during the layout.
To reproduce:
1. click on the scroll to item 30 button at the top
2. wait for scroll to complete
3. click on item 30
4. observe that item 30 is scrolled off the screen and you are now looking at item 29
5. repeat by clicking on new main item on screen and you can keep scrolling up.
I took quite a bit of time to investigate and found this is caused by a bug in GridLayoutManager's overridden findReferenceChild() method. In the if:
} else if (mOrientationHelper.getDecoratedStart(view) >= boundsEnd
|| mOrientationHelper.getDecoratedEnd(view) < boundsStart) {
The second part should be mOrientationHelper.getDecoratedEnd(view) <= boundsStart. Adding the = fixes the bug. This is what the check looks like in the LinearLayoutManager version, and that one also has a little more logic around 0 height views which maybe should be in this method as well.
Thanks,
Jess