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/kotlin/LazyContext.kt7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt b/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
index ab531bd..0a45b65 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
@@ -18,10 +18,11 @@ fun lazyInterpolator(@InterpolatorRes id: Int) = lazyContext<Interpolator> { Ani
fun lazyAnimation(@AnimRes id: Int) = lazyContext<Animation> { AnimationUtils.loadAnimation(it, id) }
-fun <T : Any> lazyContext(initializer: (context: Context) -> T): LazyContext<T> = LazyContext(initializer)
+fun <T> lazyContext(initializer: (context: Context) -> T): LazyContext<T> = LazyContext(initializer)
-class LazyContext<out T : Any>(private val initializer: (context: Context) -> T, lock: Any? = null) {
- @Volatile private var _value: Any = UNINITIALIZED
+class LazyContext<out T>(private val initializer: (context: Context) -> T, lock: Any? = null) {
+ @Volatile
+ private var _value: Any? = UNINITIALIZED
private val lock = lock ?: this
fun invalidate() {