From 1269a026da6a4597f7123e310768e3377e8c63e8 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 10 Dec 2017 22:17:28 -0500 Subject: fix/lint (#110) * Remove nullability to match fastadapter * Remove redundant override --- adapter/README.md | 2 +- adapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt | 4 ++-- adapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt | 2 +- adapter/src/main/kotlin/ca/allanwang/kau/iitems/KauIItem.kt | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) (limited to 'adapter') 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( - 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?) { + override fun bindView(holder: ViewHolder, payloads: MutableList) { 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?) { + override fun bindView(holder: ViewHolder, payloads: MutableList) { 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( 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 -- cgit v1.2.3