From ea790faeb36e85cd194f74a792c05383dc9bac90 Mon Sep 17 00:00:00 2001 From: len Date: Sat, 26 Nov 2016 12:26:40 +0100 Subject: [PATCH] Always cancel library update task --- .../tachiyomi/ui/setting/SettingsGeneralFragment.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt index d5782bd46..87b94fd5c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt @@ -57,12 +57,13 @@ class SettingsGeneralFragment : SettingsFragment(), .subscribe { updateColumnsSummary(it.first, it.second) } updateInterval.setOnPreferenceChangeListener { preference, newValue -> - val interval = (newValue as String).toInt() - if (interval > 0) - LibraryUpdateJob.setupTask(interval) - else - LibraryUpdateJob.cancelTask() + // Always cancel the previous task, it seems that sometimes they are not updated. + LibraryUpdateJob.cancelTask() + val interval = (newValue as String).toInt() + if (interval > 0) { + LibraryUpdateJob.setupTask(interval) + } true }