Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InspirationListAdapter(private val listInspiration: ArrayList<InspirationModel>) : RecyclerView.Adapter<InspirationListAdapter.ListViewHolder>() {
- inner class ListViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
- var imgPhoto: ImageView = itemView.findViewById(R.id.iv_item_photo)
- }
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ListViewHolder {
- val view: View = LayoutInflater.from(parent.context)
- .inflate(R.layout.item_row_inspiration, parent, false)
- return ListViewHolder(view)
- }
- override fun getItemCount(): Int {
- return listInspiration.size
- }
- override fun onBindViewHolder(holder: ListViewHolder, position: Int) {
- val inspiration = listInspiration[position]
- Glide.with(holder.itemView.context)
- .load(inspiration.inspirationImage)
- .into(holder.imgPhoto)
- }
- }
Add Comment
Please, Sign In to add comment