alirezat775/carousel-view

Smooth scroll to position is called in onScrollStatechanged in CarouselView.kt

reejeshpkmnx opened this issue · 3 comments

The logcat was full of this message:
E/RecyclerView: Smooth Scroll action is being updated too frequently. Make sure you are not changing it unless necessary

This may impact performance I guess, so checked the code, searched about it and found that smoothscroll must have been called from https://github.com/sofakingforever answer.

So checked out the code and saw the following in CarouselView.kt:

  override fun onScrollStateChanged(state: Int) {
        super.onScrollStateChanged(state)
        if (state == SCROLL_STATE_IDLE) {
            //scrolling(0)                                  //this line was the issue
            if (isAutoScroll) {
                getScheduler()?.start()
            }

            if (currentPosition == 0)
                reverseLoop = true
            else if (currentPosition == adapter!!.itemCount - 1)
                reverseLoop = false
        }
    }

so, just imported the project as a gradle project and commented out the scrolling(0), and the issue was fixed.

Hi, I have the same thing, and checked too; it is indeed a bug and the solution seems to be this.

This could be great to have a fixed version for this !

I tried to create a commit and a pull request ,as said in the readme, but I don't have permission tu push on a branch of the project.

Hey, @alirezat775 could you do this ? :D

Hi @Bloubloublou,
I will be grateful if you fork and create a new branch from the development and commit your change and send a pull request for the development branch

Thank you, done :D