package com.bjzc.bhzhgd.adapter;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.bjzc.bhzhgd.R;
import com.bjzc.bhzhgd.bean.QxTjgdRequestBean;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.ArrayList;

/**
 * 点列表适配器
 */
public class QxOpenAdapter extends BaseAdapter {

    private Context context;
    //    private List<QYDDATABean> list;
    private ArrayList<QxTjgdRequestBean> list;

    public QxOpenAdapter(Context context, ArrayList<QxTjgdRequestBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            view = LayoutInflater.from(context).inflate(R.layout.item_qx_header, viewGroup, false);
            holder.tv_d = view.findViewById(R.id.tv_d);
            holder.tv_cjjg = view.findViewById(R.id.tv_cjjg);
            holder.tv_zt = view.findViewById(R.id.tv_zt);
            view.setTag(holder);
            AutoUtils.autoSize(view);
        } else {
            holder = (ViewHolder) view.getTag();
        }


        holder.tv_d.setText(list.get(i).getQXMS());
        holder.tv_cjjg.setText(list.get(i).getTJRXM());
        holder.tv_zt.setText(list.get(i).getSTATUS());

        return view;
    }

    static class ViewHolder {
        TextView tv_cjjg;
        TextView tv_d;
        TextView tv_zt;
    }
}
