From 92ab575b150ab49ca85e0ac994558142e49c9e68 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 5 Apr 2024 19:20:27 +0200 Subject: Delete core module (#7060) --- .../de/danoeh/antennapod/event/EpisodeDownloadEvent.java | 12 ++++++++++++ .../main/java/de/danoeh/antennapod/event/FeedItemEvent.java | 10 ++++++++++ 2 files changed, 22 insertions(+) (limited to 'event/src/main/java') 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 getUrls() { return map.keySet(); } + + public static int indexOfItemWithDownloadUrl(List 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 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; + } } -- cgit v1.2.3