package com.base.locationsharewhite.ui.howuse

import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.base.locationsharewhite.R
import com.base.locationsharewhite.bean.BannerBean
import com.base.locationsharewhite.databinding.ItemBannerImageBinding
import com.base.locationsharewhite.ui.views.XmlEx.inflate
import com.youth.banner.adapter.BannerAdapter

class ImageBannerAdapter(dataList: List<BannerBean>) : BannerAdapter<BannerBean, ImageBannerAdapter.BannerViewHolder>(dataList) {
    inner class BannerViewHolder(view: View) : RecyclerView.ViewHolder(view) {

    }

    override fun onCreateHolder(parent: ViewGroup, viewType: Int): BannerViewHolder {
        return BannerViewHolder(R.layout.item_banner_image.inflate(parent))
    }

    override fun onBindView(holder: BannerViewHolder, data: BannerBean?, position: Int, size: Int) {
        data ?: return

        val binding = ItemBannerImageBinding.bind(holder.itemView)
        binding.iv.setImageResource(data.image)
    }
}