Преглед на файлове

Always cancel library update task

len преди 8 години
родител
ревизия
ea790faeb3
променени са 1 файла, в които са добавени 5 реда и са изтрити 4 реда
  1. 5 4
      app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsGeneralFragment.kt

+ 5 - 4
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 ->
+            // Always cancel the previous task, it seems that sometimes they are not updated.
+            LibraryUpdateJob.cancelTask()
+
             val interval = (newValue as String).toInt()
-            if (interval > 0)
+            if (interval > 0) {
                 LibraryUpdateJob.setupTask(interval)
-            else
-                LibraryUpdateJob.cancelTask()
-
+            }
             true
         }