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.OrderChild
import com.dahe.gldriver.utils.OrderUtils
import com.dahe.glex.bean.OrderBean
import com.dahe.glex.bean.WayBillBean
import com.dahe.mylibrary.utils.ImageLoader

/**
 * @ClassName WaybillAdapter
 * @Author 用户
 * @Date 2024/3/5 16:27
 * @Description TODO
 */
class WaybillNodeAdapter :
    BaseQuickAdapter<OrderChild, QuickViewHolder>() {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: OrderChild?) {
        item?.run {
            holder.run {
                setText(R.id.tvLoad, item?.city+item?.area+item?.address)
                setText(R.id.tvPhone, """${item?.name} ${item?.phone}""")
                setBackgroundResource(R.id.ivLoad,if (item.type == "1") R.drawable.icon_load else R.drawable.icon_unload)

            }
        }

    }

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