Open gnuyork opened 5 years ago
I fixed the second problem myself by adding the following code to the setSliderAdapter() method in the SliderView:
if (mSliderPager!=null && mCircularSliderHandle!=null){ mSliderPager.removeOnPageChangeListener(mCircularSliderHandle); } mCircularSliderHandle = new CircularSliderHandle(mSliderPager); mSliderPager.addOnPageChangeListener(mCircularSliderHandle);
The reason for the bug is that the RecyclerView doesn't create a new Slider for every entry but reuses the existing ones while scrolling to new elements and just updates their views. So the mCircularSliderHandle object isn't recreated every time, but used for multiple entries which makes the onPageScrollStateChanged() method in the CircularSliderHandle class executing
mSliderPager.setCurrentItem(0);
sometimes, which produces the behavior mentioned above.
Maybe you could add the lines above to the next release to fix it for other people that also use multiple Sliders in a RecyclerView.
@gnuyork could you please commit your fix? This is still an open bug
It seems that Version 1.3.5 fixed this issues. At least for me it did, but updating from 1.3.2 it was a breaking change to me as adapter handling seems to be changed
I've got two issues by using the slider nested in a recycler view:
Has anyone an idea how to fix this (esp. the second problem)?