aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-11-22 16:47:36 -0800
committerdaneren2005 <daneren2005@gmail.com>2013-11-22 16:47:36 -0800
commitd560faa5d53c6fb493e75d8017eae8956cb7a242 (patch)
tree489285565c5329b6e9842f2d77f12c46b44fad42
parentc6e853e48d381f06c6555a41db11837dd6fa1240 (diff)
downloaddsub-d560faa5d53c6fb493e75d8017eae8956cb7a242.tar.gz
dsub-d560faa5d53c6fb493e75d8017eae8956cb7a242.tar.bz2
dsub-d560faa5d53c6fb493e75d8017eae8956cb7a242.zip
Added a DownloadFile.downloadNow method
-rw-r--r--src/github/daneren2005/dsub/service/DownloadFile.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/DownloadFile.java b/src/github/daneren2005/dsub/service/DownloadFile.java
index c2cffdef..51649b62 100644
--- a/src/github/daneren2005/dsub/service/DownloadFile.java
+++ b/src/github/daneren2005/dsub/service/DownloadFile.java
@@ -99,13 +99,21 @@ public class DownloadFile {
}
public synchronized void download() {
- FileUtil.createDirectoryForParent(saveFile);
+ preDownload();
+ downloadTask.start();
+ }
+ public synchronized void downloadNow() {
+ preDownload();
+ downloadTask.execute();
+
+ }
+ private void preDownload() {
+ FileUtil.createDirectoryForParent(saveFile);
failedDownload = false;
if(!partialFile.exists()) {
bitRate = Util.getMaxBitrate(context);
}
- downloadTask = new DownloadTask();
- downloadTask.start();
+ downloadTask = new DownloadTask();
}
public synchronized void cancelDownload() {