BeksOmega / looping-layout

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

Last item not visible - onLayoutChildren error #68

Open anthonyshim opened 2 years ago

anthonyshim commented 2 years ago

:bug: Describe

If the list is redrawn when the first item visible on the screen is out of the screen, the last item exposed on the screen is not drawn.

:snail: Steps to reproduce

  1. Scroll the list so that the first item is off-screen
  2. In this case, the last item visible on the screen is not all exposed and a part must be outside the screen.
  3. When RecyclerView's notifyDataSetChanged() function is called

:butterfly: Expected behavior

The last item is not drawn

:beetle: Other info

my fix suggestion

override fun onLayoutChildren(recycler: RecyclerView.Recycler, state: RecyclerView.State) {
...
            if (sizeFilled == 0) {
                sizeFilled = if (orientation == VERTICAL) {
                    layoutRect.top
                } else {
                    layoutRect.left
                }
            }
            sizeFilled += item.size

:bee: Requested assignment

If possible, I would like to fix this.

BeksOmega commented 2 years ago

Heyo! Thanks for filing this :D I don't think I quite understand how your fix would work, but if you want to dig into this and try to get it working, be my guest =)

If there's anything I can do to help, feel free to bump this issue with comments/questions.

Best of luck!