package com.base.browserwhite.ui.activity.result

import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.base.browserwhite.R
import com.base.browserwhite.databinding.ItemResultHeadBinding
import com.base.browserwhite.utils.XmlEx.inflate
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.BaseSingleItemAdapter

class ResultHeadAdapter(
    val bindUiAction: (headBinding: ItemResultHeadBinding) -> Unit
) : BaseSingleItemAdapter<Any, ResultHeadAdapter.ResultHeadViewHolder>() {
    inner class ResultHeadViewHolder(view: View) : ViewHolder(view)


    override fun onBindViewHolder(holder: ResultHeadViewHolder, item: Any?) {
        bindUiAction.invoke(ItemResultHeadBinding.bind(holder.itemView))
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): ResultHeadViewHolder {
        return ResultHeadViewHolder(R.layout.item_result_head.inflate(parent))
    }
}