summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/asynctask/DownloadStatus.java
blob: 67cf4a6d8bc526e94039976a805c4b157c5d93ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package de.danoeh.antennapod.asynctask;

import java.util.Date;

import de.danoeh.antennapod.feed.FeedFile;

/** Contains status attributes for one download */
public class DownloadStatus {

	public Date getCompletionDate() {
		return completionDate;
	}

	/** Unique id for storing the object in database. */
	protected long id;

	protected FeedFile feedfile;
	protected int progressPercent;
	protected long soFar;
	protected long size;
	protected int statusMsg;
	protected int reason;
	protected boolean successful;
	protected boolean done;
	protected Date completionDate;

	public DownloadStatus(FeedFile feedfile) {
		this.feedfile = feedfile;
	}

	/** Constructor for restoring Download status entries from DB. */
	public DownloadStatus(long id, FeedFile feedfile, boolean successful, int reason,
			Date completionDate) {
		this.id = id;
		this.feedfile = feedfile;
		progressPercent = 100;
		soFar = 0;
		size = 0;
		this.reason = reason;
		this.successful = successful;
		this.done = true;
		this.completionDate = completionDate;
	}
	
	
	/** Constructor for creating new completed downloads. */
	public DownloadStatus(FeedFile feedfile, int reason,
			boolean successful) {
		this(0, feedfile, successful, reason, new Date());
	}

	public FeedFile getFeedFile() {
		return feedfile;
	}

	public int getProgressPercent() {
		return progressPercent;
	}

	public long getSoFar() {
		return soFar;
	}

	public long getSize() {
		return size;
	}

	public int getStatusMsg() {
		return statusMsg;
	}

	public int getReason() {
		return reason;
	}

	public boolean isSuccessful() {
		return successful;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public boolean isDone() {
		return done;
	}
	
	
	

}