Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by zero crash when calling notifydatasetchanged during scroll animation #31

Open
alexwyattdev opened this issue Sep 22, 2022 · 1 comment

Comments

@alexwyattdev
Copy link

java.lang.ArithmeticException: divide by zero
at com.jackandphantom.carouselrecyclerview.CarouselLayoutManager.onSelectedCallback(CarouselLayoutManager.kt:559)

selectedPosition = abs(selectedPosition % itemCount)

Example for reproducing the issue:

  1. Have a carousel recyclerview in a layout under SwipeRefreshLayout
  2. Use the SwipeRefreshLayout to load the list items using notifydatasetchanged on the adapter while the carousel is inbetween 2 items

Tried invalidation, canceling animations, removing all views - to no avail.

@alexwyattdev
Copy link
Author

Workaround solution I found is to manually inflate the CarouselRecyclerView into the layout when data is ready, then before refreshing, remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant