package com.genlot.ninglottery.module.report.adapter;

import android.support.annotation.NonNull;

import com.chad.library.adapter.base.BaseSectionQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.genlot.ninglottery.R;
import com.genlot.ninglottery.module.report.bean.ReportBean;
import com.genlot.ninglottery.module.report.bean.ReportSection;

import java.util.List;

public class ReportAdapter extends BaseSectionQuickAdapter<ReportSection, BaseViewHolder> {


    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId      The layout resource id of each item.
     * @param sectionHeadResId The section head layout id for each item
     * @param data             A new list is created out of this one to avoid mutable list
     */
    public ReportAdapter(int layoutResId, int sectionHeadResId, List<ReportSection> data) {
        super(layoutResId, sectionHeadResId, data);
    }

    @Override
    protected void convertHead(BaseViewHolder helper, ReportSection item) {
        helper.setText(R.id.item_header, item.header);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, ReportSection item) {
        ReportBean bean = item.t;
        helper.setText(R.id.item_left, bean.getTitle());
        helper.setText(R.id.item_mid, bean.getNum());
        helper.setText(R.id.item_right, bean.getMoney());
    }
}
