summaryrefslogtreecommitdiff
path: root/net/download
diff options
context:
space:
mode:
Diffstat (limited to 'net/download')
-rw-r--r--net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequest.java54
-rw-r--r--net/download/service-interface/src/test/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequestTest.java3
2 files changed, 8 insertions, 49 deletions
diff --git a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequest.java b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequest.java
index 9f9737edc..962ecfc84 100644
--- a/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequest.java
+++ b/net/download/service-interface/src/main/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequest.java
@@ -14,7 +14,6 @@ import de.danoeh.antennapod.model.feed.FeedMedia;
public class DownloadRequest implements Parcelable {
public static final String REQUEST_ARG_PAGE_NR = "page";
- public static final String REQUEST_ARG_LOAD_ALL_PAGES = "loadAllPages";
private final String destination;
private final String source;
@@ -22,7 +21,6 @@ public class DownloadRequest implements Parcelable {
private String username;
private String password;
private String lastModified;
- private final boolean deleteOnFailure;
private final long feedfileId;
private final int feedfileType;
private final Bundle arguments;
@@ -35,26 +33,26 @@ public class DownloadRequest implements Parcelable {
private boolean initiatedByUser;
public DownloadRequest(@NonNull String destination, @NonNull String source, @NonNull String title, long feedfileId,
- int feedfileType, String username, String password, boolean deleteOnFailure,
+ int feedfileType, String username, String password,
Bundle arguments, boolean initiatedByUser) {
- this(destination, source, title, feedfileId, feedfileType, null, deleteOnFailure, username, password, false,
- arguments, initiatedByUser);
+ this(destination, source, title, feedfileId, feedfileType, null, username, password, false,
+ arguments, initiatedByUser);
}
private DownloadRequest(Builder builder) {
this(builder.destination, builder.source, builder.title, builder.feedfileId, builder.feedfileType,
- builder.lastModified, builder.deleteOnFailure, builder.username, builder.password, false,
- builder.arguments != null ? builder.arguments : new Bundle(), builder.initiatedByUser);
+ builder.lastModified, builder.username, builder.password, false,
+ builder.arguments, builder.initiatedByUser);
}
private DownloadRequest(Parcel in) {
this(in.readString(), in.readString(), in.readString(), in.readLong(), in.readInt(), in.readString(),
- in.readByte() > 0, nullIfEmpty(in.readString()), nullIfEmpty(in.readString()), in.readByte() > 0,
- in.readBundle(), in.readByte() > 0);
+ nullIfEmpty(in.readString()), nullIfEmpty(in.readString()), in.readByte() > 0,
+ in.readBundle(), in.readByte() > 0);
}
private DownloadRequest(String destination, String source, String title, long feedfileId, int feedfileType,
- String lastModified, boolean deleteOnFailure, String username, String password,
+ String lastModified, String username, String password,
boolean mediaEnqueued, Bundle arguments, boolean initiatedByUser) {
this.destination = destination;
this.source = source;
@@ -62,7 +60,6 @@ public class DownloadRequest implements Parcelable {
this.feedfileId = feedfileId;
this.feedfileType = feedfileType;
this.lastModified = lastModified;
- this.deleteOnFailure = deleteOnFailure;
this.username = username;
this.password = password;
this.mediaEnqueued = mediaEnqueued;
@@ -83,7 +80,6 @@ public class DownloadRequest implements Parcelable {
dest.writeLong(feedfileId);
dest.writeInt(feedfileType);
dest.writeString(lastModified);
- dest.writeByte((deleteOnFailure) ? (byte) 1 : 0);
// in case of null username/password, still write an empty string
// (rather than skipping it). Otherwise, unmarshalling a collection
// of them from a Parcel (from an Intent extra to submit a request to DownloadService) will fail.
@@ -124,7 +120,6 @@ public class DownloadRequest implements Parcelable {
if (lastModified != null ? !lastModified.equals(that.lastModified) : that.lastModified != null)
return false;
- if (deleteOnFailure != that.deleteOnFailure) return false;
if (feedfileId != that.feedfileId) return false;
if (feedfileType != that.feedfileType) return false;
if (progressPercent != that.progressPercent) return false;
@@ -151,7 +146,6 @@ public class DownloadRequest implements Parcelable {
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (password != null ? password.hashCode() : 0);
result = 31 * result + (lastModified != null ? lastModified.hashCode() : 0);
- result = 31 * result + (deleteOnFailure ? 1 : 0);
result = 31 * result + (int) (feedfileId ^ (feedfileId >>> 32));
result = 31 * result + feedfileType;
result = 31 * result + arguments.hashCode();
@@ -237,26 +231,6 @@ public class DownloadRequest implements Parcelable {
return lastModified;
}
- public boolean isDeleteOnFailure() {
- return deleteOnFailure;
- }
-
- public boolean isMediaEnqueued() {
- return mediaEnqueued;
- }
-
- public boolean isInitiatedByUser() {
- return initiatedByUser;
- }
-
- /**
- * Set to true if the media is enqueued because of this download.
- * The state is helpful if the download is cancelled, and undoing the enqueue is needed.
- */
- public void setMediaEnqueued(boolean mediaEnqueued) {
- this.mediaEnqueued = mediaEnqueued;
- }
-
public Bundle getArguments() {
return arguments;
}
@@ -268,7 +242,6 @@ public class DownloadRequest implements Parcelable {
private String username;
private String password;
private String lastModified;
- private boolean deleteOnFailure = false;
private final long feedfileId;
private final int feedfileType;
private final Bundle arguments = new Bundle();
@@ -306,11 +279,6 @@ public class DownloadRequest implements Parcelable {
}
}
- public Builder deleteOnFailure(boolean deleteOnFailure) {
- this.deleteOnFailure = deleteOnFailure;
- return this;
- }
-
public Builder lastModified(String lastModified) {
this.lastModified = lastModified;
return this;
@@ -322,12 +290,6 @@ public class DownloadRequest implements Parcelable {
return this;
}
- public void loadAllPages(boolean loadAllPages) {
- if (loadAllPages) {
- arguments.putBoolean(REQUEST_ARG_LOAD_ALL_PAGES, true);
- }
- }
-
public DownloadRequest build() {
return new DownloadRequest(this);
}
diff --git a/net/download/service-interface/src/test/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequestTest.java b/net/download/service-interface/src/test/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequestTest.java
index 2709744f7..a48934cfe 100644
--- a/net/download/service-interface/src/test/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequestTest.java
+++ b/net/download/service-interface/src/test/java/de/danoeh/antennapod/net/download/serviceinterface/DownloadRequestTest.java
@@ -41,17 +41,14 @@ public class DownloadRequestTest {
String password = "testPassword";
FeedMedia item = createFeedItem(1);
DownloadRequest request1 = new DownloadRequest.Builder(destStr, item)
- .deleteOnFailure(true)
.withAuthentication(username, password)
.build();
DownloadRequest request2 = new DownloadRequest.Builder(destStr, item)
- .deleteOnFailure(true)
.withAuthentication(username, password)
.build();
DownloadRequest request3 = new DownloadRequest.Builder(destStr, item)
- .deleteOnFailure(true)
.withAuthentication("diffUsername", "diffPassword")
.build();