aboutsummaryrefslogtreecommitdiff
path: root/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapter')
-rw-r--r--adapter/README.md2
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt4
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt2
-rw-r--r--adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt1
4 files changed, 5 insertions, 4 deletions
diff --git a/adapter/README.md b/adapter/README.md
index 7df9713..a6ffb6d 100644
--- a/adapter/README.md
+++ b/adapter/README.md
@@ -7,7 +7,7 @@ Collection of kotlin bindings and custom IItems for [Fast Adapter](https://githu
Abstract base that extends `AbstractIItems` and contains the arguments `(layoutRes, ViewHolder lambda, idRes)` in that order.
Those variables are used to override the default abstract functions.
If a layout is only used for one item, it may also be used as the id, which you may leave blank in this case.
-The ViewHolder lambda is typically of the form `{ ViewHolder(it) }`
+The ViewHolder lambda is typically of the form `::ViewHolder`
Where you will have a nested class `ViewHolder(v: View) : RecyclerView.ViewHolder(v)`
## IItem Templates
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
index 9865c70..6ce81a3 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -27,7 +27,7 @@ import com.mikepenz.iconics.typeface.IIcon
class CardIItem(
val builder: Config.() -> Unit = {}
) : KauIItem<CardIItem, CardIItem.ViewHolder>(
- R.layout.kau_iitem_card, { ViewHolder(it) }, R.id.kau_item_card
+ R.layout.kau_iitem_card, ::ViewHolder, R.id.kau_item_card
), ThemableIItem by ThemableIItemDelegate() {
companion object {
@@ -69,7 +69,7 @@ class CardIItem(
var imageRes: Int = -1
}
- override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) {
+ override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
super.bindView(holder, payloads)
with(holder.itemView.context) context@ {
with(configs) {
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
index d6d06f3..8367e7c 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
@@ -24,7 +24,7 @@ class HeaderIItem(
var text: String = text ?: "Header Placeholder"
- override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) {
+ override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) {
super.bindView(holder, payloads)
holder.text.text = holder.itemView.context.string(textRes, text)
bindTextColor(holder.text)
diff --git a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
index d8567c4..335b89c 100644
--- a/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
+++ b/adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt
@@ -21,4 +21,5 @@ open class KauIItem<Item, VH : RecyclerView.ViewHolder>(
override final fun getType(): Int = type
override final fun getViewHolder(v: View): VH = viewHolder(v)
override final fun getLayoutRes(): Int = layoutRes
+
} \ No newline at end of file