xabaras/RecyclerViewSwipeDecorator

[Question] Revert Swipe

kariot opened this issue ยท 7 comments

I need to implement bouncing swipe to a viewHolder so is it possible to reset the bounce on swipe

Yeah I have the same question ๐Ÿ‘

Do you want the row to bounce back if you put the finger off in the middle of the swipe?
Doesn't it work like this yet?
I don't seem to get the point...

Do you want the row to bounce back if you put the finger off in the middle of the swipe? Doesn't it work like this yet? I don't seem to get the point...

Yes, I want the row to bounce back to the center when finger is taken

Do you want the row to bounce back if you put the finger off in the middle of the swipe? Doesn't it work like this yet? I don't seem to get the point...

Yes, I want the row to bounce back to the center when finger is taken

You can refresh items on RecyclerView adapter, it will do the trick:

override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
    // bounce back decorated row by refreshing adapter's items
    adapter.notifyItemRangeChanged(0, adapter.items.size)
}

Aside from redrawing the recyclerview, the Is there any way to reset the recyclerview line to the original state rather than the icon filling the whole line? I am not going to remove the swiped line; I will just show a dialogview so I want the line to be in place after the swipe?

You don't need to redraw the whole RecyclerView, you can just call adapter.notifyItemChanged on holder.getAbsoluteAdapterPosition() to redraw the swiped line.

You don't need to redraw the whole RecyclerView, you can just call adapter.notifyItemChanged on holder.getAbsoluteAdapterPosition() to redraw the swiped line.

Yeah, that is what i decided to go with :) thanks.