package com.dahe.gldriver.adapter

import android.content.Context
import android.view.ViewGroup
import android.widget.Button
import android.widget.ImageView
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.dahe.gldriver.R
import com.dahe.gldriver.bean.CaptainBean
import com.dahe.gldriver.bean.DriverBean
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.utils.ImageLoader

/**
 * @ClassName WaybillAdapter
 * @Author 用户
 * @Date 2024/1/23 16:27
 * @Description TODO
 */
class DriverTeamsAdapter() :
    BaseQuickAdapter<CaptainBean, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: CaptainBean?) {
        item?.let {
            holder.run {
                setText(R.id.tvName, it.captainName)
                setText(R.id.tvPhone, """司机:${item.driverNum}  车辆:${item.carNum}""")
                setVisible(R.id.tvStatu, item.joinStatus == "0")
                ImageLoader.getInstance()
                    .loadRoundImage(context, it.avatar, 6, getView<ImageView>(R.id.ivHead))


            }
        }
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        // 返回一个 ViewHolder
        return QuickViewHolder(R.layout.item_carteam, parent)
    }
}