package com.unis.sxzcl.ui.audit;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.unis.model.bean.AuditBean;
import com.unis.sxzcl.R;

import org.jetbrains.annotations.NotNull;

/**
 * 包名: com.unis.sxzcl.ui.audit
 * 类名: AuditListAdapter
 * 作用描述:
 * 创建人: mQ
 * 创建时间: 2020/11/25 20:31
 * 更新人:
 * 更新时间: 2020/11/25 20:31
 * 更新说明:
 * 版本号: 1.0
 */
public class AuditListAdapter extends BaseQuickAdapter<AuditBean, BaseViewHolder>
        implements LoadMoreModule {

    public AuditListAdapter() {
        super(R.layout.item_list_audit);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, AuditBean item) {

        //设置审批状态
        TextView tvFlag = holder.getView(R.id.tv_flag);
        if (item.flag == null) {
            tvFlag.setVisibility(View.INVISIBLE);
        } else {
            tvFlag.setVisibility(View.VISIBLE);
            switch (item.flag) {
                case AuditBean.AuditConstant.AUDIT_PASS:
                    tvFlag.setBackgroundResource(R.drawable.accent_radius_bg);
                    tvFlag.setText("审批通过");
                    break;
                case AuditBean.AuditConstant.AUDIT_REJECT:
                    tvFlag.setBackgroundResource(R.drawable.red_radius_bg);
                    tvFlag.setText("已驳回");
                    break;
            }
        }

    }

}
