package com.audio.record.screen.test.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.audio.record.screen.test.App
import com.audio.record.screen.test.base.BaseAdapter
import com.audio.record.screen.test.databinding.AdapterThumbBinding
import com.audio.record.screen.test.databinding.AdapterToolBinding
import com.bumptech.glide.Glide

class ToolAdapter(context: Context, private var click:(type:Int)->Unit) : BaseAdapter<String, AdapterToolBinding>(context) {
    override fun getViewBinding(parent: ViewGroup?): AdapterToolBinding {
        return AdapterToolBinding.inflate(LayoutInflater.from(parent!!.context), parent, false)
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        val itemHolder = holder as VHolder<AdapterToolBinding>
        val item = data[position]
        with(itemHolder.vb.btn) {
            text = item
            setOnClickListener {
                click.invoke(itemHolder.bindingAdapterPosition)
            }
        }

    }

}