Stepper-Touch icon indicating copy to clipboard operation
Stepper-Touch copied to clipboard

Strange Behavior inside RecyclerView

Open Rudra-n-khatri opened this issue 5 years ago • 13 comments

I am using this inside my View Holder. But somehow when I scroll my recycler view too fast the values of the stepper gets increased automatically without doing anything. Sometimes it gets stuck also . I am using androidx and using java.

Also is there any way to use onClickListener for the add/minus button. I want to remove values from the list inside my adapter and I am kind of confused as to how to notify the adapter of the change in the list.

Rudra-n-khatri avatar Apr 02 '19 07:04 Rudra-n-khatri

Hmm, I'll have to investigate what is going on here.

DanielMartinus avatar Apr 02 '19 09:04 DanielMartinus

i have the same problem.

fhkuku avatar Aug 01 '20 23:08 fhkuku

Same problem friends... :(

ghost avatar Oct 15 '20 11:10 ghost

Any alternative library guys ? its seems the developer won't fix the issue

Dave181295 avatar Mar 17 '21 06:03 Dave181295

@Dave181295 My focus hasn't been on fixing stepper-touch right now indeed. In the meantime feel free to investigate this yourself of course since it's open-source and I'm accepting pull requests. I might have some time available soon but I'd encourage you to dive into this too and help if its very pressing

DanielMartinus avatar Mar 17 '21 13:03 DanielMartinus

Hello Daniel, thanks for your answer, I already tried to see where is the problem from, believe me if I knew how to fix it I would pr , please if you have some times take a look.

Dave181295 avatar Mar 17 '21 16:03 Dave181295

No problem, thanks for trying. I'll make some time coming weekend to investigate the issue 👍🏻

DanielMartinus avatar Mar 18 '21 11:03 DanielMartinus

To investigate this issue I've added a sample demonstrating stepper-touch being used in a list to the repository, if you build the demo app you can test it yourself.

After doing some tests I've not really found weird behaviour as described above:

But somehow when I scroll my recycler view too fast the values of the stepper gets increased automatically without doing anything.

below I've added a video of the demo app where all steppers have a value of 0. When I scroll very hard through a list of 100 items I don't see any stepper automatically increase its value.

https://user-images.githubusercontent.com/1636897/111917687-afd02480-8a81-11eb-9540-32d6ff69dfde.mp4

However, when I set the first stepper value to 1 and then scroll through the list you'll see other steppers also change its value to 1. This is expected behaviour because the steppers are being recycled and its not the steppers responsibility to restore its state within a RecyclerView. It's important to update the steppers to their value when they get visible again based on the index of the item in the adapter. See video below where this is reproduced:

https://user-images.githubusercontent.com/1636897/111917881-7e0b8d80-8a82-11eb-9a75-a2d2769301bb.mp4

So my question is, based on the information provided above. What are you experiencing and what is exactly broken? Any information would help so I can investigate the issue better. Even better is providing an example project of course.

DanielMartinus avatar Mar 21 '21 19:03 DanielMartinus

When I got for example 50 items in a recycler, and select one, then scroll. I got 10 more products (items) selected.. when I bind the recycler I make the stepper item view count = 0 and on callback it increment/decrement ... there is a problem 100% sure

Dave181295 avatar Mar 21 '21 22:03 Dave181295

To be able to reproduce it myself I need some more information since I wasn't able to reproduce the issue in the demo project that you can find in the repository.

Perhaps you can share some of the code of the stepper in your recyclerview item so that I can initialize it the same way as you do and see whether that works. Otherwise I'd encourage to share a demo project where you can reproduce the issue.

DanielMartinus avatar Mar 22 '21 08:03 DanielMartinus

I want to share you a video of my project but it is private because still not released, maybe we can continue on TeamViewer so it's even better you see it in live ?

Dave181295 avatar Mar 22 '21 15:03 Dave181295

Oh by the way, I'm using a gridLayoutManager, maybe its related, can you try with it ? so there is 2/4 items visible at the same time

Dave181295 avatar Mar 22 '21 16:03 Dave181295

Is it also possible to share some details on how you're initializing the Stepper Touch? Are you doing anything in the onCreateViewHolder and what are you doing in the onBindViewHolder with the StepperTouch?

If you can't share the code it would be helpful to know a little what you're doing by describing, I don't need a copy of the exact code

DanielMartinus avatar Mar 22 '21 16:03 DanielMartinus