From 6a599e553a467f15be7ed60c554f43aeac5936ca Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 27 Jul 2019 19:16:00 -0700 Subject: Fix theme injection --- .../kau/adapters/FastItemThemedAdapter.kt | 42 ++++------------------ 1 file changed, 7 insertions(+), 35 deletions(-) (limited to 'fastadapter/src') diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt index e6d4b24..24a37c4 100644 --- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt +++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt @@ -47,6 +47,13 @@ class FastItemThemedAdapter>( colors.accentColor ) + init { + itemAdapter.interceptor = { + injectTheme(it) + it + } + } + var textColor: Int? = textColor set(value) { if (field == value) return @@ -78,41 +85,6 @@ class FastItemThemedAdapter>( notifyAdapterDataSetChanged() } - override fun add(position: Int, items: List): IItemAdapter { - injectTheme(items) - return super.add(position, items) - } - - override fun add(position: Int, vararg items: Item): IItemAdapter { - injectTheme(items.toList()) - return super.add(position, *items) - } - - override fun add(vararg items: Item): IItemAdapter { - injectTheme(items.toList()) - return super.add(*items) - } - - override fun add(items: List): IItemAdapter { - injectTheme(items) - return super.add(items) - } - - override fun set(items: List): IItemAdapter { - injectTheme(items) - return super.set(items) - } - - override fun set(position: Int, item: Item): IItemAdapter { - injectTheme(item) - return super.set(position, item) - } - - override fun setNewList(items: List, retainFilter: Boolean): IItemAdapter { - injectTheme(items) - return super.setNewList(items, retainFilter) - } - private fun injectTheme(items: Collection?>?) { items?.forEach { injectTheme(it) } } -- cgit v1.2.3