We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have you any plans to support DataBinding layouts?
The text was updated successfully, but these errors were encountered:
What do you mean? I've tried it recently, it works with data binding.
val articlesAdapter = Klaster.withViewHolder<DataBindingViewHolder>() .itemCount { articles.size } .viewHolder { _: Int, parent: ViewGroup -> val binding: ViewDataBinding = DataBindingUtil.inflate( layoutInflater, R.layout.article_list_item, parent, false ) return@viewHolder DataBindingViewHolder(binding) } .bind { position -> val article = articles[position] this.bind(article, artileListHandlers) } .build() interface ArticleListHandlers { fun onArticleClick(article: Article) {} } class DataBindingViewHolder(private val binding: ViewDataBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(viewData: Any, handlers: Any) { binding.setVariable(BR.viewData, viewData) binding.setVariable(BR.handlers, handlers) binding.executePendingBindings() } }
This data binding stuff
.viewHolder { _: Int, parent: ViewGroup -> val binding: ViewDataBinding = DataBindingUtil.inflate( layoutInflater, R.layout.article_list_item, parent, false ) return@viewHolder DataBindingViewHolder(binding) }
can be moved to an extension function if needed. Or may be you mean something else?
Sorry, something went wrong.
No branches or pull requests
Have you any plans to support DataBinding layouts?
The text was updated successfully, but these errors were encountered: