Skip to content

Instantly share code, notes, and snippets.

@TooLazyy
Created June 26, 2019 10:38
Show Gist options
  • Save TooLazyy/b2408e2d6d0d26869be4f99d04fdfdf3 to your computer and use it in GitHub Desktop.
Save TooLazyy/b2408e2d6d0d26869be4f99d04fdfdf3 to your computer and use it in GitHub Desktop.
easy adapter
fun test() {
mAdapter.setItems(
ItemList.create()
.addAll(listOf<String>(), ForString())
.addAll(listOf<Int>(), ForInt())
)
}
class ForString : BindableItemController<String, ForString.Holder>() {
override fun getItemId(item: String): String {
return item.hashCode().toString()
}
override fun createViewHolder(parent: ViewGroup?): Holder {
return Holder(parent)
}
inner class Holder(
parent: ViewGroup?
) : BindableViewHolder<String>(parent, R.layout.view_compilation_mix) {
override fun bind(item: String) {
}
}
}
class ForInt : BindableItemController<Int, ForInt.Holder>() {
override fun getItemId(item: Int): String {
return item.hashCode().toString()
}
override fun createViewHolder(parent: ViewGroup?): Holder {
return Holder(parent)
}
inner class Holder(
parent: ViewGroup?
) : BindableViewHolder<Int>(parent, R.layout.view_compilation_mix) {
override fun bind(item: Int) {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment