package com.mobiuz.app.dev.ui.home

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.mobiuz.app.databinding.ItemHomeBinding

class SliderAdapter : RecyclerView.Adapter<SliderAdapter.SliderViewHolder>() {

    private var listener: ((String) -> Unit)? = null
    private val sliderItems: ArrayList<String> = ArrayList()

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SliderViewHolder {
        return SliderViewHolder(
            ItemHomeBinding.inflate(LayoutInflater.from(parent.context),parent,false)
        )
    }

    override fun onBindViewHolder(holder: SliderViewHolder, position: Int) = holder.onBind()

    override fun getItemCount(): Int = 4

    inner class SliderViewHolder(val view: ItemHomeBinding) : RecyclerView.ViewHolder(view.root) {

        fun onBind() {

        }

    }

    fun setOnClickListener(block: (String) -> Unit) {
        listener = block
    }

    fun submitList(ls: List<String>) {
        sliderItems.clear()
        sliderItems.addAll(ls)
        notifyDataSetChanged()
    }
}