aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
index acbb9a9..57f4cb9 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/kpref/KPrefBinder.kt
@@ -1,6 +1,5 @@
package ca.allanwang.kau.kpref
-import android.support.annotation.ColorInt
import android.support.annotation.StringRes
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
@@ -29,7 +28,12 @@ fun RecyclerView.setKPrefAdapter(builder: KPrefAdapterBuilder.() -> Unit): FastI
class KPrefAdapterBuilder {
var textColor: Int? = null
+ get() = textColorGetter?.invoke() ?: field
var accentColor: Int? = null
+ get() = accentColorGetter?.invoke() ?: field
+
+ var textColorGetter: (() -> Int)? = null
+ var accentColorGetter: (() -> Int)? = null
fun header(@StringRes title: Int) = list.add(KPrefHeader(this, title))