Closed vkotovv closed 5 years ago
Hi,
You can enable/disable swipe gesture for different ItemBinders. If you are using same ItemBinder, you have to override 'getSwipeDirections' and return different flags based on adapter position.
How do I get current position inside ViewHolder class (if I'm using the same binder)?
I've used a flag in my model to indicate if swipe is enabled. Thanks for the info!
Here is the code in my ViewHolder:
override fun getSwipeDirections(): Int {
return if (item.canSwipe) {
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
} else {
0
}
}
Swipe to dismiss feature is working nice, thanks. But can I disable this feature for certain positions/items (e.g. first item) in the RecyclerView? I'd like to use the same section for all items, because they are literally the same.
I'm using 3.x branch.