Created
June 26, 2019 10:38
-
-
Save TooLazyy/b2408e2d6d0d26869be4f99d04fdfdf3 to your computer and use it in GitHub Desktop.
easy adapter
This file contains 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
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