aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-02-23 20:52:21 -0500
committerGitHub <noreply@github.com>2018-02-23 20:52:21 -0500
commit3d7c85bd97261116a090a7202b0e0ed2625b5d73 (patch)
treef8d6409ef847a1ca0c0ba3640a27984703de470e /core/src/main/kotlin
parent20f0d085d6940be30b076a8cff3de25fe4a6e21a (diff)
downloadkau-3d7c85bd97261116a090a7202b0e0ed2625b5d73.tar.gz
kau-3d7c85bd97261116a090a7202b0e0ed2625b5d73.tar.bz2
kau-3d7c85bd97261116a090a7202b0e0ed2625b5d73.zip
Misc (#140)
* Nullify task * Rewrite circle view * Add better encapsulation * Update annotations * Update kpref annotations * Begin writing tests for color picker * Add color selection tests * Update changelog * Cleanup
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kotlin/Debouncer.kt6
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt1
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/ui/ProgressAnimator.kt4
3 files changed, 9 insertions, 2 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/kotlin/Debouncer.kt b/core/src/main/kotlin/ca/allanwang/kau/kotlin/Debouncer.kt
index 4c27e19..de5d148 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kotlin/Debouncer.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kotlin/Debouncer.kt
@@ -40,7 +40,11 @@ open class Debouncer(var interval: Long) {
* Call to cancel all pending requests and shutdown the thread pool
* The debouncer cannot be used after this
*/
- fun terminate() = sched.shutdownNow()
+ fun terminate() {
+ task?.invalidate()
+ task = null
+ sched.shutdownNow()
+ }
/**
* Invalidate any pending tasks
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 7e0fe70..ab531bd 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/kotlin/LazyContext.kt
@@ -14,7 +14,6 @@ import android.view.animation.Interpolator
* Items are retrieved using delegateName(context)
*
*/
-
fun lazyInterpolator(@InterpolatorRes id: Int) = lazyContext<Interpolator> { AnimationUtils.loadInterpolator(it, id) }
fun lazyAnimation(@AnimRes id: Int) = lazyContext<Animation> { AnimationUtils.loadAnimation(it, id) }
diff --git a/core/src/main/kotlin/ca/allanwang/kau/ui/ProgressAnimator.kt b/core/src/main/kotlin/ca/allanwang/kau/ui/ProgressAnimator.kt
index dc10e71..e37e59f 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/ui/ProgressAnimator.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/ui/ProgressAnimator.kt
@@ -77,6 +77,10 @@ class ProgressAnimator private constructor(private vararg val values: Float) {
override fun onAnimationEnd(animation: Animator?) {
endActions.forEach { it() }
}
+
+ override fun onAnimationCancel(animation: Animator?) {
+ endActions.forEach { it() }
+ }
})
extraConfigs()
start()