Merge pull request #30 from CarlosEsco/reorderFix

fix bug in download page that causes reorder to start the queue
This commit is contained in:
Jays2Kings 2020-01-03 15:34:17 -05:00 committed by GitHub
commit 5cfb3b3b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -99,10 +99,13 @@ class DownloadManager(context: Context) {
* @param downloads value to set the download queue to * @param downloads value to set the download queue to
*/ */
fun reorderQueue(downloads: List<Download>) { fun reorderQueue(downloads: List<Download>) {
val wasPaused = downloader.isPaused()
downloader.pause() downloader.pause()
downloader.queue.clear() downloader.queue.clear()
downloader.queue.addAll(downloads) downloader.queue.addAll(downloads)
downloader.start() if(!wasPaused){
downloader.start()
}
} }

View File

@ -145,6 +145,11 @@ class Downloader(
notifier.paused = true notifier.paused = true
} }
/**
* Check if downloader is paused
*/
fun isPaused() = !isRunning
/** /**
* Removes everything from the queue. * Removes everything from the queue.
* *