From d560faa5d53c6fb493e75d8017eae8956cb7a242 Mon Sep 17 00:00:00 2001 From: daneren2005 Date: Fri, 22 Nov 2013 16:47:36 -0800 Subject: Added a DownloadFile.downloadNow method --- src/github/daneren2005/dsub/service/DownloadFile.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') 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() { -- cgit v1.2.3