package com.duben.microtribe.ui.adapter

import android.view.View
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.duben.library.utils.GlideUtils
import com.duben.microtribe.R
import com.duben.microtribe.mvp.model.*

class VipEnjoyAdapter : BaseQuickAdapter<VedioBean, BaseViewHolder>(R.layout.item_vip_enjoy) {

    override fun convert(holder: BaseViewHolder, item: VedioBean) {
        holder.getView<TextView>(R.id.title_tv).text = item.title
        holder.getView<TextView>(R.id.info_tv).text = item.vedioDesc
        holder.getView<TextView>(R.id.complete_tv).text =
            if (item.completeStatus == 0) "已完结" else "更新中"
        GlideUtils.loadImageViewGifForCenterCrop(
            context,
            item.coverImage,
            holder.getView(R.id.image_iv),
            12
        )

        holder.getView<View>(R.id.item).setOnClickListener { it1 ->
            mOnCustomChildClickListener?.onCustomChildClick(it1, item)
        }
    }

    private var mOnCustomChildClickListener: OnCustomChildClickListener? = null

    fun setOnCustomChildClickListener(onCustomChildClickListener: OnCustomChildClickListener) {
        this.mOnCustomChildClickListener = onCustomChildClickListener
    }

    interface OnCustomChildClickListener {
        fun onCustomChildClick(view: View, vedioBean: VedioBean)
    }

}