package com.zj365.health.adapter

import android.os.Handler
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.tamsiree.rxkit.RxTimeTool
import com.xty.base.adapter.BaseAdapter
import com.zj365.health.R
import com.xty.network.model.AnswerBean
import com.xty.network.model.CancerGoodsBean
import com.xty.network.model.CollectBloodBean


class CollectBloodAdapter: BaseAdapter<CollectBloodBean>(R.layout.item_collect_blood) {
    override fun convert(holder: BaseViewHolder, item: CollectBloodBean) {
        holder.setText(R.id.tvName,item.realName)
        var sex = if (item.sex ==1) "男" else "女"
        holder.setText(R.id.tvSex,sex)
        holder.setText(R.id.tvUpload,getStatus(item.status))
        holder.setTextColor(R.id.tvUpload,getStatusColor(item.status))
        holder.setText(R.id.tvPhone,item.phone)
        holder.setText(R.id.tvCommitTime,item.createTime)
    }
    fun getStatus(status:Int?):String{
        var result = ""
        when(status){
            0 -> {
                result = "待确认"
            }
            1 -> {result ="预约成功"}
            2 -> {result ="预约失败"}
        }
        return result
    }
    fun getStatusColor(status:Int?):Int{
        var result = 0
        when(status){
            0 -> {
                result = context.resources.getColor(R.color.col_96D)
            }
            1 -> {
                result =context.resources.getColor(R.color.col_02c)

            }
            2 -> {
                result =context.resources.getColor(R.color.col_2628)
            }
        }
        return result
    }
}