jama5262 / CarouselView

An android carousel library for RecyclerView
https://jitpack.io/#jama5262/CarouselView
MIT License
236 stars 47 forks source link

setCurrentItem func bug - java #19

Open galgistmd opened 4 years ago

galgistmd commented 4 years ago

Hi, the carousel view works very well, unfortunately I tried using the setCurrentItem() I found a really weird bug about it even though I can't tell something specific.

So what I have created is just the carousel view and each time the user clicks a button it keeps going to the next item.

THE BUG: When i'm on the first item and setting current item to the next one (index:1) it doesn't respond. only when I "treat" the index as normal page number it scrolls to the next item. but, the problem doesn't solve here, when im clicking to move on to the third item it sometimes responds and sometimes not. If I'm lucky and it went to the third item when im clicking the button again it jumps to the sevenths item. By the way, I have checked my counter multiple times and it's not the problem.

BASIC CODE: button_next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.e("clicked","next"); if(carouselView!=null) { index++; carouselView.setCurrentItem(index); } } });

Thanks.

jama5262 commented 4 years ago

@galgistmd I think, that on some screen sizes do not respond well, but not very sure. I will investigate more and experiment on different screen sizes if that is the case