package xyz.adjutor.aniki import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import java.util.ArrayList class MangaAdapter(val mangaList: Array) : RecyclerView.Adapter() { // Describes an item view and its place within the RecyclerView class MangaViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { private val mangaTextView: TextView = itemView.findViewById(R.id.tv_title) fun bind(word: String) { mangaTextView.text = word } } // Returns a new ViewHolder override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MangaViewHolder { val view = LayoutInflater.from(parent.context) .inflate(R.layout.item_layout, parent, false) return MangaViewHolder(view) } // Returns size of data list override fun getItemCount(): Int { return mangaList.size } // Displays data at a certain position override fun onBindViewHolder(holder: MangaViewHolder, position: Int) { holder.bind(mangaList[position]) } }