diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-05 19:20:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 19:20:27 +0200 |
commit | 92ab575b150ab49ca85e0ac994558142e49c9e68 (patch) | |
tree | 422dcd76895a4ba06ed02723ff61351435c0fe49 /event/src/main/java/de/danoeh/antennapod | |
parent | 2143ab135182434911d4554a8ef08115eaa0d2d0 (diff) | |
download | AntennaPod-92ab575b150ab49ca85e0ac994558142e49c9e68.zip |
Delete core module (#7060)
Diffstat (limited to 'event/src/main/java/de/danoeh/antennapod')
-rw-r--r-- | event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java | 12 | ||||
-rw-r--r-- | event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java b/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java index c9790d18a..28cbc234c 100644 --- a/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java +++ b/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java @@ -1,7 +1,9 @@ package de.danoeh.antennapod.event; import de.danoeh.antennapod.model.download.DownloadStatus; +import de.danoeh.antennapod.model.feed.FeedItem; +import java.util.List; import java.util.Map; import java.util.Set; @@ -15,4 +17,14 @@ public class EpisodeDownloadEvent { public Set<String> getUrls() { return map.keySet(); } + + public static int indexOfItemWithDownloadUrl(List<FeedItem> items, String downloadUrl) { + for (int i = 0; i < items.size(); i++) { + FeedItem item = items.get(i); + if (item != null && item.getMedia() != null && item.getMedia().getDownloadUrl().equals(downloadUrl)) { + return i; + } + } + return -1; + } } diff --git a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java index 125d113d6..e21764971 100644 --- a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java +++ b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java @@ -22,4 +22,14 @@ public class FeedItemEvent { public static FeedItemEvent updated(FeedItem... items) { return new FeedItemEvent(Arrays.asList(items)); } + + public static int indexOfItemWithId(List<FeedItem> items, long id) { + for (int i = 0; i < items.size(); i++) { + FeedItem item = items.get(i); + if (item != null && item.getId() == id) { + return i; + } + } + return -1; + } } |