package com.jimind.sportdemo.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.constraint.ConstraintLayout;
import android.widget.TextView;

import com.jimind.sportdemo.R;
import com.jimind.sportdemo.base.BaseRecyclerAdapter;
import com.jimind.sportdemo.base.BaseViewHolder;
import com.jimind.sportdemo.bean.Bill;

/**
 * 学生排行榜
 *
 * @author Any
 */
public class BillAdapter extends BaseRecyclerAdapter<Bill> {
    private int backgroundColor;

    public BillAdapter(Context context) {
        super(context);
        backgroundColor = Color.parseColor("#19000000");
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_bill;
    }

    @Override
    protected void onBindItemHolder(BaseViewHolder holder, int position) {

        ConstraintLayout clBill = holder.getView(R.id.cl_bill);
        TextView tvStudentBill = holder.getView(R.id.tv_student_bill);
        TextView tvStudentName = holder.getView(R.id.tv_student_name);
        TextView tvStudentLoad = holder.getView(R.id.tv_student_load);
        TextView tvStudentDensity = holder.getView(R.id.tv_student_density);

        Bill bill = mDataList.get(position);
        if (position % 2 == 0) {
            clBill.setBackgroundColor(backgroundColor);
        }
        tvStudentBill.setText(String.valueOf(position + 1));
        tvStudentName.setText(bill.getName());
        tvStudentLoad.setText(bill.getLoad());
        tvStudentDensity.setText(bill.getDensity());

    }
}
