KRecyclerDsl
Exemple
recyclerView.adapter = dataClassAdapter<MyView, MyDataClass>(R.layout.my_view, myItems) {
onBindViewHolder { view, dataClass ->
view.name.text = dataClass.name
view.description.text = dataClass.description
}
onItemClickListener { view, dataClass ->
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(dataClass.html_url)))
}
}
Extensions functions
This library provide some useful (or not) extensions functions :
// Call the function when scroll down on the last visible item
recyclerView.addInfiniteScrollListener { search() }
// Add separation between each line.
recyclerView.addDividerItemDecorationVertical()
// Add separation between each column.
recyclerView.addDividerItemDecorationHorizontal()
Dependency
KRecyclerDsl has no dependency, you must add your RecyclerView library version.
This library generate a JAR, not an AAR, so you can use it with any compile version option.
compile "com.tgirard12.krecyclerdsl:krecyclerdsl:$LATEST_VERSION" // Required compile "com.android.support:recyclerview-v7:$your_version"