mikepenz/FastAdapter

Question: I'd like an item to select when the user touches it to swipe

kenargo opened this issue · 6 comments

I've searched the various swipe issues list but have not been able to locate any setting that would allow an item to be selected when the user touches it for swipe.

Yes, if the user selects that item, that works but it's possible to touch and swipe without actually selecting an item. Is there a setting or method that would allow me to obtain this behavior?

I tried using the swipe callback and setting the selection state but that continually closes the swipe and resetting the item's state.

I figure that there might be some way to make that work but wanted to check for something less cumbersome before going down that path.

@kenargo there's nothing built in to directly select while the user is still swiping.

The list will update as a select triggers a notify of the adapter updating the item.

What you could maybe do is, to make the item selected and then either don't notify the adapter or you notify the adapter that the item was changed and also providing a payload and then handle it accordingly within the item

https://github.com/mikepenz/FastAdapter/blob/develop/fastadapter/src/main/java/com/mikepenz/fastadapter/select/SelectExtension.kt#L300-L302

you can notify with a payload, this gives you the possibility to manually do only a partial update of the view, e.g. set the selected background state. instead of a full notify

We've recently done that, using https://github.com/MFlisar/DragSelectRecyclerView as inspiration

See avluis/Hentoid@4355feb

The additional code plays very nice with FastAdapter

Thanks @RobbWatershed for answering.