Created
November 15, 2020 13:58
-
-
Save vshkl/e00e27d783e870822d31eab8b7d1c3df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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