aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
index 58e570f..6c0b608 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefSingleDelegate.kt
@@ -40,8 +40,11 @@ class KPrefSingleDelegate internal constructor(private val key: String, private
_v2
} else {
_value = pref.sp.getBoolean(key, true)
- if (_value!!) pref.sp.edit().putBoolean(key, false).apply()
- _value!!
+ if (_value!!) {
+ pref.sp.edit().putBoolean(key, false).apply()
+ _value = false
+ true
+ } else false
}
}
}