diff options
author | daniel oeh <daniel.oeh@gmail.com> | 2013-07-07 00:45:42 +0200 |
---|---|---|
committer | daniel oeh <daniel.oeh@gmail.com> | 2013-07-07 00:45:42 +0200 |
commit | 250b88457ba2e25edd82495a1ca1b0215047c63d (patch) | |
tree | 056877e50c6d90a6d996432bf336c1e1d46058c4 /src/de/danoeh | |
parent | ab9d499ca043b135a6cb44940ad2b20aa84d391b (diff) | |
download | AntennaPod-250b88457ba2e25edd82495a1ca1b0215047c63d.zip |
Set 'reason' attribute when download was successful.
Diffstat (limited to 'src/de/danoeh')
-rw-r--r-- | src/de/danoeh/antennapod/asynctask/DownloadStatus.java | 29 | ||||
-rw-r--r-- | src/de/danoeh/antennapod/service/download/HttpDownloader.java | 13 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/de/danoeh/antennapod/asynctask/DownloadStatus.java b/src/de/danoeh/antennapod/asynctask/DownloadStatus.java index 86bcb6814..7d141f356 100644 --- a/src/de/danoeh/antennapod/asynctask/DownloadStatus.java +++ b/src/de/danoeh/antennapod/asynctask/DownloadStatus.java @@ -152,17 +152,24 @@ public class DownloadStatus { this.statusMsg = statusMsg; } - public void setReason(DownloadError reason) { - this.reason = reason; - } - - public void setSuccessful(boolean successful) { - this.successful = successful; - } - - public void setDone(boolean done) { - this.done = done; - } + public void setSuccessful() { + this.successful = true; + this.reason = DownloadError.SUCCESS; + this.done = true; + } + + public void setFailed(DownloadError reason, String reasonDetailed) { + this.successful = false; + this.reason = reason; + this.reasonDetailed = reasonDetailed; + } + + public void setCancelled() { + this.successful = false; + this.reason = DownloadError.ERROR_DOWNLOAD_CANCELLED; + this.done = true; + this.cancelled = true; + } public void setCompletionDate(Date completionDate) { this.completionDate = completionDate; diff --git a/src/de/danoeh/antennapod/service/download/HttpDownloader.java b/src/de/danoeh/antennapod/service/download/HttpDownloader.java index 6b081a96d..2310a4a09 100644 --- a/src/de/danoeh/antennapod/service/download/HttpDownloader.java +++ b/src/de/danoeh/antennapod/service/download/HttpDownloader.java @@ -158,28 +158,21 @@ public class HttpDownloader extends Downloader { private void onSuccess() { if (AppConfig.DEBUG) Log.d(TAG, "Download was successful"); - status.setSuccessful(true); - status.setDone(true); + status.setSuccessful(); } private void onFail(DownloadError reason, String reasonDetailed) { if (AppConfig.DEBUG) { Log.d(TAG, "Download failed"); } - status.setReason(reason); - status.setReasonDetailed(reasonDetailed); - status.setDone(true); - status.setSuccessful(false); + status.setFailed(reason, reasonDetailed); cleanup(); } private void onCancelled() { if (AppConfig.DEBUG) Log.d(TAG, "Download was cancelled"); - status.setReason(DownloadError.ERROR_DOWNLOAD_CANCELLED); - status.setDone(true); - status.setSuccessful(false); - status.setCancelled(true); + status.setCancelled(); cleanup(); } |