package com.police.policedatasystem.data.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.police.policedatasystem.App;
import com.police.policedatasystem.R;
import com.police.policedatasystem.model.KeyPerson;
import com.police.policedatasystem.util.UiUtils;

public class KeyPersonAdapter extends BaseQuickAdapter<KeyPerson, BaseViewHolder> {

    public KeyPersonAdapter() {
        super(R.layout.item_key_person); // 指定列表项的布局
    }

    @Override
    protected void convert(BaseViewHolder helper, KeyPerson item) {
        helper.setText(R.id.item_name, item.getXm());
        helper.setText(R.id.item_sfzh, item.getSfzh());
        helper.setText(R.id.item_gklb, item.getGklb());
        helper.setText(R.id.item_qtlb, item.getQtlb());
        helper.setText(R.id.item_zrmj, item.getZrmj());
        if (UiUtils.isNotEmpty(item.getZp())) {
            Glide.with(App.getApp())
                    .asBitmap()
                    .load(item.getZp())
                    .into((ImageView) helper.getView(R.id.iv_photo));
        } else {
            helper.setImageResource(R.id.iv_photo, R.drawable.photo);
        }
    }
}