This implementation is quite straightforward. We will inflate the XML layout that we defined for the individual articles, and find the views that will be used to display the information:
override fun onCreateViewHolder(parent: ViewGroup,
viewType: Int): ViewHolder {
val layout = LayoutInflater.from(parent.context)
.inflate(R.layout.article, parent, false) as LinearLayout
val feed = layout.findViewById<TextView>(R.id.feed)
val title = layout.findViewById<TextView>(R.id.title)
val summary = layout.findViewById<TextView>(R.id.summary)
return ViewHolder(layout, feed, title, summary)
}
Now each time a new ViewHolder is needed, this function will be called.