From 33ad3ab71a06d6505c37b1e23f7d9a82db243c84 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 18 Jul 2020 17:08:50 -0700 Subject: Update fast adapter --- about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt | 2 +- about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt | 2 +- about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt | 2 +- buildSrc/src/main/kotlin/kau/Versions.kt | 2 +- .../main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt | 4 ++-- fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt | 4 ++-- fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt | 2 +- fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt | 2 +- .../kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt | 2 +- .../kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt | 2 +- .../main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt | 2 +- .../kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt | 2 +- .../kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt | 2 +- .../main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt | 2 +- .../main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt | 2 +- .../src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt | 2 +- mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt | 2 +- .../src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt | 2 +- sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt | 4 ++-- searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt | 2 +- 20 files changed, 23 insertions(+), 23 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 d92f6a7..2a1588c 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt @@ -35,7 +35,7 @@ class CutoutIItem(val config: CutoutView.() -> Unit = {}) : KauIItem) { + override fun bindView(holder: ViewHolder, payloads: List) { 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 977b7ff..ddb9a18 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt @@ -67,7 +67,7 @@ class FaqIItem(val content: FaqItem) : KauIItem( private var isExpanded = false @SuppressLint("SetTextI18n") - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { 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 cd53f55..c64fe4e 100644 --- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt +++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt @@ -59,7 +59,7 @@ class LibraryIItem(val lib: Library) : KauIItem( get() = false set(_) {} - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) with(holder) { name.text = lib.libraryName diff --git a/buildSrc/src/main/kotlin/kau/Versions.kt b/buildSrc/src/main/kotlin/kau/Versions.kt index f59ad51..8d25185 100644 --- a/buildSrc/src/main/kotlin/kau/Versions.kt +++ b/buildSrc/src/main/kotlin/kau/Versions.kt @@ -39,7 +39,7 @@ object Versions { const val blurry = "3.0.0" // https://github.com/mikepenz/FastAdapter/releases - const val fastAdapter = "4.1.2" + const val fastAdapter = "5.2.2" // https://github.com/bumptech/glide/releases const val glide = "4.11.0" diff --git a/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt b/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt index 96055e4..ff694f0 100644 --- a/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt +++ b/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt @@ -56,13 +56,13 @@ abstract class BindingItem(open val data: Any?) : return binding.root } - final override fun bindView(holder: ViewHolder, payloads: MutableList) { + final override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) val binding = holder.getBinding() binding.bindView(holder, payloads) } - abstract fun Binding.bindView(holder: ViewHolder, payloads: MutableList) + abstract fun Binding.bindView(holder: ViewHolder, payloads: List) protected fun unbind(vararg textViews: TextView) { textViews.forEach { it.text = null } diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt index 655b355..a9e6bfa 100644 --- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt +++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/AdapterUtils.kt @@ -27,8 +27,8 @@ import com.mikepenz.fastadapter.select.SelectExtension /** * Add kotlin's generic syntax to better support out types */ -fun fastAdapter(vararg adapter: IAdapter) = - FastAdapter.with>(adapter.toList()) +fun fastAdapter(vararg adapter: IAdapter): FastAdapter = + FastAdapter.with(adapter.toList()) /** * Returns selection size, or -1 if selection is disabled diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt index 1a2e6cb..41663c9 100644 --- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt +++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt @@ -89,7 +89,7 @@ class CardIItem( var imageRes: Int = INVALID_ID } - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) with(holder.itemView.context) context@{ with(configs) { diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt index 551cb59..15ceb31 100644 --- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt +++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt @@ -40,7 +40,7 @@ class HeaderIItem( var text: String = text ?: "Header Placeholder" - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) holder.text.text = holder.itemView.context.string(textRes, text) bindTextColor(holder.text) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt index a867d06..16900c4 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefCheckbox.kt @@ -34,7 +34,7 @@ open class KPrefCheckbox(builder: BaseContract) : KPrefItemBase) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) val checkbox = holder.bindInnerView(R.layout.kau_pref_checkbox) withAccentColor(checkbox::tint) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt index 76cfbab..d7023af 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt @@ -33,7 +33,7 @@ import com.afollestad.materialdialogs.MaterialDialog */ open class KPrefColorPicker(open val builder: KPrefColorContract) : KPrefItemBase(builder) { - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) if (builder.showPreview) { val preview = holder.bindInnerView(R.layout.kau_pref_color) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt index ca70b61..6828053 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefHeader.kt @@ -28,7 +28,7 @@ open class KPrefHeader(builder: CoreContract) : KPrefItemCore(builder) { override val layoutRes: Int get() = R.layout.kau_pref_header - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) withAccentColor(holder.title::setTextColor) } diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt index 16363e2..22be523 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt @@ -47,7 +47,7 @@ abstract class KPrefItemBase(protected val base: BaseContract) : KPrefItem } @CallSuper - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) _enabled = base.enabler() with(holder) { diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt index 79b7e82..0aaa2d3 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt @@ -70,7 +70,7 @@ abstract class KPrefItemCore(val core: CoreContract) : AbstractItem) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) with(holder) { updateTitle() diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt index 9abdf09..41efa42 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt @@ -37,7 +37,7 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase( override fun KClick.defaultOnClick() = Unit - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) val text = holder.bindInnerView(R.layout.kau_pref_seekbar_text) withTextColor(text::setTextColor) diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt index 50f0c62..b5a69dd 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt @@ -46,7 +46,7 @@ open class KPrefText(open val builder: KPrefTextContract) : KPrefItemBase< context.toast("No click function set") } - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) val textView = holder.bindInnerView(R.layout.kau_pref_text) withTextColor(textView::setTextColor) 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 552bf0f..636dcf0 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaActionItem.kt @@ -46,7 +46,7 @@ class MediaActionItem( get() = false set(_) {} - override fun bindView(holder: MediaItemBasic.ViewHolder, payloads: MutableList) { + override fun bindView(holder: MediaItemBasic.ViewHolder, payloads: List) { super.bindView(holder, payloads) holder.image.apply { setImageDrawable( diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt index 88a304f..86cb367 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItem.kt @@ -54,7 +54,7 @@ class MediaItem(val data: MediaModel) : get() = !failedToLoad set(_) {} - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) glide(holder.itemView) .load(data.data) diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt index e801848..6f0d223 100644 --- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt +++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaItemBasic.kt @@ -52,7 +52,7 @@ class MediaItemBasic(val data: MediaModel) : get() = false set(_) {} - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) glide(holder.itemView) .load(data.data) 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 50cfe69..7bd2851 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt @@ -41,7 +41,7 @@ import com.mikepenz.fastadapter.listeners.EventHook class PermissionCheckbox(val permission: String) : KauIItem( R.layout.permission_checkbox, { ViewHolder(it) }) { - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) holder.text.text = permission holder.checkbox.isChecked = holder.itemView.context.hasPermission(permission) @@ -72,7 +72,7 @@ class PermissionCheckboxViewBinding( override fun PermissionCheckboxBinding.bindView( holder: ViewHolder, - payloads: MutableList + payloads: List ) { permText.text = data.permission permCheckbox.apply { 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 78d8782..7be1c68 100644 --- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt +++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchItem.kt @@ -78,7 +78,7 @@ class SearchItem( ) } - override fun bindView(holder: ViewHolder, payloads: MutableList) { + override fun bindView(holder: ViewHolder, payloads: List) { super.bindView(holder, payloads) holder.title.setTextColor(foregroundColor) holder.desc.setTextColor(foregroundColor.adjustAlpha(0.6f)) -- cgit v1.2.3