Set 'reason' attribute when download was successful.
This commit is contained in:
parent
ab9d499ca0
commit
250b88457b
|
@ -7,6 +7,7 @@ ortylp
|
|||
LatinSuD
|
||||
wseemann
|
||||
hzulla
|
||||
andrewgaul
|
||||
|
||||
Translations:
|
||||
|
||||
|
|
|
@ -152,17 +152,24 @@ public class DownloadStatus {
|
|||
this.statusMsg = statusMsg;
|
||||
}
|
||||
|
||||
public void setReason(DownloadError reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
public void setSuccessful() {
|
||||
this.successful = true;
|
||||
this.reason = DownloadError.SUCCESS;
|
||||
this.done = true;
|
||||
}
|
||||
|
||||
public void setSuccessful(boolean successful) {
|
||||
this.successful = successful;
|
||||
}
|
||||
public void setFailed(DownloadError reason, String reasonDetailed) {
|
||||
this.successful = false;
|
||||
this.reason = reason;
|
||||
this.reasonDetailed = reasonDetailed;
|
||||
}
|
||||
|
||||
public void setDone(boolean done) {
|
||||
this.done = done;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue