aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2014-06-18 09:21:59 -0700
committerdaneren2005 <daneren2005@gmail.com>2014-06-18 09:21:59 -0700
commit01ab305fabf7936d44b0f6af8de6ecb4c670cb20 (patch)
treece0f53c366377e3940a45f48fe28eb4168e15160 /src
parenta283e27f6aba61c404c50d73819398611afd14f5 (diff)
downloaddsub-01ab305fabf7936d44b0f6af8de6ecb4c670cb20.tar.gz
dsub-01ab305fabf7936d44b0f6af8de6ecb4c670cb20.tar.bz2
dsub-01ab305fabf7936d44b0f6af8de6ecb4c670cb20.zip
Fix stalling downloads when just switching complete to pin
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/DownloadFile.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java
index 5a9af6d6..c82607f5 100644
--- a/src/github/daneren2005/dsub/service/DownloadFile.java
+++ b/src/github/daneren2005/dsub/service/DownloadFile.java
@@ -357,7 +357,6 @@ public class DownloadFile implements BufferFile {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, toString());
wakeLock.acquire();
- Log.i(TAG, "Acquired wake lock " + wakeLock);
}
wifiLock = Util.createWifiLock(context, toString());
@@ -365,6 +364,7 @@ public class DownloadFile implements BufferFile {
if (saveFile.exists()) {
Log.i(TAG, saveFile + " already exists. Skipping.");
+ checkDownloads();
return null;
}
if (completeFile.exists()) {
@@ -377,6 +377,7 @@ public class DownloadFile implements BufferFile {
} else {
Log.i(TAG, completeFile + " already exists. Skipping.");
}
+ checkDownloads();
return null;
}
@@ -477,13 +478,17 @@ public class DownloadFile implements BufferFile {
// Only run these if not interrupted, ie: cancelled
new CacheCleaner(context, DownloadService.getInstance()).cleanSpace();
-
- if(DownloadService.getInstance() != null) {
- DownloadService.getInstance().checkDownloads();
- }
+ checkDownloads();
return null;
}
+
+ private void checkDownloads() {
+ DownloadService downloadService = DownloadService.getInstance();
+ if(downloadService != null) {
+ downloadService.checkDownloads();
+ }
+ }
@Override
public String toString() {