package com.tenlionsoft.oamodule.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.tenlionsoft.baselib.core.widget.base.BaseRecyclerAdapter;
import com.tenlionsoft.oamodule.R;
import com.tenlionsoft.oamodule.beans.WorkReportDetailBean;
import com.tenlionsoft.oamodule.holder.WorkReportHolder;

import java.util.List;

/**
 * 作者: adam
 * 日期: 2022/4/19 - 15:12
 * 邮箱: itgaojian@163.com
 * 描述:
 */
public class WorkReportAdapter extends BaseRecyclerAdapter<WorkReportDetailBean, WorkReportHolder> {

    public WorkReportAdapter(Context ctx, List<WorkReportDetailBean> list) {
        super(ctx, list);
    }

    @Override
    public WorkReportHolder createHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_work_report, parent, false);
        return new WorkReportHolder(itemView);
    }

    @Override
    public void bindHolder(WorkReportHolder h, int i) {
        h.mTvTitle.setText(mData.get(i).getReportTitle());
        h.mTvContent.setText(mData.get(i).getReportContent());
        h.mTvEgress.setText(mData.get(i).getReportEgress());
        switch (mData.get(i).getReportType()) {
            case "1":
                h.mTvType.setText("工作日报");
                break;
            case "2":
                h.mTvType.setText("工作周报");
                break;
            case "3":
                h.mTvType.setText("工作月报");
                break;
        }
    }
}
