summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java19
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java20
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java19
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java11
4 files changed, 68 insertions, 1 deletions
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java b/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
index 3683a2a44..f6a5205d2 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
@@ -1,6 +1,7 @@
package de.danoeh.antennapod.model.feed;
import java.util.List;
+import java.util.Objects;
public class Chapter {
private long id;
@@ -88,4 +89,22 @@ public class Chapter {
}
return chapters.size() - 1;
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Chapter chapter = (Chapter) o;
+ return id == chapter.id;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id);
+ }
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java
index 15d256c24..99e7ca9dc 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/Feed.java
@@ -5,6 +5,8 @@ import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Objects;
+
import org.apache.commons.lang3.StringUtils;
/**
@@ -468,4 +470,22 @@ public class Feed {
public boolean isLocalFeed() {
return downloadUrl.startsWith(PREFIX_LOCAL_FOLDER);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Feed feed = (Feed) o;
+ return id == feed.id;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id);
+ }
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
index df4cc8f9c..2a62e3e34 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
@@ -11,6 +11,7 @@ import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
/**
@@ -418,4 +419,22 @@ public class FeedItem implements Serializable {
public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ FeedItem feedItem = (FeedItem) o;
+ return id == feedItem.id;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id);
+ }
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java
index 698cdf34e..1f0786875 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedMedia.java
@@ -501,12 +501,21 @@ public class FeedMedia implements Playable {
@Override
public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
if (o == null) {
return false;
}
if (o instanceof RemoteMedia) {
return o.equals(this);
}
- return super.equals(o);
+
+ if (getClass() != o.getClass()) {
+ return false;
+ }
+
+ FeedMedia feedMedia = (FeedMedia) o;
+ return id == feedMedia.id;
}
}