Skip to content

Instantly share code, notes, and snippets.

@SG-K
Created January 7, 2021 09:24
class ReorderViewHolder(val binding: AdapterReorderBinding,
val dragStartListener : OnStartDragListener? = null)
: RecyclerView.ViewHolder(binding.root) {
fun setData(data: ItemModel) {
itemView.apply {
binding.tvAdapter.text = data.title
binding.imReorder?.setOnTouchListener(View.OnTouchListener { v, event ->
if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
dragStartListener?.onStartDrag(this@ReorderViewHolder)
}
false
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment