BeksOmega / looping-layout

A looping LayoutManager for the Android RecyclerView.
Apache License 2.0
274 stars 16 forks source link

fix: shrink adapter crash #62

Closed BeksOmega closed 3 years ago

BeksOmega commented 3 years ago

:clap: Resolves

Closes #61

:star2: Description

Fixes the bug by making sure the initial anchor index does not exceed the available indices. If the initial anchor index does initially exceed the available indices, the anchor index gets reset to the max available index.

This PR also updates the readme and build info.

:bug: Testing

You can see in this PR te modified ActivityHorizontal file, this was used to reproduce the bug.

1) Scroll so that the item labeled 10 is partially hidden by the left edge. 2) Hit the FAB. 3) Observe how the item labeled 9 is now partially hidden by the left edge, followed by 0, 1, 2, 3 etc. Observe how there was no crash.

All automated tests pass.

:thought_balloon: Other info

I'm posting this fix tonight, but I'm not going to merge and release it until tomorrow (since it's late where I am).