diff options
author | Allan Wang <me@allanwang.ca> | 2018-01-27 04:19:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 04:19:33 -0500 |
commit | 91e4b0cd099d24cc645d5c935c9ed0c97d7fa5d8 (patch) | |
tree | 3e300b9afdcfede0614452ae7696fb96c1fdbefa /kpref-activity/src | |
parent | 3a92363e65a29b6106cdfa98d6bcf297b0eda5ad (diff) | |
download | kau-91e4b0cd099d24cc645d5c935c9ed0c97d7fa5d8.tar.gz kau-91e4b0cd099d24cc645d5c935c9ed0c97d7fa5d8.tar.bz2 kau-91e4b0cd099d24cc645d5c935c9ed0c97d7fa5d8.zip |
Disable seekbar properly when pref is disabled (#134)
Diffstat (limited to 'kpref-activity/src')
-rw-r--r-- | kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt | 10 |
1 files changed, 5 insertions, 5 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 83bbe87..a580e83 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 @@ -36,14 +36,14 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>( override fun onStartTrackingTouch(sb: SeekBar) {} override fun onStopTrackingTouch(sb: SeekBar) { - val trueProgress = sb.progress.fromProgress - pref = trueProgress + pref = sb.progress.fromProgress } }) } withAccentColor(seekbar::tint) text.text = builder.toText(seekbar.progress.fromProgress) //set initial text in case no change occurs seekbar.progress = pref.toProgress + seekbar.isEnabled = builder.enabler() } /** @@ -76,15 +76,15 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase<Int>( override var increments: Int = 1 - override var toText: (Int) -> String = { it.toString() } + override var toText: (Int) -> String = Int::toString override var textViewConfigs: TextView.() -> Unit = {} } - val Int.toProgress: Int + protected inline val Int.toProgress: Int get() = this - builder.min - val Int.fromProgress: Int + protected inline val Int.fromProgress: Int get() = this + builder.min override fun getType(): Int = R.id.kau_item_pref_seekbar |