From 0e35e171558c07df14a4fe8c9cd4c00d9ffb6c8c Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 13 Apr 2014 09:09:29 -0700 Subject: Fix two cases where downloading doesn't resume after get back network connectivity --- src/github/daneren2005/dsub/service/DownloadFile.java | 7 +++++++ src/github/daneren2005/dsub/service/DownloadService.java | 2 ++ 2 files changed, 9 insertions(+) (limited to 'src/github') diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java index b3101e0a..9b7dd45d 100644 --- a/src/github/daneren2005/dsub/service/DownloadFile.java +++ b/src/github/daneren2005/dsub/service/DownloadFile.java @@ -227,6 +227,13 @@ public class DownloadFile implements BufferFile { setPlaying(false); } + @Override + public synchronized void onResume() { + if(!isFailedMax() && !isDownloading()) { + download(); + } + } + public synchronized boolean isDownloading() { return downloadTask != null && downloadTask.isRunning(); } diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java index 07b20aad..3637f731 100644 --- a/src/github/daneren2005/dsub/service/DownloadService.java +++ b/src/github/daneren2005/dsub/service/DownloadService.java @@ -1718,6 +1718,8 @@ public class DownloadService extends Service { Thread.sleep(1000L); if (isCancelled() || downloadFile.isFailedMax()) { return null; + } else if(!downloadFile.isFailedMax() && !downloadFile.isDownloading()) { + checkDownloads(); } } doPlay(downloadFile, position, start); -- cgit v1.2.3