package com.zj365.health.adapter

import android.widget.ImageView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.tamsiree.rxkit.RxTimeTool
import com.xty.common.picture.PictureUtils
import com.xty.common.setImage
import com.zj365.health.R
import com.xty.network.model.ChatBean
import com.xty.network.model.DrugHealthCare
import com.xty.network.model.ItemDrugHealthCare
import com.xty.network.model.MassageHealthCare
import de.hdodenhof.circleimageview.CircleImageView
import pl.droidsonroids.gif.GifImageView

class XWAMAdapter() : BaseMultiItemQuickAdapter<MassageHealthCare, BaseViewHolder>() {

    init {
        //0文字  1 文字加图片  2文字加图片加描述
        addItemType(0, R.layout.view_type_text)
        addItemType(1, R.layout.view_type_xwam)
    }

    override fun convert(holder: BaseViewHolder, item: MassageHealthCare) {
        when (item.itemType) {
            0 -> {
                holder.setText(R.id.tvContent,item.message.replace("<br>",""))
            }
            1 -> {
                holder.setText(R.id.tvTitle,if (item.message.isNotEmpty()) item.message else item.desc)
                    .setText(R.id.tvName,item.bottom)
                    .setText(R.id.tvContent,item.desc.replace("<br>","\n"))
                holder.getView<GifImageView>(R.id.image).setImage(context,item.photo)
            }
            else -> {}
        }
    }
}