package com.duben.microtribe.ui.adapter

import android.graphics.Color
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.duben.microtribe.R
import com.duben.microtribe.mvp.model.EpisodeBean

/**
 *  @author Assen
 *  @date 2023/7/5
 *  @desc
 */
class ItemVideoEpisodeAdapter :
    BaseQuickAdapter<EpisodeBean, BaseViewHolder>(R.layout.item_item_video_epsiode) {

    override fun convert(holder: BaseViewHolder, item: EpisodeBean) {
        holder.setText(R.id.item_tv, item.title)

        if (item.playing) holder.setTextColor(R.id.item_tv, Color.RED)
        else holder.setTextColor(R.id.item_tv, Color.BLACK)

        holder.getView<View>(R.id.item_iv_lock).visibility =
            if (item.lock) View.VISIBLE else View.GONE

        holder.getView<View>(R.id.item_iv_play).visibility =
            if (item.playing) View.VISIBLE else View.GONE
    }
}