|
|
@@ -34,12 +34,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
|
|
) {
|
|
|
when (holder) {
|
|
|
is BookViewHolder -> (getItem(position) as? Book)?.let {
|
|
|
- holder.registerListener(position)
|
|
|
+ holder.registerListener(it)
|
|
|
holder.onBind(it, position, payloads)
|
|
|
}
|
|
|
|
|
|
is GroupViewHolder -> (getItem(position) as? BookGroup)?.let {
|
|
|
- holder.registerListener(position)
|
|
|
+ holder.registerListener(it)
|
|
|
holder.onBind(it, position, payloads)
|
|
|
}
|
|
|
}
|
|
|
@@ -78,12 +78,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun registerListener(position: Int) {
|
|
|
+ fun registerListener(item: Any) {
|
|
|
binding.root.setOnClickListener {
|
|
|
- callBack.onItemClick(position)
|
|
|
+ callBack.onItemClick(item)
|
|
|
}
|
|
|
binding.root.onLongClick {
|
|
|
- callBack.onItemLongClick(position)
|
|
|
+ callBack.onItemLongClick(item)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -128,12 +128,12 @@ class BooksAdapterGrid(context: Context, callBack: CallBack) :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun registerListener(position: Int) {
|
|
|
+ fun registerListener(item: Any) {
|
|
|
binding.root.setOnClickListener {
|
|
|
- callBack.onItemClick(position)
|
|
|
+ callBack.onItemClick(item)
|
|
|
}
|
|
|
binding.root.onLongClick {
|
|
|
- callBack.onItemLongClick(position)
|
|
|
+ callBack.onItemLongClick(item)
|
|
|
}
|
|
|
}
|
|
|
|