package com.common.im.adapter;

import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.common.im.bean.GroupMemberBean;
import com.common.im_ui.R;
import com.cooleshow.base.utils.GlideImageLoaderUtils;

import java.util.List;

/**
 * 创建日期：2022/6/11 16:55
 *
 * @author Ryan
 * 类说明：
 */
public class MessageSettingGroupMemberAdapter extends BaseQuickAdapter<GroupMemberBean, BaseViewHolder> {

    public MessageSettingGroupMemberAdapter(List<GroupMemberBean> data) {
        super(R.layout.message_setting_group_member_list_item, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, GroupMemberBean item) {
        ImageView ivIcon = helper.getView(R.id.iv_icon);
        TextView tvTitle = helper.getView(R.id.tv_title);
        String title = item.getRoleType();
        if (!TextUtils.isEmpty(title) && ("乐团主管".equals(title) || "运营主管".equals(title) || "乐队指导".equals(title) || "指导老师".equals(title) || "衔接老师".equals(title))) {
            GlideImageLoaderUtils.getInstance().loadCircleImage(getContext(), item.getAvatar(), R.drawable.ic_stu_student_head,ivIcon);
        } else {
            GlideImageLoaderUtils.getInstance().loadCircleImage(getContext(), item.getAvatar(),R.drawable.ic_teach_teacher_loading, ivIcon);
        }

        tvTitle.setText(item.getNickname());
    }

}
