package app.furmeet.events.brasilfurfest.legal

import android.view.ViewGroup
import com.adlerosn.brasilfurfest.R
import app.furmeet.events.brasilfurfest.helper.inflate
import app.furmeet.events.brasilfurfest.helper.layoutInflater
import app.furmeet.events.brasilfurfest.schedule.adapters.RecyclerViewAdapter
import app.furmeet.events.brasilfurfest.schedule.viewHolders.RecyclerViewHolder
import kotlinx.android.synthetic.main.activity_software_licenses_item.view.*

class SoftwareLicensesAdapter(private val licenses: List<SoftwareLicense>) : RecyclerViewAdapter() {
    override fun getItemCount(): Int =
            licenses.size

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerViewHolder =
            RecyclerViewHolder(parent.context.layoutInflater.inflate(R.layout.activity_software_licenses_item))

    override fun onBindViewHolder(holder: RecyclerViewHolder, position: Int) {
        val view = holder.itemView
        view.software.text = licenses[position].software
        view.license.text = licenses[position].license
    }

}
