basshelal / BoardView

🚧Work In Progress🚧 Android library for easy to use Kanban Boards
3 stars 0 forks source link

Investigate a way to make swap animations be done concurrently instead of in bulk #4

Open basshelal opened 4 years ago

basshelal commented 4 years ago

Currently, a fast swap within the same list will make bulk animations, meaning that 3 or 4 items will move all at once together instead of one by one concurrently.

ItemTouchHelper has a concurrent animation style which looks more responsive and fluid. We need to investigate ways to make our animations like this.

basshelal commented 4 years ago

This has to do with when runPendingAnimations is called and how all animations are bulked up and run together.

A null ItemAnimator will always instantly make the swap, similarly an ItemAnimator with a moveDuration of 0 will always have instant swaps.

We need to see if we can have animations instantly start without needing to bulk them up.

basshelal commented 4 years ago

This is proving more difficult than I had originally anticipated, it seems that this will always happen because of how and when the translate animation happens so it will always have multiple items moving in a "bulked" up way so that it seems they are all moving in one chunk together even thoufh technically they are all separate animations unaware of each other.

I tested this even without any move animations running in runPendingAnimations and having all swaps be done instantaneously and all move animations starting instantaneously and no luck still, the items will always want to animate in this way. I don't know how ItemTouchHelper is animating things but from the looks of it, it looks custom, hence the smooth look.

I won't close this because I'd still like this in the future at some point but it's not a priority right now.

basshelal commented 4 years ago

Minor update:

I'm an idiot, I thought it was ItemTouchHelper doing those fluid animations, turns out it's View.startDragAndDrop().

Doesn't change much really but just a clarification!