Android-SwipeToDismiss-RecyclerView
Android-SwipeToDismiss-RecyclerView copied to clipboard
Use built in animation
Hi,
Instead of using a custom animation in performDismiss(), I used the built in remove animation set in the recyclerView. This way, no need to track items to delete during animations, and every item is deleted on the spot. However this method only allow to dismiss ONE item at a time. But I don't see why it would be a problem. I disabled the touchListener when an animation is already running.
Pros :
- Use built in animation
- No need to track items to delete
- Animation easily customizable
- Works perfectly with all layout managers, not only ListView
Cons :
- Only one swipe at a time
If I missed something or misunderstood, please let me know. It's my very first pull request . . . ever. So even if you don't like what I did I would awesome if you could give me a feedback :D
Anyway thanks for the great work, you have no idea how helpful your project was for me to understand how to implement swipe to dismiss.
Oh yeah, almost forgot : I also used a different layout with two buttons for the list items to ensure that the touchlistener did not intercept touch event on the buttons.
Hi!
Sorry for late response. Thanks for your solution. I doubt that this is a good way to allow only one dismiss at the time (looking at the UX). But it an easiest way of how to avoid some problems.
I think your solution could be added optionally, if somebody really needs native animations support. I think that I'll try to add your solution somehow.
But I can't merge you branch, because in your solution there is blinking on dismiss. Looks like there is a problem with setting alpha somewhere.
Thanks.