Skip to content

Instantly share code, notes, and snippets.

@robertlevonyan
Created February 9, 2021 12:17
Show Gist options
  • Save robertlevonyan/e7aa4f5b99da403caad7be68d49f1201 to your computer and use it in GitHub Desktop.
Save robertlevonyan/e7aa4f5b99da403caad7be68d49f1201 to your computer and use it in GitHub Desktop.
drop item into recyclerview
class DropListener(private val onDrop: () -> Unit) : View.OnDragListener {
override fun onDrag(view: View, dragEvent: DragEvent): Boolean {
when (dragEvent.action) {
// when item has been dropped, notify about it
DragEvent.ACTION_DROP -> onDrop()
}
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment