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.DBModel.Xjjh;
import com.bjzc.bhzhgd.R;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;


/**
 * 下载计划适配器
 */
public class CheckScxsAdapter extends BaseAdapter {

    private Context context;
    //private List<XSJJHXZDataBean> list;
    private List<Xjjh> dbxjjh;

    public CheckScxsAdapter(Context context, List<Xjjh> dbxjjh) {
        this.context = context;
        this.dbxjjh=dbxjjh;
    }

    public interface CallBack {
        void Click(View view);
    }

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

    @Override
    public Object getItem(int i) {
        return dbxjjh.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.no_checkbox_scxscb_item, viewGroup, false);
            holder.tv_gwmc = view.findViewById(R.id.tv_gwmc);
            holder.tv_yjzj = view.findViewById(R.id.tv_yjzj);

            view.setTag(holder);
            AutoUtils.autoSize(view);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.tv_gwmc.setText(dbxjjh.get(i).getJhmc());
        holder.tv_yjzj.setText(dbxjjh.get(i).getCountPercent()+"/"+dbxjjh.get(i).getJhds());
        return view;
    }

    static class ViewHolder {
        TextView tv_gwmc;
        TextView tv_yjzj;

    }
}