Guruh: 314-17 Bajardi: Ne’matjonov A


class CategoryItemAdapter( var


Download 1.68 Mb.
bet19/22
Sana08.01.2022
Hajmi1.68 Mb.
#247739
1   ...   14   15   16   17   18   19   20   21   22
Bog'liq
Ne'matjonov Abduvohid

class CategoryItemAdapter(

var data: ArrayList,

var onItemClickListener: HomeAdapter.OnItemClickListener?

):RecyclerView.Adapter() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CategoryItemViewHolder {

var holder=CategoryItemViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_category,parent,false))

return holder

}

override fun getItemCount(): Int=data.size



override fun onBindViewHolder(holder: CategoryItemViewHolder, position: Int) {

holder.setData(data[position] as CategoryData)

holder.itemView.setOnClickListener {

onItemClickListener?.onItemClick(holder.itemView,data[position] as CategoryData)

}

}

class CategoryItemViewHolder( itemView: View): RecyclerView.ViewHolder(itemView) {




Download 1.68 Mb.

Do'stlaringiz bilan baham:
1   ...   14   15   16   17   18   19   20   21   22




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling