package com.common.im.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.common.im.bean.ContactListBean;
import com.common.im.bean.ContactRoomListBean;
import com.common.im_ui.R;
import com.cooleshow.base.utils.GlideUtils;

/**
 * 创建日期：2022/6/10 11:43
 *
 * @author Ryan
 * 类说明：
 */
public class ContactRoomListAdapter extends BaseQuickAdapter<ContactRoomListBean, BaseViewHolder> {
    public ContactRoomListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, ContactRoomListBean contactListBean) {
        holder.setText(R.id.tv_name, contactListBean.getName());
        ImageView iv_icon = holder.getView(R.id.iv_icon);
        ImageView im_group_mark = holder.getView(R.id.im_group_mark);

        if (contactListBean.getType().equals("FAN")) {
            im_group_mark.setBackgroundResource(R.drawable.icon_group_mark_fans);
            iv_icon.setImageResource(io.rong.imkit.R.drawable.icon_group_fans);
        } else if (contactListBean.getType().equals("COURSE")) {
            im_group_mark.setBackgroundResource(R.drawable.icon_group_mark_course);
            iv_icon.setImageResource(io.rong.imkit.R.drawable.icon_group_course);
        } else {
            im_group_mark.setBackgroundResource(R.drawable.icon_group_mark_fans);
            GlideUtils.INSTANCE.loadImage(getContext(), contactListBean.getImg(), iv_icon, io.rong.imkit.R.drawable.icon_group_fans);
        }
    }
}
