package com.example.jetpacksample

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.item_layout.view.*

class ItemAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {

     val list: ArrayList<ItemDataBean>? = ArrayList<ItemDataBean>()

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return ItemViewHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.item_layout, parent, false))
    }

    override fun getItemCount(): Int {
        return list!!.size
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        holder.itemView.tv.setText(list?.get(position)!!.time)
    }

}

class ItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}