aboutsummaryrefslogtreecommitdiff
path: root/fastadapter
diff options
context:
space:
mode:
authorAllan Wang <allanwang@google.com>2019-07-27 19:16:00 -0700
committerAllan Wang <allanwang@google.com>2019-07-27 19:16:00 -0700
commit6a599e553a467f15be7ed60c554f43aeac5936ca (patch)
tree897a5a31564a79833befb4468b294a2f5a01a4b7 /fastadapter
parent63f6b70cc81ec9dc6e92b6521dfd78fa72fe70a5 (diff)
downloadkau-6a599e553a467f15be7ed60c554f43aeac5936ca.tar.gz
kau-6a599e553a467f15be7ed60c554f43aeac5936ca.tar.bz2
kau-6a599e553a467f15be7ed60c554f43aeac5936ca.zip
Fix theme injection
Diffstat (limited to 'fastadapter')
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt42
1 files changed, 7 insertions, 35 deletions
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<Item : IItem<*>>(
colors.accentColor
)
+ init {
+ itemAdapter.interceptor = {
+ injectTheme(it)
+ it
+ }
+ }
+
var textColor: Int? = textColor
set(value) {
if (field == value) return
@@ -78,41 +85,6 @@ class FastItemThemedAdapter<Item : IItem<*>>(
notifyAdapterDataSetChanged()
}
- override fun add(position: Int, items: List<Item>): IItemAdapter<Item, Item> {
- injectTheme(items)
- return super.add(position, items)
- }
-
- override fun add(position: Int, vararg items: Item): IItemAdapter<Item, Item> {
- injectTheme(items.toList())
- return super.add(position, *items)
- }
-
- override fun add(vararg items: Item): IItemAdapter<Item, Item> {
- injectTheme(items.toList())
- return super.add(*items)
- }
-
- override fun add(items: List<Item>): IItemAdapter<Item, Item> {
- injectTheme(items)
- return super.add(items)
- }
-
- override fun set(items: List<Item>): IItemAdapter<Item, Item> {
- injectTheme(items)
- return super.set(items)
- }
-
- override fun set(position: Int, item: Item): IItemAdapter<Item, Item> {
- injectTheme(item)
- return super.set(position, item)
- }
-
- override fun setNewList(items: List<Item>, retainFilter: Boolean): IItemAdapter<Item, Item> {
- injectTheme(items)
- return super.setNewList(items, retainFilter)
- }
-
private fun injectTheme(items: Collection<IItem<*>?>?) {
items?.forEach { injectTheme(it) }
}