package com.develop.food.base.adapter

import android.widget.ImageView
import androidx.appcompat.widget.AppCompatTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.develop.base.R
import com.develop.food.base.data.model.NewsModel

class NewsAdapter : BaseQuickAdapter<NewsModel, BaseViewHolder>(R.layout.item_news) {
    override fun convert(holder: BaseViewHolder, item: NewsModel) {
        val ivCircle = holder.getView<ImageView>(R.id.iv_circle)
        val tvNewsTitle = holder.getView<AppCompatTextView>(R.id.tv_news_title)
        val tvNewsContent = holder.getView<AppCompatTextView>(R.id.tv_news_content)
        if (item.hasRead) {
            ivCircle.setBackgroundResource(R.drawable.b1b2b2_circle)
            tvNewsTitle.setTextColor(context.resources.getColor(R.color.color_B1B2B2))
        } else {
            ivCircle.setBackgroundResource(R.drawable.e60012_circle)
            tvNewsTitle.setTextColor(context.resources.getColor(R.color.color_E60012))
        }
        tvNewsContent.text = item.des
        tvNewsTitle.text = item.title

    }
}