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 TeacherAdapter extends BaseRecyclerAdapter<Bill> {

    private int backgroundColor;

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

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

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

        ConstraintLayout clBill = holder.getView(R.id.cl_teacher);
        TextView tvTeacherBill = holder.getView(R.id.tv_teacher_bill);
        TextView tvTeacherName = holder.getView(R.id.tv_teacher_name);
        TextView tvCourseHour = holder.getView(R.id.tv_teacher_hour);
        TextView tvTeacherLoad = holder.getView(R.id.tv_teacher_load);
        TextView tvTeacherDensity = holder.getView(R.id.tv_teacher_density);

        Bill bill = mDataList.get(position);
        if (position % 2 == 0) {
            clBill.setBackgroundColor(backgroundColor);
        }
        tvTeacherBill.setText(String.valueOf(position + 1));
        tvTeacherName.setText(bill.getName());
        tvCourseHour.setText("4");
        tvTeacherLoad.setText(bill.getLoad());
        tvTeacherDensity.setText(bill.getDensity());

    }
}
