diff options
Diffstat (limited to 'core/src')
5 files changed, 17 insertions, 29 deletions
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt deleted file mode 100644 index 1a0eaac..0000000 --- a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/ChangelogTest.kt +++ /dev/null @@ -1,19 +0,0 @@ -package ca.allanwang.kau.xml - -import android.support.test.filters.MediumTest -import android.support.test.runner.AndroidJUnit4 -import org.junit.runner.RunWith - -/** - * Created by Allan Wang on 2017-07-31. - */ -@RunWith(AndroidJUnit4::class) -@MediumTest -class ChangelogTest { - - // @Test //todo internal function sharing is only available on gradle 3.0.0+ - fun simpleTest() { -// val data = parse(InstrumentationRegistry.getTargetContext(), R.xml.test_changelog) - } - -}
\ No newline at end of file diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt index c2ffa8a..b396985 100644 --- a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt +++ b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt @@ -19,10 +19,10 @@ class FaqTest { fun simpleTest() { InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq) { data -> assertEquals(2, data.size, "FAQ size is incorrect") - assertEquals("1. This is a question", data.first().first.toString(), "First question does not match") - assertEquals("This is an answer", data.first().second.toString(), "First answer does not match") - assertEquals("2. This is another question", data.last().first.toString(), "Second question does not match") - assertEquals("This is another answer", data.last().second.toString(), "Second answer does not match") + assertEquals("1. This is a question", data.first().question.toString(), "First question does not match") + assertEquals("This is an answer", data.first().answer.toString(), "First answer does not match") + assertEquals("2. This is another question", data.last().question.toString(), "Second question does not match") + assertEquals("This is another answer", data.last().answer.toString(), "Second answer does not match") } } @@ -30,10 +30,10 @@ class FaqTest { fun withoutNumbering() { InstrumentationRegistry.getTargetContext().kauParseFaq(R.xml.test_faq, false) { data -> assertEquals(2, data.size, "FAQ size is incorrect") - assertEquals("This is a question", data.first().first.toString(), "First question does not match") - assertEquals("This is an answer", data.first().second.toString(), "First answer does not match") - assertEquals("This is another question", data.last().first.toString(), "Second question does not match") - assertEquals("This is another answer", data.last().second.toString(), "Second answer does not match") + assertEquals("This is a question", data.first().question.toString(), "First question does not match") + assertEquals("This is an answer", data.first().answer.toString(), "First answer does not match") + assertEquals("This is another question", data.last().question.toString(), "Second question does not match") + assertEquals("This is another answer", data.last().answer.toString(), "Second answer does not match") } } 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() |