aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-22 17:58:48 -0700
committerAllan Wang <me@allanwang.ca>2019-05-22 17:58:48 -0700
commitaf8f9685112695f031d93fcb2da8a6e0a3b70c4a (patch)
tree717788a8aafda153a3b849bf04a75d8d2421a513
parentd84a4b7e709d887f46b6d7dd726d29772c11fd18 (diff)
downloadkau-af8f9685112695f031d93fcb2da8a6e0a3b70c4a.tar.gz
kau-af8f9685112695f031d93fcb2da8a6e0a3b70c4a.tar.bz2
kau-af8f9685112695f031d93fcb2da8a6e0a3b70c4a.zip
Remove kpref action context for getter
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt10
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefColorPicker.kt2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemBase.kt6
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefText.kt4
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt2
6 files changed, 13 insertions, 13 deletions
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
index ec3c69f..764831e 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
@@ -82,7 +82,7 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@KPrefMarker
fun checkbox(
@StringRes title: Int,
- getter: KPrefItemActions.() -> Boolean,
+ getter: () -> Boolean,
setter: KPrefItemActions.(value: Boolean) -> Unit,
builder: KPrefItemBase.BaseContract<Boolean>.() -> Unit = {}
) = list.add(
@@ -93,7 +93,7 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@KPrefMarker
fun colorPicker(
@StringRes title: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefColorPicker.KPrefColorContract.() -> Unit = {}
) = list.add(
@@ -104,7 +104,7 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@KPrefMarker
fun <T> text(
@StringRes title: Int,
- getter: KPrefItemActions.() -> T,
+ getter: () -> T,
setter: KPrefItemActions.(value: T) -> Unit,
builder: KPrefText.KPrefTextContract<T>.() -> Unit = {}
) = list.add(
@@ -134,7 +134,7 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@KPrefMarker
fun seekbar(
@StringRes title: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefSeekbar.KPrefSeekbarContract.() -> Unit = {}
) = list.add(
@@ -145,7 +145,7 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@KPrefMarker
fun timePicker(
@StringRes title: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefTimePicker.KPrefTimeContract.() -> Unit = {}
) = list.add(
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 07a6bbf..0b53797 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
@@ -72,7 +72,7 @@ open class KPrefColorPicker(open val builder: KPrefColorContract) : KPrefItemBas
class KPrefColorBuilder(
globalOptions: GlobalOptions,
titleId: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit
) : KPrefColorContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter),
ColorContract by ColorBuilder() {
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 a445de5..c597b63 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
@@ -31,7 +31,7 @@ import ca.allanwang.kau.utils.resolveDrawable
abstract class KPrefItemBase<T>(protected val base: BaseContract<T>) : KPrefItemCore(base) {
open var pref: T
- get() = base.getter(this)
+ get() = base.getter()
set(value) {
base.setter(this, value)
}
@@ -93,7 +93,7 @@ abstract class KPrefItemBase<T>(protected val base: BaseContract<T>) : KPrefItem
var enabler: () -> Boolean
var onClick: (KClick<T>.() -> Unit)?
var onDisabledClick: (KClick<T>.() -> Unit)?
- val getter: KPrefItemActions.() -> T
+ val getter: () -> T
val setter: KPrefItemActions.(value: T) -> Unit
}
@@ -103,7 +103,7 @@ abstract class KPrefItemBase<T>(protected val base: BaseContract<T>) : KPrefItem
class BaseBuilder<T>(
globalOptions: GlobalOptions,
titleId: Int,
- override val getter: KPrefItemActions.() -> T,
+ override val getter: () -> T,
override val setter: KPrefItemActions.(value: T) -> Unit
) : CoreContract by CoreBuilder(globalOptions, titleId), BaseContract<T> {
override var enabler: () -> Boolean = { true }
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 d49fe16..a582ec4 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
@@ -85,7 +85,7 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>(
class KPrefSeekbarBuilder(
globalOptions: GlobalOptions,
titleId: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit
) : KPrefSeekbarContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter) {
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 5f6eefa..76c9e20 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
@@ -36,7 +36,7 @@ open class KPrefText<T>(open val builder: KPrefTextContract<T>) : KPrefItemBase<
* Automatically reload on set
*/
override var pref: T
- get() = base.getter(this)
+ get() = base.getter()
set(value) {
base.setter(this, value)
builder.reloadSelf()
@@ -66,7 +66,7 @@ open class KPrefText<T>(open val builder: KPrefTextContract<T>) : KPrefItemBase<
class KPrefTextBuilder<T>(
globalOptions: GlobalOptions,
titleId: Int,
- getter: KPrefItemActions.() -> T,
+ getter: () -> T,
setter: KPrefItemActions.(value: T) -> Unit
) : KPrefTextContract<T>, BaseContract<T> by BaseBuilder<T>(globalOptions, titleId, getter, setter) {
override var textGetter: (T) -> String? = { it?.toString() }
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
index f2824a7..f50397c 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
@@ -48,7 +48,7 @@ open class KPrefTimePicker(override val builder: KPrefTimeContract) : KPrefText<
class KPrefTimeBuilder(
globalOptions: GlobalOptions,
titleId: Int,
- getter: KPrefItemActions.() -> Int,
+ getter: () -> Int,
setter: KPrefItemActions.(value: Int) -> Unit
) : KPrefTimeContract, BaseContract<Int> by BaseBuilder(globalOptions, titleId, getter, setter) {