package com.gingersoft.gsa.other_order_mode.ui.adapter

import android.content.Context
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryBean

class DeliveryAdapter(val context: Context, data: List<DeliveryBean.Data>) : BaseQuickAdapter<DeliveryBean.Data, BaseViewHolder>(R.layout.other_order_delivery_item, data) {

    var selectIndex = -1

    override fun convert(helper: BaseViewHolder?, item: DeliveryBean.Data?) {
        helper!!.setText(R.id.tv_delivery_name, item!!.userName)
        if (helper.adapterPosition == selectIndex) {
            helper.setBackgroundRes(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn)
            helper.setTextColor(R.id.tv_delivery_name, context.resources.getColor(R.color.order_state0_color))
        } else {
            helper.setBackgroundRes(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn_normal)
            helper.setTextColor(R.id.tv_delivery_name, context.resources.getColor(R.color.color_c8))
        }
    }

}
