diff options
author | Allan Wang <me@allanwang.ca> | 2018-09-06 15:12:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-06 15:12:51 -0400 |
commit | 6af0c6f7671898d0756c2e63dd17e830a2389885 (patch) | |
tree | 2b46565b6ac4efa6a03ecbccd10b13d9ab011a75 | |
parent | dca58435ac0ca941a488c117363e2920e083dfa9 (diff) | |
download | kau-6af0c6f7671898d0756c2e63dd17e830a2389885.tar.gz kau-6af0c6f7671898d0756c2e63dd17e830a2389885.tar.bz2 kau-6af0c6f7671898d0756c2e63dd17e830a2389885.zip |
Enhancement/LazyContext (#159)
* Update constraint version
* Allow nullable lazy context
-rw-r--r-- | buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy | 2 | ||||
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy index decb2fe..4b7149e 100644 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy +++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy @@ -24,7 +24,7 @@ class Versions { static def blurry = '2.1.1' // https://dl.google.com/dl/android/maven2/com/android/support/constraint/group-index.xml - static def constraintLayout = '1.1.0' + static def constraintLayout = '1.1.3' // https://github.com/mikepenz/FastAdapter#using-maven static def fastAdapter = '3.2.5' 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() { |