Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Use built in animation #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

HelloThisIsFlo
Copy link

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.

@HelloThisIsFlo
Copy link
Author

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.

@krossovochkin
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants