package com.zj365.health.adapter.familyhealth

import android.graphics.Color
import android.widget.CheckBox
import android.widget.TextView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xty.base.adapter.BaseAdapter
import com.xty.common.setImageUser
import com.xty.network.model.FamilyGuardianBean
import com.zj365.health.R
import de.hdodenhof.circleimageview.CircleImageView

class FamilyHealthGuardianAdapter : BaseAdapter<FamilyGuardianBean>(R.layout.item_health_family_guardian) {
    override fun convert(holder: BaseViewHolder, item: FamilyGuardianBean) {
        holder.getView<CircleImageView>(R.id.img_avatar).setImageUser(context,item.avatarUrl)
        holder.setText(R.id.tv_relation,item.relation)
        holder.setText(R.id.tv_phone,item.phone)
        if(item.isFirst == 1){
            holder.getView<CheckBox>(R.id.cb_frist).isChecked = true
            holder.getView<TextView>(R.id.desc).setTextColor(Color.parseColor("#02C191"))
        }else{
            holder.getView<CheckBox>(R.id.cb_frist).isChecked = false
            holder.getView<TextView>(R.id.desc).setTextColor(Color.parseColor("#7C7C7C"))

        }
    }
}