Created
January 28, 2019 09:07
-
-
Save etonotieno/564d1c1d308f4f9a88c37cf47f90001d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NewsAdapter : ListAdapter<News, NewsViewHolder>(COMPARATOR){ | |
| override fun onCreateViewHolder(parent :ViewGroup, viewType :Int) : NewsViswHolder{ | |
| val binding :ItemLayoutBinding = DataBindingUtil.inflate(layoutInflater, R.layout.item_layout, parent, false) | |
| return NewsViewHolder(binding) | |
| } | |
| override fun onBindViewHolder(holder :NewsViewHolder, position :Int{ | |
| holder.binding.newsArticle = getItem(position) | |
| } | |
| } | |
| class NewsViewHolder(val binding :ItemLayoutBinding) : RecyclerView.ViewHolder(binding.root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment