Always cancel library update task

This commit is contained in:
len 2016-11-26 12:26:40 +01:00
parent 4ef7b16925
commit ea790faeb3

View File

@ -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
}