Closed azizi436 closed 3 years ago
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
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 ?
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
Hi 1) Im using viewBinding in my project and now i want to use it for FastAdapter but i dont know what should i put in <> 2)What is the type and why we should use type exactly?
*my xml item class name is job_item and its Viewbinding is JobItemBinding