xaverkapeller / SortedListAdapter

The RecyclerView.Adapter that makes your life easy!
https://wrdlbrnft.github.io/SortedListAdapter/
MIT License
49 stars 13 forks source link

How to implement swipe to delete in SortedListAdapter #3

Closed yaturner closed 7 years ago

yaturner commented 7 years ago

I am a big fan of your sortedListAdapter, I have implemented search and databinding and I am very pleased with the results. I would now like to implement swipe to delete, but I am unsure of how to do it, can you help me?

xaverkapeller commented 7 years ago

You implement it just like with any other Adapter. The RecyclerView comes with a helper class to simplify implementing swipe to dismiss as well as drag & drop patterns, it's called ItemTouchHelper. You can find more information about it here. If you want a more in depth guide just google around a bit.

yaturner commented 7 years ago

thank you for your help, I am a little lost though, the example I found overrides onBindViewHolder to check for pending delete. I tried overriding the method in my adapter which extends SortedListAdapter, but i get an error from Java about the override having the same erasure as the method in SortedListAdapter. Do I need to implement it in your code? Also the code assumes that I can access the List for the ListView in the adapter, how do I do that. Sorry to sound so stupid but I am using RecyclerView for the first time.

On Wed, Apr 26, 2017 at 3:31 AM, Xaver Kapeller notifications@github.com wrote:

Closed #3 https://github.com/Wrdlbrnft/SortedListAdapter/issues/3.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Wrdlbrnft/SortedListAdapter/issues/3#event-1058313658, or mute the thread https://github.com/notifications/unsubscribe-auth/AAj-E3jgdr3ctW4-z7zs2kFNNN1YwEwgks5rzxzlgaJpZM4NIRmR .