aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt')
-rw-r--r--app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt b/app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt
index 9e2cd89..7c523f4 100644
--- a/app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt
+++ b/app/src/main/java/moe/yuuta/workmode/update/LifecycleUpdateChecker.kt
@@ -13,7 +13,8 @@ class LifecycleUpdateChecker(val context: Context, val callback: moe.yuuta.workm
private lateinit var mStoppable: Stoppable
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
- fun onCreate() {
+ fun start() {
+ stop()
mStoppable = Async.beginTask(UpdateChecker(), object : Callback<Update> {
override fun onStop(success: Boolean, result: Update?, e: Throwable?) {
if (result == null) return
@@ -32,7 +33,7 @@ class LifecycleUpdateChecker(val context: Context, val callback: moe.yuuta.workm
}
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
- fun onDestroy() {
+ fun stop() {
if (::mStoppable.isInitialized) {
mStoppable.stop()
}