package com.lukouguoji.gnc.adapt

import android.app.Activity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.lukouguoji.gnc.R

import com.lukouguoji.gnc.model.GncTransferRef

/**
 * 复磅列表
 */
class GncTransferRefListAdapter(val activity: Activity, private val collectList: List<GncTransferRef>) :
    RecyclerView.Adapter<GncTransferRefListAdapter.ViewHolder>() {

    inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        val no: TextView = view.findViewById(R.id.no)
        val agentCode: TextView = view.findViewById(R.id.agentCode)
        val spCode: TextView = view.findViewById(R.id.spCode)
        val goods: TextView = view.findViewById(R.id.goods)
        val flight: TextView = view.findViewById(R.id.flight)
        val range: TextView = view.findViewById(R.id.range)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(parent.context).inflate(R.layout.gnc_transfer_ref_list_item, parent, false)
        val viewHolder = ViewHolder(view)

        /*viewHolder.itemView.setOnClickListener {

            var adapterPosition = viewHolder.adapterPosition
            var guoNeiOutCollect = collectList[adapterPosition]

            ARouter.getInstance().build(ARouterConstants.ACTIVITY_URL_GOUT_START_COT_ACTIVITY).withInt("wbId", guoNeiOutCollect.mawbId)
                .navigation(activity, Constant.RequestCode.gnc_shouyun_refresh)

        }*/

        return viewHolder
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val collect = collectList[position]
        holder.no.text = collect.wbNo
        holder.agentCode.text = collect.agentCode
        holder.spCode.text = collect.spCode
        holder.goods.text = collect.goods
        holder.flight.text = collect.flight
        holder.range.text = collect.range

    }

    override fun getItemCount() = collectList.size

}