viewBinding issue
azizi436 opened this issue · 3 comments
azizi436 commented
mikepenz commented
class GalleryItem(...) : AbstractBindingItem<GalleryItemBinding>() {
override val type: Int
get() = R.id.gallery_item
override fun bindView(binding: GalleryItemBinding, payloads: List<Any>) {
super.bindView(binding, payloads)
...
}
override fun createBinding(inflater: LayoutInflater, parent: ViewGroup?): GalleryItemBinding {
return GalleryItemBinding.inflate(inflater, parent, false)
}
}
A sample could look like
azizi436 commented
class GalleryItem(...) : AbstractBindingItem<GalleryItemBinding>() { override val type: Int get() = R.id.gallery_item override fun bindView(binding: GalleryItemBinding, payloads: List<Any>) { super.bindView(binding, payloads) ... } override fun createBinding(inflater: LayoutInflater, parent: ViewGroup?): GalleryItemBinding { return GalleryItemBinding.inflate(inflater, parent, false) } }
A sample could look like
Ok thanks, but how can i use position ( i mean item position ) in bindView ?
mikepenz commented
That's not supported with this item. you can look at the base abstract code: https://github.com/mikepenz/FastAdapter/blob/develop/library-extensions-binding/src/main/java/com/mikepenz/fastadapter/binding/AbstractBindingItem.kt#L18
and adjust it so you get the adapterPosition
of the ViewHolder