aboutsummaryrefslogtreecommitdiff
path: root/kpref-activity
diff options
context:
space:
mode:
Diffstat (limited to 'kpref-activity')
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt16
1 files changed, 8 insertions, 8 deletions
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 78f4f80..ce61e8f 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
@@ -15,14 +15,9 @@ import ca.allanwang.kau.utils.tint
*/
open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>(builder) {
- protected val min = builder.min
- protected val max = builder.max
- protected val increment = builder.increments
-
- init {
- if (increment <= 0)
- throw IllegalArgumentException("Seekbar must increment by at least 1")
- }
+ protected inline val min get() = builder.min
+ protected inline val max get() = builder.max
+ protected inline val increment get() = builder.increments
override fun KClick<Int>.defaultOnClick() = Unit
@@ -83,6 +78,11 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>(
override var max: Int = 100
override var increments: Int = 1
+ set(value) {
+ if (value <= 0)
+ throw IllegalArgumentException("Seekbar must increment by at least 1")
+ field = value
+ }
override var toText: (Int) -> String = Int::toString