diff options
11 files changed, 13 insertions, 11 deletions
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt index 10a18b2..448d27f 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt @@ -14,12 +14,12 @@ import ca.allanwang.kau.utils.bindView * Just a cutout item with some defaults in [R.layout.kau_iitem_cutout] */ class CutoutIItem(val config: CutoutView.() -> Unit = {}) : KauIItem<CutoutIItem, CutoutIItem.ViewHolder>( - R.layout.kau_iitem_cutout, {ViewHolder(it)}, R.id.kau_item_cutout + R.layout.kau_iitem_cutout, ::ViewHolder, R.id.kau_item_cutout ), ThemableIItem by ThemableIItemDelegate() { override fun isSelectable(): Boolean = false - override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) with(holder) { if (accentColor != null && themeEnabled) cutout.foregroundColor = accentColor!! diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt index 5595aed..b153fc9 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt @@ -43,7 +43,7 @@ class FaqIItem(val content: FaqItem) : KauIItem<LibraryIItem, FaqIItem.ViewHolde private var isExpanded = false @SuppressLint("SetTextI18n") - override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) with(holder) { number.text = "${content.number}." diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt index 88e6f9b..f61c72c 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -42,7 +42,7 @@ class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem, LibraryIItem.ViewH override fun isSelectable(): Boolean = false - override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) with(holder) { name.text = lib.libraryName 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 diff --git a/docs/Changelog.md b/docs/Changelog.md index 301da9c..6a032e8 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,6 +2,7 @@ ## v3.5.1 * Add Portuguese translations +* Add Galician translations * Add some minor util elements * Update dependencies (sdk 27) diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt index 5910650..6171470 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt @@ -26,7 +26,7 @@ class MediaActionItem( override fun isSelectable(): Boolean = false - override fun bindView(holder: MediaItemBasic.ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: MediaItemBasic.ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) holder.image.apply { setImageDrawable(MediaPickerCore.getIconDrawable(context, action.iicon(this@MediaActionItem), action.color)) diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt index 21aa713..3dba332 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt @@ -14,7 +14,7 @@ import ca.allanwang.kau.utils.hasPermission class PermissionCheckbox(val permission: String) : KauIItem<PermissionCheckbox, PermissionCheckbox.ViewHolder>( R.layout.permission_checkbox, { ViewHolder(it) }) { - override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) holder.text.text = permission holder.checkbox.isChecked = holder.itemView.context.hasPermission(permission) diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt index 29341af..4175fd5 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -50,7 +50,7 @@ class SearchItem(val key: String, styledContent!!.setSpan(StyleSpan(Typeface.BOLD), index, index + subText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) } - override fun bindView(holder: ViewHolder, payloads: MutableList<Any>?) { + override fun bindView(holder: ViewHolder, payloads: MutableList<Any>) { super.bindView(holder, payloads) holder.title.setTextColor(foregroundColor) holder.desc.setTextColor(foregroundColor.adjustAlpha(0.6f)) |