Skip to content

Instantly share code, notes, and snippets.

@vshkl
Created November 15, 2020 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vshkl/e00e27d783e870822d31eab8b7d1c3df to your computer and use it in GitHub Desktop.
Save vshkl/e00e27d783e870822d31eab8b7d1c3df to your computer and use it in GitHub Desktop.
@EpoxyModelClass(layout = R.layout.item_model_row)
abstract class RowEpoxyModel : EpoxyModelWithHolder<RowViewHolder>() {
@EpoxyAttribute lateinit var rowId: String
@EpoxyAttribute lateinit var title: String
@EpoxyAttribute(DoNotHash) var onDragHandleTouchListener: OnTouchListener? = null
@SuppressLint("ClickableViewAccessibility")
override fun bind(holder: RowViewHolder) {
with(holder) {
tvTitle.text = title
ivDragHandle.setOnTouchListener(onDragHandleTouchListener)
}
}
@SuppressLint("ClickableViewAccessibility")
override fun unbind(holder: RowViewHolder) {
with(holder) {
ivDragHandle.setOnTouchListener(onDragHandleTouchListener)
}
}
class RowViewHolder : KotlinEpoxyHolder() {
val tvTitle by bind<TextView>(R.id.tv_title)
val ivDragHandle by bind<ImageView>(R.id.iv_drag_handle)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment