diff options
author | ByteHamster <info@bytehamster.com> | 2021-04-22 23:17:11 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-04-22 23:17:11 +0200 |
commit | ba66ae76337133d92963fbf9c8ead27ee81ef148 (patch) | |
tree | fd08fbf6c70d43a39130a988deac97f80589cff3 /core | |
parent | 2a47f49fde3327ee3a1b3c2d66b2c950cda7e14e (diff) | |
download | AntennaPod-ba66ae76337133d92963fbf9c8ead27ee81ef148.zip |
Moved model to its own module
Diffstat (limited to 'core')
138 files changed, 278 insertions, 3017 deletions
diff --git a/core/build.gradle b/core/build.gradle index 3d725e6dd..e5ab13bcd 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -73,6 +73,7 @@ android { } dependencies { + implementation project(':model') implementation project(':net:ssl') implementation project(':ui:app-start-intent') implementation project(':ui:common') diff --git a/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java b/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java deleted file mode 100644 index 9833e2cc9..000000000 --- a/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java +++ /dev/null @@ -1,11 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -/** - * Implements methods for FeedMedia that are flavor dependent. - */ -class FeedMediaFlavorHelper { - private FeedMediaFlavorHelper(){} - static boolean instanceOfRemoteMedia(Object o) { - return false; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java index 6ca84ff87..fca83351c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java @@ -31,7 +31,7 @@ import java.util.Arrays; import de.danoeh.antennapod.core.export.opml.OpmlElement; import de.danoeh.antennapod.core.export.opml.OpmlReader; import de.danoeh.antennapod.core.export.opml.OpmlWriter; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/DownloaderUpdate.java b/core/src/main/java/de/danoeh/antennapod/core/event/DownloaderUpdate.java index 10992408d..1cab7e0f0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/DownloaderUpdate.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/DownloaderUpdate.java @@ -5,8 +5,8 @@ import androidx.annotation.NonNull; import java.util.Arrays; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.service.download.Downloader; import de.danoeh.antennapod.core.util.LongList; diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java index d3be8fac0..cbfcc37e6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java @@ -5,7 +5,7 @@ import androidx.annotation.NonNull; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; public class FavoritesEvent { diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java index 02559b2f5..99cb01714 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java @@ -9,7 +9,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Arrays; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; public class FeedItemEvent { diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FeedListUpdateEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FeedListUpdateEvent.java index ca8db3cc9..4ed8e33ec 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FeedListUpdateEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FeedListUpdateEvent.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.event; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java index f9a8c63b6..c866939bd 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/QueueEvent.java @@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; public class QueueEvent { diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/settings/VolumeAdaptionChangedEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/settings/VolumeAdaptionChangedEvent.java index 3ed84f6a8..3905ce68f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/settings/VolumeAdaptionChangedEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/settings/VolumeAdaptionChangedEvent.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.event.settings; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; public class VolumeAdaptionChangedEvent { private final VolumeAdaptionSetting volumeAdaptionSetting; diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/ExportWriter.java b/core/src/main/java/de/danoeh/antennapod/core/export/ExportWriter.java index e0f0d4626..e60609569 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/ExportWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/ExportWriter.java @@ -19,7 +19,7 @@ import java.io.IOException; import java.io.Writer; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; public interface ExportWriter { diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java b/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java index 60c38a391..9bc273c9e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/favorites/FavoritesWriter.java @@ -15,8 +15,8 @@ import java.util.Map; import java.util.TreeMap; import de.danoeh.antennapod.core.export.ExportWriter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.storage.DBReader; /** Writes saved favorites to file. */ diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/html/HtmlWriter.java b/core/src/main/java/de/danoeh/antennapod/core/export/html/HtmlWriter.java index 3f34343ee..8a660600f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/html/HtmlWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/html/HtmlWriter.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.export.html; import android.content.Context; import android.util.Log; import de.danoeh.antennapod.core.export.ExportWriter; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import java.io.IOException; import java.io.InputStream; import java.io.Writer; diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java b/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java index c93d4e8e0..e2205471c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlWriter.java @@ -12,7 +12,7 @@ import java.util.Date; import java.util.List; import de.danoeh.antennapod.core.export.ExportWriter; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.util.DateUtils; /** Writes OPML documents. */ diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java deleted file mode 100644 index 41b56277e..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java +++ /dev/null @@ -1,65 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -public abstract class Chapter extends FeedComponent { - - /** Defines starting point in milliseconds. */ - long start; - String title; - String link; - String imageUrl; - - Chapter() { - } - - Chapter(long start) { - super(); - this.start = start; - } - - Chapter(long start, String title, String link, String imageUrl) { - super(); - this.start = start; - this.title = title; - this.link = link; - this.imageUrl = imageUrl; - } - - public abstract int getChapterType(); - - public long getStart() { - return start; - } - - public String getTitle() { - return title; - } - - public String getLink() { - return link; - } - - public void setStart(long start) { - this.start = start; - } - - public void setTitle(String title) { - this.title = title; - } - - public void setLink(String link) { - this.link = link; - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - @Override - public String getHumanReadableIdentifier() { - return title; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/ChapterMerger.java b/core/src/main/java/de/danoeh/antennapod/core/feed/ChapterMerger.java index f33fa7511..80e669939 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/ChapterMerger.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/ChapterMerger.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.feed; import android.text.TextUtils; import android.util.Log; import androidx.annotation.Nullable; +import de.danoeh.antennapod.model.feed.Chapter; import java.util.List; @@ -34,19 +35,19 @@ public class ChapterMerger { Chapter chapterTarget = chapters2.get(i); Chapter chapterOther = chapters1.get(i); - if (Math.abs(chapterTarget.start - chapterOther.start) > 1000) { + if (Math.abs(chapterTarget.getStart() - chapterOther.getStart()) > 1000) { Log.e(TAG, "Chapter lists are too different. Cancelling merge."); return chapters1; } - if (TextUtils.isEmpty(chapterTarget.imageUrl)) { - chapterTarget.imageUrl = chapterOther.imageUrl; + if (TextUtils.isEmpty(chapterTarget.getImageUrl())) { + chapterTarget.setImageUrl(chapterOther.getImageUrl()); } - if (TextUtils.isEmpty(chapterTarget.link)) { - chapterTarget.link = chapterOther.link; + if (TextUtils.isEmpty(chapterTarget.getLink())) { + chapterTarget.setLink(chapterOther.getLink()); } - if (TextUtils.isEmpty(chapterTarget.title)) { - chapterTarget.title = chapterOther.title; + if (TextUtils.isEmpty(chapterTarget.getTitle())) { + chapterTarget.setTitle(chapterOther.getTitle()); } } return chapters2; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java deleted file mode 100644 index 617997465..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/Feed.java +++ /dev/null @@ -1,504 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import android.text.TextUtils; - -import androidx.annotation.Nullable; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import de.danoeh.antennapod.core.util.SortOrder; - -/** - * Data Object for a whole feed. - * - * @author daniel - */ -public class Feed extends FeedFile { - - public static final int FEEDFILETYPE_FEED = 0; - public static final String TYPE_RSS2 = "rss"; - public static final String TYPE_ATOM1 = "atom"; - public static final String PREFIX_LOCAL_FOLDER = "antennapod_local:"; - - /** - * title as defined by the feed. - */ - private String feedTitle; - - /** - * custom title set by the user. - */ - private String customTitle; - - /** - * Contains 'id'-element in Atom feed. - */ - private String feedIdentifier; - /** - * Link to the website. - */ - private String link; - private String description; - private String language; - /** - * Name of the author. - */ - private String author; - private String imageUrl; - private List<FeedItem> items; - - /** - * String that identifies the last update (adopted from Last-Modified or ETag header). - */ - private String lastUpdate; - - private ArrayList<FeedFunding> fundingList; - /** - * Feed type, for example RSS 2 or Atom. - */ - private String type; - - /** - * Feed preferences. - */ - private FeedPreferences preferences; - - /** - * The page number that this feed is on. Only feeds with page number "0" should be stored in the - * database, feed objects with a higher page number only exist temporarily and should be merged - * into feeds with page number "0". - * <p/> - * This attribute's value is not saved in the database - */ - private int pageNr; - - /** - * True if this is a "paged feed", i.e. there exist other feed files that belong to the same - * logical feed. - */ - private boolean paged; - - /** - * Link to the next page of this feed. If this feed object represents a logical feed (i.e. a feed - * that is saved in the database) this might be null while still being a paged feed. - */ - private String nextPageLink; - - private boolean lastUpdateFailed; - - /** - * Contains property strings. If such a property applies to a feed item, it is not shown in the feed list - */ - private FeedItemFilter itemfilter; - - /** - * User-preferred sortOrder for display. - * Only those of scope {@link SortOrder.Scope#INTRA_FEED} is allowed. - */ - @Nullable - private SortOrder sortOrder; - - /** - * This constructor is used for restoring a feed from the database. - */ - public Feed(long id, String lastUpdate, String title, String customTitle, String link, - String description, String paymentLinks, String author, String language, - String type, String feedIdentifier, String imageUrl, String fileUrl, - String downloadUrl, boolean downloaded, boolean paged, String nextPageLink, - String filter, @Nullable SortOrder sortOrder, boolean lastUpdateFailed) { - super(fileUrl, downloadUrl, downloaded); - this.id = id; - this.feedTitle = title; - this.customTitle = customTitle; - this.lastUpdate = lastUpdate; - this.link = link; - this.description = description; - this.fundingList = FeedFunding.extractPaymentLinks(paymentLinks); - this.author = author; - this.language = language; - this.type = type; - this.feedIdentifier = feedIdentifier; - this.imageUrl = imageUrl; - this.paged = paged; - this.nextPageLink = nextPageLink; - this.items = new ArrayList<>(); - if (filter != null) { - this.itemfilter = new FeedItemFilter(filter); - } else { - this.itemfilter = new FeedItemFilter(new String[0]); - } - setSortOrder(sortOrder); - this.lastUpdateFailed = lastUpdateFailed; - } - - /** - * This constructor is used for test purposes. - */ - public Feed(long id, String lastUpdate, String title, String link, String description, String paymentLink, - String author, String language, String type, String feedIdentifier, String imageUrl, String fileUrl, - String downloadUrl, boolean downloaded) { - this(id, lastUpdate, title, null, link, description, paymentLink, author, language, type, feedIdentifier, imageUrl, - fileUrl, downloadUrl, downloaded, false, null, null, null, false); - } - - /** - * This constructor can be used when parsing feed data. Only the 'lastUpdate' and 'items' field are initialized. - */ - public Feed() { - super(); - } - - /** - * This constructor is used for requesting a feed download (it must not be used for anything else!). It should NOT be - * used if the title of the feed is already known. - */ - public Feed(String url, String lastUpdate) { - super(null, url, false); - this.lastUpdate = lastUpdate; - } - - /** - * This constructor is used for requesting a feed download (it must not be used for anything else!). It should be - * used if the title of the feed is already known. - */ - public Feed(String url, String lastUpdate, String title) { - this(url, lastUpdate); - this.feedTitle = title; - } - - /** - * This constructor is used for requesting a feed download (it must not be used for anything else!). It should be - * used if the title of the feed is already known. - */ - public Feed(String url, String lastUpdate, String title, String username, String password) { - this(url, lastUpdate, title); - preferences = new FeedPreferences(0, true, FeedPreferences.AutoDeleteAction.GLOBAL, VolumeAdaptionSetting.OFF, username, password); - } - - /** - * Returns the item at the specified index. - * - */ - public FeedItem getItemAtIndex(int position) { - return items.get(position); - } - - /** - * Returns the value that uniquely identifies this Feed. If the - * feedIdentifier attribute is not null, it will be returned. Else it will - * try to return the title. If the title is not given, it will use the link - * of the feed. - */ - public String getIdentifyingValue() { - if (feedIdentifier != null && !feedIdentifier.isEmpty()) { - return feedIdentifier; - } else if (download_url != null && !download_url.isEmpty()) { - return download_url; - } else if (feedTitle != null && !feedTitle.isEmpty()) { - return feedTitle; - } else { - return link; - } - } - - @Override - public String getHumanReadableIdentifier() { - if (!TextUtils.isEmpty(customTitle)) { - return customTitle; - } else if (!TextUtils.isEmpty(feedTitle)) { - return feedTitle; - } else { - return download_url; - } - } - - public void updateFromOther(Feed other) { - // don't update feed's download_url, we do that manually if redirected - // see AntennapodHttpClient - if (other.imageUrl != null) { - this.imageUrl = other.imageUrl; - } - if (other.feedTitle != null) { - feedTitle = other.feedTitle; - } - if (other.feedIdentifier != null) { - feedIdentifier = other.feedIdentifier; - } - if (other.link != null) { - link = other.link; - } - if (other.description != null) { - description = other.description; - } - if (other.language != null) { - language = other.language; - } - if (other.author != null) { - author = other.author; - } - if (other.fundingList != null) { - fundingList = other.fundingList; - } - // this feed's nextPage might already point to a higher page, so we only update the nextPage value - // if this feed is not paged and the other feed is. - if (!this.paged && other.paged) { - this.paged = other.paged; - this.nextPageLink = other.nextPageLink; - } - } - - public boolean compareWithOther(Feed other) { - if (super.compareWithOther(other)) { - return true; - } - if (other.imageUrl != null) { - if (imageUrl == null || !TextUtils.equals(imageUrl, other.imageUrl)) { - return true; - } - } - if (!TextUtils.equals(feedTitle, other.feedTitle)) { - return true; - } - if (other.feedIdentifier != null) { - if (feedIdentifier == null || !feedIdentifier.equals(other.feedIdentifier)) { - return true; - } - } - if (other.link != null) { - if (link == null || !link.equals(other.link)) { - return true; - } - } - if (other.description != null) { - if (description == null || !description.equals(other.description)) { - return true; - } - } - if (other.language != null) { - if (language == null || !language.equals(other.language)) { - return true; - } - } - if (other.author != null) { - if (author == null || !author.equals(other.author)) { - return true; - } - } - if (other.fundingList != null) { - if (fundingList == null || !fundingList.equals(other.fundingList)) { - return true; - } - } - if (other.isPaged() && !this.isPaged()) { - return true; - } - if (!TextUtils.equals(other.getNextPageLink(), this.getNextPageLink())) { - return true; - } - return false; - } - - public FeedItem getMostRecentItem() { - // we could sort, but we don't need to, a simple search is fine... - Date mostRecentDate = new Date(0); - FeedItem mostRecentItem = null; - for (FeedItem item : items) { - if (item.getPubDate() != null && item.getPubDate().after(mostRecentDate)) { - mostRecentDate = item.getPubDate(); - mostRecentItem = item; - } - } - return mostRecentItem; - } - - @Override - public int getTypeAsInt() { - return FEEDFILETYPE_FEED; - } - - public String getTitle() { - return !TextUtils.isEmpty(customTitle) ? customTitle : feedTitle; - } - - public void setTitle(String title) { - this.feedTitle = title; - } - - public String getFeedTitle() { - return this.feedTitle; - } - - @Nullable - public String getCustomTitle() { - return this.customTitle; - } - - public void setCustomTitle(String customTitle) { - if (customTitle == null || customTitle.equals(feedTitle)) { - this.customTitle = null; - } else { - this.customTitle = customTitle; - } - } - - public String getLink() { - return link; - } - - public void setLink(String link) { - this.link = link; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - public List<FeedItem> getItems() { - return items; - } - - public void setItems(List<FeedItem> list) { - this.items = list; - } - - public String getLastUpdate() { - return lastUpdate; - } - - public void setLastUpdate(String lastModified) { - this.lastUpdate = lastModified; - } - - public String getFeedIdentifier() { - return feedIdentifier; - } - - public void setFeedIdentifier(String feedIdentifier) { - this.feedIdentifier = feedIdentifier; - } - - public void addPayment(FeedFunding funding) { - if (fundingList == null) { - fundingList = new ArrayList<FeedFunding>(); - } - fundingList.add(funding); - } - - public ArrayList<FeedFunding> getPaymentLinks() { - return fundingList; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public void setPreferences(FeedPreferences preferences) { - this.preferences = preferences; - } - - public FeedPreferences getPreferences() { - return preferences; - } - - @Override - public void setId(long id) { - super.setId(id); - if (preferences != null) { - preferences.setFeedID(id); - } - } - - public int getPageNr() { - return pageNr; - } - - public void setPageNr(int pageNr) { - this.pageNr = pageNr; - } - - public boolean isPaged() { - return paged; - } - - public void setPaged(boolean paged) { - this.paged = paged; - } - - public String getNextPageLink() { - return nextPageLink; - } - - public void setNextPageLink(String nextPageLink) { - this.nextPageLink = nextPageLink; - } - - @Nullable - public FeedItemFilter getItemFilter() { - return itemfilter; - } - - public void setItemFilter(String[] properties) { - if (properties != null) { - this.itemfilter = new FeedItemFilter(properties); - } - } - - @Nullable - public SortOrder getSortOrder() { - return sortOrder; - } - - public void setSortOrder(@Nullable SortOrder sortOrder) { - if (sortOrder != null && sortOrder.scope != SortOrder.Scope.INTRA_FEED) { - throw new IllegalArgumentException("The specified sortOrder " + sortOrder - + " is invalid. Only those with INTRA_FEED scope are allowed."); - } - this.sortOrder = sortOrder; - } - - public boolean hasLastUpdateFailed() { - return this.lastUpdateFailed; - } - - public void setLastUpdateFailed(boolean lastUpdateFailed) { - this.lastUpdateFailed = lastUpdateFailed; - } - - public boolean isLocalFeed() { - return download_url.startsWith(PREFIX_LOCAL_FOLDER); - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java deleted file mode 100644 index 3edecd35c..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java +++ /dev/null @@ -1,65 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -/** - * Represents every possible component of a feed - * - * @author daniel - */ -public abstract class FeedComponent { - - long id; - - FeedComponent() { - super(); - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - /** - * Update this FeedComponent's attributes with the attributes from another - * FeedComponent. This method should only update attributes which where read from - * the feed. - */ - void updateFromOther(FeedComponent other) { - } - - /** - * Compare's this FeedComponent's attribute values with another FeedComponent's - * attribute values. This method will only compare attributes which were - * read from the feed. - * - * @return true if attribute values are different, false otherwise - */ - boolean compareWithOther(FeedComponent other) { - return false; - } - - - /** - * Should return a non-null, human-readable String so that the item can be - * identified by the user. Can be title, download-url, etc. - */ - public abstract String getHumanReadableIdentifier(); - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof FeedComponent)) return false; - - FeedComponent that = (FeedComponent) o; - - return id == that.id; - - } - - @Override - public int hashCode() { - return (int) (id ^ (id >>> 32)); - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java deleted file mode 100644 index cc4dd230f..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java +++ /dev/null @@ -1,107 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import android.text.TextUtils; - -import java.io.File; - -/** - * Represents a component of a Feed that has to be downloaded - */ -public abstract class FeedFile extends FeedComponent { - - String file_url; - protected String download_url; - boolean downloaded; - - /** - * Creates a new FeedFile object. - * - * @param file_url The location of the FeedFile. If this is null, the downloaded-attribute - * will automatically be set to false. - * @param download_url The location where the FeedFile can be downloaded. - * @param downloaded true if the FeedFile has been downloaded, false otherwise. This parameter - * will automatically be interpreted as false if the file_url is null. - */ - public FeedFile(String file_url, String download_url, boolean downloaded) { - super(); - this.file_url = file_url; - this.download_url = download_url; - this.downloaded = (file_url != null) && downloaded; - } - - public FeedFile() { - this(null, null, false); - } - - public abstract int getTypeAsInt(); - - /** - * Update this FeedFile's attributes with the attributes from another - * FeedFile. This method should only update attributes which where read from - * the feed. - */ - void updateFromOther(FeedFile other) { - super.updateFromOther(other); - this.download_url = other.download_url; - } - - /** - * Compare's this FeedFile's attribute values with another FeedFile's - * attribute values. This method will only compare attributes which were - * read from the feed. - * - * @return true if attribute values are different, false otherwise - */ - boolean compareWithOther(FeedFile other) { - if (super.compareWithOther(other)) { - return true; - } - if (!TextUtils.equals(download_url, other.download_url)) { - return true; - } - return false; - } - - /** - * Returns true if the file exists at file_url. - */ - public boolean fileExists() { - if (file_url == null) { - return false; - } else { - File f = new File(file_url); - return f.exists(); - } - } - - public String getFile_url() { - return file_url; - } - - /** - * Changes the file_url of this FeedFile. Setting this value to - * null will also set the downloaded-attribute to false. - */ - public void setFile_url(String file_url) { - this.file_url = file_url; - if (file_url == null) { - downloaded = false; - } - } - - public String getDownload_url() { - return download_url; - } - - public void setDownload_url(String download_url) { - this.download_url = download_url; - } - - public boolean isDownloaded() { - return downloaded; - } - - public void setDownloaded(boolean downloaded) { - this.downloaded = downloaded; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java deleted file mode 100644 index 020ffb270..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java +++ /dev/null @@ -1,112 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class FeedFilter implements Serializable { - - private static final String TAG = "FeedFilter"; - - private final String includeFilter; - private final String excludeFilter; - - public FeedFilter() { - this("", ""); - } - - public FeedFilter(String includeFilter, String excludeFilter) { - // We're storing the strings and not the parsed terms because - // 1. It's easier to show the user exactly what they typed in this way - // (we don't have to recreate it) - // 2. We don't know if we'll actually be asked to parse anything anyways. - this.includeFilter = includeFilter; - this.excludeFilter = excludeFilter; - } - - /** - * Parses the text in to a list of single words or quoted strings. - * Example: "One "Two Three"" returns ["One", "Two Three"] - * @param filter string to parse in to terms - * @return list of terms - */ - private List<String> parseTerms(String filter) { - // from http://stackoverflow.com/questions/7804335/split-string-on-spaces-in-java-except-if-between-quotes-i-e-treat-hello-wor - List<String> list = new ArrayList<>(); - Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(filter); - while (m.find()) - list.add(m.group(1).replace("\"", "")); - return list; - } - - /** - * @param item - * @return true if the item should be downloaded - */ - public boolean shouldAutoDownload(FeedItem item) { - - List<String> includeTerms = parseTerms(includeFilter); - List<String> excludeTerms = parseTerms(excludeFilter); - - if (includeTerms.size() == 0 && excludeTerms.size() == 0) { - // nothing has been specified, so include everything - return true; - } - - // check using lowercase so the users don't have to worry about case. - String title = item.getTitle().toLowerCase(); - - // if it's explicitly excluded, it shouldn't be autodownloaded - // even if it has include terms - for (String term : excludeTerms) { - if (title.contains(term.trim().toLowerCase())) { - return false; - } - } - - for (String term : includeTerms) { - if (title.contains(term.trim().toLowerCase())) { - return true; - } - } - - // now's the tricky bit - // if they haven't set an include filter, but they have set an exclude filter - // default to including, but if they've set both, then exclude - if (!hasIncludeFilter() && hasExcludeFilter()) { - return true; - } - - return false; - } - - public String getIncludeFilter() { - return includeFilter; - } - - public String getExcludeFilter() { return excludeFilter; } - - /** - * @return true if only include is set - */ - public boolean includeOnly() { - return hasIncludeFilter() && !hasExcludeFilter(); - } - - /** - * @return true if only exclude is set - */ - public boolean excludeOnly() { - return hasExcludeFilter() && !hasIncludeFilter(); - } - - public boolean hasIncludeFilter() { - return includeFilter.length() > 0; - } - - public boolean hasExcludeFilter() { - return excludeFilter.length() > 0; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFunding.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFunding.java deleted file mode 100644 index 151e68a4f..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFunding.java +++ /dev/null @@ -1,91 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; - -public class FeedFunding { - public static final String FUNDING_ENTRIES_SEPARATOR = "\u001e"; - public static final String FUNDING_TITLE_SEPARATOR = "\u001f"; - - public String url; - public String content; - - public FeedFunding(String url, String content) { - this.url = url; - this.content = content; - } - - public void setContent(String content) { - this.content = content; - } - - public void setUrl(String url) { - this.url = url; - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !obj.getClass().equals(this.getClass())) { - return false; - } - - FeedFunding funding = (FeedFunding) obj; - if (url == null && funding.url == null && content == null && funding.content == null) { - return true; - } - if (url != null && url.equals(funding.url) && content != null && content.equals(funding.content)) { - return true; - } - return false; - } - - @Override - public int hashCode() { - return (url + FUNDING_TITLE_SEPARATOR + content).hashCode(); - } - - public static ArrayList<FeedFunding> extractPaymentLinks(String payLinks) { - if (StringUtils.isBlank(payLinks)) { - return null; - } - // old format before we started with PodcastIndex funding tag - ArrayList<FeedFunding> funding = new ArrayList<FeedFunding>(); - if (!payLinks.contains(FeedFunding.FUNDING_ENTRIES_SEPARATOR) - && !payLinks.contains(FeedFunding.FUNDING_TITLE_SEPARATOR)) { - funding.add(new FeedFunding(payLinks, "")); - return funding; - } - String [] list = payLinks.split(FeedFunding.FUNDING_ENTRIES_SEPARATOR); - if (list.length == 0) { - return null; - } - - for (String str : list) { - String [] linkContent = str.split(FeedFunding.FUNDING_TITLE_SEPARATOR); - if (StringUtils.isBlank(linkContent[0])) { - continue; - } - String url = linkContent[0]; - String title = ""; - if (linkContent.length > 1 && ! StringUtils.isBlank(linkContent[1])) { - title = linkContent[1]; - } - funding.add(new FeedFunding(url, title)); - } - return funding; - } - - public static String getPaymentLinksAsString(ArrayList<FeedFunding> fundingList) { - StringBuilder result = new StringBuilder(); - if (fundingList == null) { - return null; - } - for (FeedFunding fund : fundingList) { - result.append(fund.url).append(FeedFunding.FUNDING_TITLE_SEPARATOR).append(fund.content); - result.append(FeedFunding.FUNDING_ENTRIES_SEPARATOR); - } - return StringUtils.removeEnd(result.toString(), FeedFunding.FUNDING_ENTRIES_SEPARATOR); - } - -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java deleted file mode 100644 index aa20bd5c9..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java +++ /dev/null @@ -1,421 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -/** - * Item (episode) within a feed. - * - * @author daniel - */ -public class FeedItem extends FeedComponent implements Serializable { - - /** tag that indicates this item is in the queue */ - public static final String TAG_QUEUE = "Queue"; - /** tag that indicates this item is in favorites */ - public static final String TAG_FAVORITE = "Favorite"; - - /** - * The id/guid that can be found in the rss/atom feed. Might not be set. - */ - private String itemIdentifier; - private String title; - /** - * The description of a feeditem. - */ - private String description; - - private String link; - private Date pubDate; - private FeedMedia media; - - private transient Feed feed; - private long feedId; - - private int state; - public static final int NEW = -1; - public static final int UNPLAYED = 0; - public static final int PLAYED = 1; - - private String paymentLink; - - /** - * Is true if the database contains any chapters that belong to this item. This attribute is only - * written once by DBReader on initialization. - * The FeedItem might still have a non-null chapters value. In this case, the list of chapters - * has not been saved in the database yet. - * */ - private final boolean hasChapters; - - /** - * The list of chapters of this item. This might be null even if there are chapters of this item - * in the database. The 'hasChapters' attribute should be used to check if this item has any chapters. - * */ - private transient List<Chapter> chapters; - private String imageUrl; - - /* - * 0: auto download disabled - * 1: auto download enabled (default) - * > 1: auto download enabled, (approx.) timestamp of the last failed attempt - * where last digit denotes the number of failed attempts - */ - private long autoDownload = 1; - - /** - * Any tags assigned to this item - */ - private final Set<String> tags = new HashSet<>(); - - public FeedItem() { - this.state = UNPLAYED; - this.hasChapters = false; - } - - /** - * This constructor is used by DBReader. - * */ - public FeedItem(long id, String title, String link, Date pubDate, String paymentLink, long feedId, - boolean hasChapters, String imageUrl, int state, - String itemIdentifier, long autoDownload) { - this.id = id; - this.title = title; - this.link = link; - this.pubDate = pubDate; - this.paymentLink = paymentLink; - this.feedId = feedId; - this.hasChapters = hasChapters; - this.imageUrl = imageUrl; - this.state = state; - this.itemIdentifier = itemIdentifier; - this.autoDownload = autoDownload; - } - - /** - * This constructor should be used for creating test objects. - */ - public FeedItem(long id, String title, String itemIdentifier, String link, Date pubDate, int state, Feed feed) { - this.id = id; - this.title = title; - this.itemIdentifier = itemIdentifier; - this.link = link; - this.pubDate = (pubDate != null) ? (Date) pubDate.clone() : null; - this.state = state; - this.feed = feed; - this.hasChapters = false; - } - - /** - * This constructor should be used for creating test objects involving chapter marks. - */ - public FeedItem(long id, String title, String itemIdentifier, String link, Date pubDate, int state, Feed feed, boolean hasChapters) { - this.id = id; - this.title = title; - this.itemIdentifier = itemIdentifier; - this.link = link; - this.pubDate = (pubDate != null) ? (Date) pubDate.clone() : null; - this.state = state; - this.feed = feed; - this.hasChapters = hasChapters; - } - - public void updateFromOther(FeedItem other) { - super.updateFromOther(other); - if (other.imageUrl != null) { - this.imageUrl = other.imageUrl; - } - if (other.title != null) { - title = other.title; - } - if (other.getDescription() != null) { - description = other.getDescription(); - } - if (other.link != null) { - link = other.link; - } - if (other.pubDate != null && !other.pubDate.equals(pubDate)) { - pubDate = other.pubDate; - } - if (other.media != null) { - if (media == null) { - setMedia(other.media); - // reset to new if feed item did link to a file before - setNew(); - } else if (media.compareWithOther(other.media)) { - media.updateFromOther(other.media); - } - } - if (other.paymentLink != null) { - paymentLink = other.paymentLink; - } - if (other.chapters != null) { - if (!hasChapters) { - chapters = other.chapters; - } - } - } - - /** - * Returns the value that uniquely identifies this FeedItem. If the - * itemIdentifier attribute is not null, it will be returned. Else it will - * try to return the title. If the title is not given, it will use the link - * of the entry. - */ - public String getIdentifyingValue() { - if (itemIdentifier != null && !itemIdentifier.isEmpty()) { - return itemIdentifier; - } else if (title != null && !title.isEmpty()) { - return title; - } else if (hasMedia() && media.getDownload_url() != null) { - return media.getDownload_url(); - } else { - return link; - } - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public String getLink() { - return link; - } - - public void setLink(String link) { - this.link = link; - } - - public Date getPubDate() { - if (pubDate != null) { - return (Date) pubDate.clone(); - } else { - return null; - } - } - - public void setPubDate(Date pubDate) { - if (pubDate != null) { - this.pubDate = (Date) pubDate.clone(); - } else { - this.pubDate = null; - } - } - - @Nullable - public FeedMedia getMedia() { - return media; - } - - /** - * Sets the media object of this FeedItem. If the given - * FeedMedia object is not null, it's 'item'-attribute value - * will also be set to this item. - */ - public void setMedia(FeedMedia media) { - this.media = media; - if (media != null && media.getItem() != this) { - media.setItem(this); - } - } - - public Feed getFeed() { - return feed; - } - - public void setFeed(Feed feed) { - this.feed = feed; - } - - public boolean isNew() { - return state == NEW; - } - - - public void setNew() { - state = NEW; - } - - public boolean isPlayed() { - return state == PLAYED; - } - - public void setPlayed(boolean played) { - if (played) { - state = PLAYED; - } else { - state = UNPLAYED; - } - } - - public boolean isInProgress() { - return (media != null && media.isInProgress()); - } - - /** - * Updates this item's description property if the given argument is longer than the already stored description - * @param newDescription The new item description, content:encoded, itunes:description, etc. - */ - public void setDescriptionIfLonger(String newDescription) { - if (newDescription == null) { - return; - } - if (this.description == null) { - this.description = newDescription; - } else if (this.description.length() < newDescription.length()) { - this.description = newDescription; - } - } - - public String getPaymentLink() { - return paymentLink; - } - - public void setPaymentLink(String paymentLink) { - this.paymentLink = paymentLink; - } - - public List<Chapter> getChapters() { - return chapters; - } - - public void setChapters(List<Chapter> chapters) { - this.chapters = chapters; - } - - public String getItemIdentifier() { - return itemIdentifier; - } - - public void setItemIdentifier(String itemIdentifier) { - this.itemIdentifier = itemIdentifier; - } - - public boolean hasMedia() { - return media != null; - } - - public String getImageLocation() { - if (imageUrl != null) { - return imageUrl; - } else if (media != null && media.hasEmbeddedPicture()) { - return FeedMedia.FILENAME_PREFIX_EMBEDDED_COVER + media.getLocalMediaUrl(); - } else if (feed != null) { - return feed.getImageUrl(); - } else { - return null; - } - } - - public enum State { - UNREAD, IN_PROGRESS, READ, PLAYING - } - - public long getFeedId() { - return feedId; - } - - public void setFeedId(long feedId) { - this.feedId = feedId; - } - - /** - * Returns the image of this item, as specified in the feed. - * To load the image that can be displayed to the user, use {@link #getImageLocation}, - * which also considers embedded pictures or the feed picture if no other picture is present. - */ - public String getImageUrl() { - return imageUrl; - } - - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - @Override - public String getHumanReadableIdentifier() { - return title; - } - - public boolean hasChapters() { - return hasChapters; - } - - public void setAutoDownload(boolean autoDownload) { - this.autoDownload = autoDownload ? 1 : 0; - } - - public boolean getAutoDownload() { - return this.autoDownload > 0; - } - - public int getFailedAutoDownloadAttempts() { - if (autoDownload <= 1) { - return 0; - } - int failedAttempts = (int)(autoDownload % 10); - if (failedAttempts == 0) { - failedAttempts = 10; - } - return failedAttempts; - } - - public boolean isAutoDownloadable() { - if (media == null || media.isDownloaded() || autoDownload == 0) { - return false; - } - if (autoDownload == 1) { - return true; - } - int failedAttempts = getFailedAutoDownloadAttempts(); - double magicValue = 1.767; // 1.767^(10[=#maxNumAttempts]-1) = 168 hours / 7 days - int millisecondsInHour = 3600000; - long waitingTime = (long) (Math.pow(magicValue, failedAttempts - 1) * millisecondsInHour); - long grace = TimeUnit.MINUTES.toMillis(5); - return System.currentTimeMillis() > (autoDownload + waitingTime - grace); - } - - /** - * @return true if the item has this tag - */ - public boolean isTagged(String tag) { - return tags.contains(tag); - } - - /** - * @param tag adds this tag to the item. NOTE: does NOT persist to the database - */ - public void addTag(String tag) { - tags.add(tag); - } - - /** - * @param tag the to remove - */ - public void removeTag(String tag) { - tags.remove(tag); - } - - @NonNull - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java deleted file mode 100644 index ac742e765..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItemFilter.java +++ /dev/null @@ -1,60 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import android.text.TextUtils; -import java.util.Arrays; - -public class FeedItemFilter { - - private final String[] properties; - - public final boolean showPlayed; - public final boolean showUnplayed; - public final boolean showPaused; - public final boolean showNotPaused; - public final boolean showQueued; - public final boolean showNotQueued; - public final boolean showDownloaded; - public final boolean showNotDownloaded; - public final boolean showHasMedia; - public final boolean showNoMedia; - public final boolean showIsFavorite; - public final boolean showNotFavorite; - - public static FeedItemFilter unfiltered() { - return new FeedItemFilter(""); - } - - public FeedItemFilter(String properties) { - this(TextUtils.split(properties, ",")); - } - - public FeedItemFilter(String[] properties) { - this.properties = properties; - - // see R.arrays.feed_filter_values - showUnplayed = hasProperty("unplayed"); - showPaused = hasProperty("paused"); - showNotPaused = hasProperty("not_paused"); - showPlayed = hasProperty("played"); - showQueued = hasProperty("queued"); - showNotQueued = hasProperty("not_queued"); - showDownloaded = hasProperty("downloaded"); - showNotDownloaded = hasProperty("not_downloaded"); - showHasMedia = hasProperty("has_media"); - showNoMedia = hasProperty("no_media"); - showIsFavorite = hasProperty("is_favorite"); - showNotFavorite = hasProperty("not_favorite"); - } - - private boolean hasProperty(String property) { - return Arrays.asList(properties).contains(property); - } - - public String[] getValues() { - return properties.clone(); - } - - public boolean isShowDownloaded() { - return showDownloaded; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java deleted file mode 100644 index 3483522ed..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java +++ /dev/null @@ -1,483 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import android.content.Context; -import android.content.SharedPreferences.Editor; -import android.media.MediaMetadataRetriever; -import android.net.Uri; -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.Nullable; -import android.support.v4.media.MediaBrowserCompat; -import android.support.v4.media.MediaDescriptionCompat; - -import java.util.Date; -import java.util.List; - -import de.danoeh.antennapod.core.util.playback.Playable; - -public class FeedMedia extends FeedFile implements Playable { - public static final int FEEDFILETYPE_FEEDMEDIA = 2; - public static final int PLAYABLE_TYPE_FEEDMEDIA = 1; - public static final String FILENAME_PREFIX_EMBEDDED_COVER = "metadata-retriever:"; - - public static final String PREF_MEDIA_ID = "FeedMedia.PrefMediaId"; - private static final String PREF_FEED_ID = "FeedMedia.PrefFeedId"; - - /** - * Indicates we've checked on the size of the item via the network - * and got an invalid response. Using Integer.MIN_VALUE because - * 1) we'll still check on it in case it gets downloaded (it's <= 0) - * 2) By default all FeedMedia have a size of 0 if we don't know it, - * so this won't conflict with existing practice. - */ - private static final int CHECKED_ON_SIZE_BUT_UNKNOWN = Integer.MIN_VALUE; - - private int duration; - private int position; // Current position in file - private long lastPlayedTime; // Last time this media was played (in ms) - private int played_duration; // How many ms of this file have been played - private long size; // File size in Byte - private String mime_type; - @Nullable private volatile FeedItem item; - private Date playbackCompletionDate; - private int startPosition = -1; - private int playedDurationWhenStarted; - - // if null: unknown, will be checked - private Boolean hasEmbeddedPicture; - - /* Used for loading item when restoring from parcel. */ - private long itemID; - - public FeedMedia(FeedItem i, String download_url, long size, - String mime_type) { - super(null, download_url, false); - this.item = i; - this.size = size; - this.mime_type = mime_type; - } - - public FeedMedia(long id, FeedItem item, int duration, int position, - long size, String mime_type, String file_url, String download_url, - boolean downloaded, Date playbackCompletionDate, int played_duration, - long lastPlayedTime) { - super(file_url, download_url, downloaded); - this.id = id; - this.item = item; - this.duration = duration; - this.position = position; - this.played_duration = played_duration; - this.playedDurationWhenStarted = played_duration; - this.size = size; - this.mime_type = mime_type; - this.playbackCompletionDate = playbackCompletionDate == null - ? null : (Date) playbackCompletionDate.clone(); - this.lastPlayedTime = lastPlayedTime; - } - - public FeedMedia(long id, FeedItem item, int duration, int position, - long size, String mime_type, String file_url, String download_url, - boolean downloaded, Date playbackCompletionDate, int played_duration, - Boolean hasEmbeddedPicture, long lastPlayedTime) { - this(id, item, duration, position, size, mime_type, file_url, download_url, downloaded, - playbackCompletionDate, played_duration, lastPlayedTime); - this.hasEmbeddedPicture = hasEmbeddedPicture; - } - - @Override - public String getHumanReadableIdentifier() { - if (item != null && item.getTitle() != null) { - return item.getTitle(); - } else { - return download_url; - } - } - - /** - * Returns a MediaItem representing the FeedMedia object. - * This is used by the MediaBrowserService - */ - public MediaBrowserCompat.MediaItem getMediaItem() { - Playable p = this; - MediaDescriptionCompat.Builder builder = new MediaDescriptionCompat.Builder() - .setMediaId(String.valueOf(id)) - .setTitle(p.getEpisodeTitle()) - .setDescription(p.getFeedTitle()) - .setSubtitle(p.getFeedTitle()); - if (item != null) { - // getImageLocation() also loads embedded images, which we can not send to external devices - if (item.getImageUrl() != null) { - builder.setIconUri(Uri.parse(item.getImageUrl())); - } else if (item.getFeed() != null && item.getFeed().getImageUrl() != null) { - builder.setIconUri(Uri.parse(item.getFeed().getImageUrl())); - } - } - return new MediaBrowserCompat.MediaItem(builder.build(), MediaBrowserCompat.MediaItem.FLAG_PLAYABLE); - } - - /** - * Uses mimetype to determine the type of media. - */ - public MediaType getMediaType() { - return MediaType.fromMimeType(mime_type); - } - - public void updateFromOther(FeedMedia other) { - super.updateFromOther(other); - if (other.size > 0) { - size = other.size; - } - if (other.mime_type != null) { - mime_type = other.mime_type; - } - } - - public boolean compareWithOther(FeedMedia other) { - if (super.compareWithOther(other)) { - return true; - } - if (other.mime_type != null) { - if (mime_type == null || !mime_type.equals(other.mime_type)) { - return true; - } - } - if (other.size > 0 && other.size != size) { - return true; - } - return false; - } - - @Override - public int getTypeAsInt() { - return FEEDFILETYPE_FEEDMEDIA; - } - - public int getDuration() { - return duration; - } - - public void setDuration(int duration) { - this.duration = duration; - } - - @Override - public void setLastPlayedTime(long lastPlayedTime) { - this.lastPlayedTime = lastPlayedTime; - } - - public int getPlayedDuration() { - return played_duration; - } - - public int getPlayedDurationWhenStarted() { - return playedDurationWhenStarted; - } - - public void setPlayedDuration(int played_duration) { - this.played_duration = played_duration; - } - - public int getPosition() { - return position; - } - - @Override - public long getLastPlayedTime() { - return lastPlayedTime; - } - - public void setPosition(int position) { - this.position = position; - if(position > 0 && item != null && item.isNew()) { - this.item.setPlayed(false); - } - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - @Override - public String getDescription() { - if (item != null) { - return item.getDescription(); - } - return null; - } - - /** - * Indicates we asked the service what the size was, but didn't - * get a valid answer and we shoudln't check using the network again. - */ - public void setCheckedOnSizeButUnknown() { - this.size = CHECKED_ON_SIZE_BUT_UNKNOWN; - } - - public boolean checkedOnSizeButUnknown() { - return (CHECKED_ON_SIZE_BUT_UNKNOWN == this.size); - } - - public String getMime_type() { - return mime_type; - } - - public void setMime_type(String mime_type) { - this.mime_type = mime_type; - } - - @Nullable - public FeedItem getItem() { - return item; - } - - /** - * Sets the item object of this FeedMedia. If the given - * FeedItem object is not null, it's 'media'-attribute value - * will also be set to this media object. - */ - public void setItem(FeedItem item) { - this.item = item; - if (item != null && item.getMedia() != this) { - item.setMedia(this); - } - } - - public Date getPlaybackCompletionDate() { - return playbackCompletionDate == null - ? null : (Date) playbackCompletionDate.clone(); - } - - public void setPlaybackCompletionDate(Date playbackCompletionDate) { - this.playbackCompletionDate = playbackCompletionDate == null - ? null : (Date) playbackCompletionDate.clone(); - } - - public boolean isInProgress() { - return (this.position > 0); - } - - @Override - public int describeContents() { - return 0; - } - - public boolean hasEmbeddedPicture() { - if(hasEmbeddedPicture == null) { - checkEmbeddedPicture(); - } - return hasEmbeddedPicture; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeLong(id); - dest.writeLong(item != null ? item.getId() : 0L); - - dest.writeInt(duration); - dest.writeInt(position); - dest.writeLong(size); - dest.writeString(mime_type); - dest.writeString(file_url); - dest.writeString(download_url); - dest.writeByte((byte) ((downloaded) ? 1 : 0)); - dest.writeLong((playbackCompletionDate != null) ? playbackCompletionDate.getTime() : 0); - dest.writeInt(played_duration); - dest.writeLong(lastPlayedTime); - } - - @Override - public void writeToPreferences(Editor prefEditor) { - if(item != null && item.getFeed() != null) { - prefEditor.putLong(PREF_FEED_ID, item.getFeed().getId()); - } else { - prefEditor.putLong(PREF_FEED_ID, 0L); - } - prefEditor.putLong(PREF_MEDIA_ID, id); - } - - @Override - public String getEpisodeTitle() { - if (item == null) { - return null; - } - if (item.getTitle() != null) { - return item.getTitle(); - } else { - return item.getIdentifyingValue(); - } - } - - @Override - public List<Chapter> getChapters() { - if (item == null) { - return null; - } - return item.getChapters(); - } - - @Override - public String getWebsiteLink() { - if (item == null) { - return null; - } - return item.getLink(); - } - - @Override - public String getFeedTitle() { - if (item == null || item.getFeed() == null) { - return null; - } - return item.getFeed().getTitle(); - } - - @Override - public Object getIdentifier() { - return id; - } - - @Override - public String getLocalMediaUrl() { - return file_url; - } - - @Override - public String getStreamUrl() { - return download_url; - } - - public int getStartPosition() { - return startPosition; - } - - @Override - public Date getPubDate() { - if (item == null) { - return null; - } - if (item.getPubDate() != null) { - return item.getPubDate(); - } else { - return null; - } - } - - @Override - public boolean localFileAvailable() { - return isDownloaded() && file_url != null; - } - - public long getItemId() { - return itemID; - } - - @Override - public void onPlaybackStart() { - startPosition = Math.max(position, 0); - playedDurationWhenStarted = played_duration; - } - - @Override - public void onPlaybackPause(Context context) { - if (position > startPosition) { - played_duration = playedDurationWhenStarted + position - startPosition; - playedDurationWhenStarted = played_duration; - } - startPosition = position; - } - - @Override - public void onPlaybackCompleted(Context context) { - startPosition = -1; - } - - @Override - public int getPlayableType() { - return PLAYABLE_TYPE_FEEDMEDIA; - } - - @Override - public void setChapters(List<Chapter> chapters) { - if (item != null) { - item.setChapters(chapters); - } - } - - public static final Parcelable.Creator<FeedMedia> CREATOR = new Parcelable.Creator<FeedMedia>() { - public FeedMedia createFromParcel(Parcel in) { - final long id = in.readLong(); - final long itemID = in.readLong(); - FeedMedia result = new FeedMedia(id, null, in.readInt(), in.readInt(), in.readLong(), in.readString(), in.readString(), - in.readString(), in.readByte() != 0, new Date(in.readLong()), in.readInt(), in.readLong()); - result.itemID = itemID; - return result; - } - - public FeedMedia[] newArray(int size) { - return new FeedMedia[size]; - } - }; - - @Override - public String getImageLocation() { - if (item != null) { - return item.getImageLocation(); - } else if (hasEmbeddedPicture()) { - return FILENAME_PREFIX_EMBEDDED_COVER + getLocalMediaUrl(); - } else { - return null; - } - } - - public void setHasEmbeddedPicture(Boolean hasEmbeddedPicture) { - this.hasEmbeddedPicture = hasEmbeddedPicture; - } - - @Override - public void setDownloaded(boolean downloaded) { - super.setDownloaded(downloaded); - if(item != null && downloaded && item.isNew()) { - item.setPlayed(false); - } - } - - @Override - public void setFile_url(String file_url) { - super.setFile_url(file_url); - } - - public void checkEmbeddedPicture() { - if (!localFileAvailable()) { - hasEmbeddedPicture = Boolean.FALSE; - return; - } - MediaMetadataRetriever mmr = new MediaMetadataRetriever(); - try { - mmr.setDataSource(getLocalMediaUrl()); - byte[] image = mmr.getEmbeddedPicture(); - if(image != null) { - hasEmbeddedPicture = Boolean.TRUE; - } else { - hasEmbeddedPicture = Boolean.FALSE; - } - } catch (Exception e) { - e.printStackTrace(); - hasEmbeddedPicture = Boolean.FALSE; - } - } - - @Override - public boolean equals(Object o) { - if (o == null) { - return false; - } - if (FeedMediaFlavorHelper.instanceOfRemoteMedia(o)) { - return o.equals(this); - } - return super.equals(o); - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java deleted file mode 100644 index 8288280bd..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java +++ /dev/null @@ -1,214 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import androidx.annotation.NonNull; -import android.text.TextUtils; - -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; - -/** - * Contains preferences for a single feed. - */ -public class FeedPreferences implements Serializable { - - public static final float SPEED_USE_GLOBAL = -1; - public static final String TAG_ROOT = "#root"; - public static final String TAG_SEPARATOR = "\u001e"; - - public enum AutoDeleteAction { - GLOBAL, - YES, - NO - } - - @NonNull - private FeedFilter filter; - private long feedID; - private boolean autoDownload; - private boolean keepUpdated; - private AutoDeleteAction autoDeleteAction; - private VolumeAdaptionSetting volumeAdaptionSetting; - private String username; - private String password; - private float feedPlaybackSpeed; - private int feedSkipIntro; - private int feedSkipEnding; - private boolean showEpisodeNotification; - private final Set<String> tags = new HashSet<>(); - - public FeedPreferences(long feedID, boolean autoDownload, AutoDeleteAction autoDeleteAction, - VolumeAdaptionSetting volumeAdaptionSetting, String username, String password) { - this(feedID, autoDownload, true, autoDeleteAction, volumeAdaptionSetting, - username, password, new FeedFilter(), SPEED_USE_GLOBAL, 0, 0, false, new HashSet<>()); - } - - public FeedPreferences(long feedID, boolean autoDownload, boolean keepUpdated, - AutoDeleteAction autoDeleteAction, VolumeAdaptionSetting volumeAdaptionSetting, - String username, String password, @NonNull FeedFilter filter, float feedPlaybackSpeed, - int feedSkipIntro, int feedSkipEnding, boolean showEpisodeNotification, - Set<String> tags) { - this.feedID = feedID; - this.autoDownload = autoDownload; - this.keepUpdated = keepUpdated; - this.autoDeleteAction = autoDeleteAction; - this.volumeAdaptionSetting = volumeAdaptionSetting; - this.username = username; - this.password = password; - this.filter = filter; - this.feedPlaybackSpeed = feedPlaybackSpeed; - this.feedSkipIntro = feedSkipIntro; - this.feedSkipEnding = feedSkipEnding; - this.showEpisodeNotification = showEpisodeNotification; - this.tags.addAll(tags); - } - - /** - * @return the filter for this feed - */ - @NonNull public FeedFilter getFilter() { - return filter; - } - - public void setFilter(@NonNull FeedFilter filter) { - this.filter = filter; - } - - /** - * @return true if this feed should be refreshed when everything else is being refreshed - * if false the feed should only be refreshed if requested directly. - */ - public boolean getKeepUpdated() { - return keepUpdated; - } - - public void setKeepUpdated(boolean keepUpdated) { - this.keepUpdated = keepUpdated; - } - - /** - * Compare another FeedPreferences with this one. The feedID, autoDownload and AutoDeleteAction attribute are excluded from the - * comparison. - * - * @return True if the two objects are different. - */ - public boolean compareWithOther(FeedPreferences other) { - if (other == null) { - return true; - } - if (!TextUtils.equals(username, other.username)) { - return true; - } - if (!TextUtils.equals(password, other.password)) { - return true; - } - return false; - } - - /** - * Update this FeedPreferences object from another one. The feedID, autoDownload and AutoDeleteAction attributes are excluded - * from the update. - */ - public void updateFromOther(FeedPreferences other) { - if (other == null) - return; - this.username = other.username; - this.password = other.password; - } - - public long getFeedID() { - return feedID; - } - - public void setFeedID(long feedID) { - this.feedID = feedID; - } - - public boolean getAutoDownload() { - return autoDownload; - } - - public void setAutoDownload(boolean autoDownload) { - this.autoDownload = autoDownload; - } - - public AutoDeleteAction getAutoDeleteAction() { - return autoDeleteAction; - } - - public VolumeAdaptionSetting getVolumeAdaptionSetting() { - return volumeAdaptionSetting; - } - - public void setAutoDeleteAction(AutoDeleteAction autoDeleteAction) { - this.autoDeleteAction = autoDeleteAction; - } - - public void setVolumeAdaptionSetting(VolumeAdaptionSetting volumeAdaptionSetting) { - this.volumeAdaptionSetting = volumeAdaptionSetting; - } - - public AutoDeleteAction getCurrentAutoDelete() { - return autoDeleteAction; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public float getFeedPlaybackSpeed() { - return feedPlaybackSpeed; - } - - public void setFeedPlaybackSpeed(float playbackSpeed) { - feedPlaybackSpeed = playbackSpeed; - } - - public void setFeedSkipIntro(int skipIntro) { - feedSkipIntro = skipIntro; - } - - public int getFeedSkipIntro() { - return feedSkipIntro; - } - - public void setFeedSkipEnding(int skipEnding) { - feedSkipEnding = skipEnding; - } - - public int getFeedSkipEnding() { - return feedSkipEnding; - } - - public Set<String> getTags() { - return tags; - } - - public String getTagsAsString() { - return TextUtils.join(TAG_SEPARATOR, tags); - } - - /** - * getter for preference if notifications should be display for new episodes. - * @return true for displaying notifications - */ - public boolean getShowEpisodeNotification() { - return showEpisodeNotification; - } - - public void setShowEpisodeNotification(boolean showEpisodeNotification) { - this.showEpisodeNotification = showEpisodeNotification; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java index b69d537fb..56d63c32e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/ID3Chapter.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.Chapter; + public class ID3Chapter extends Chapter { public static final int CHAPTERTYPE_ID3CHAPTER = 2; @@ -20,8 +22,8 @@ public class ID3Chapter extends Chapter { @Override public String toString() { - return "ID3Chapter [id3ID=" + id3ID + ", title=" + title + ", start=" - + start + ", url=" + link + "]"; + return "ID3Chapter [id3ID=" + id3ID + ", title=" + getTitle() + ", start=" + + getStart() + ", url=" + getLink() + "]"; } @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java index 388070679..7a8c4969b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/LocalFeedUpdater.java @@ -29,6 +29,11 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.DateUtils; import de.danoeh.antennapod.core.util.DownloadError; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.playback.MediaType; public class LocalFeedUpdater { diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java b/core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java deleted file mode 100644 index 3cc973a2c..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/MediaType.java +++ /dev/null @@ -1,56 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import android.text.TextUtils; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public enum MediaType { - AUDIO, VIDEO, UNKNOWN; - - private static final Set<String> AUDIO_APPLICATION_MIME_STRINGS = new HashSet<>(Arrays.asList( - "application/ogg", - "application/opus", - "application/x-flac" - )); - - // based on https://developer.android.com/guide/topics/media/media-formats - static final Set<String> AUDIO_FILE_EXTENSIONS = new HashSet<>(Arrays.asList( - "3gp", "aac", "amr", "flac", "imy", "m4a", "mid", "mkv", "mp3", "mp4", "mxmf", "oga", - "ogg", "ogx", "opus", "ota", "rtttl", "rtx", "wav", "xmf" - )); - - static final Set<String> VIDEO_FILE_EXTENSIONS = new HashSet<>(Arrays.asList( - "3gp", "mkv", "mp4", "ogg", "ogv", "ogx", "webm" - )); - - public static MediaType fromMimeType(String mimeType) { - if (TextUtils.isEmpty(mimeType)) { - return MediaType.UNKNOWN; - } else if (mimeType.startsWith("audio")) { - return MediaType.AUDIO; - } else if (mimeType.startsWith("video")) { - return MediaType.VIDEO; - } else if (AUDIO_APPLICATION_MIME_STRINGS.contains(mimeType)) { - return MediaType.AUDIO; - } - return MediaType.UNKNOWN; - } - - /** - * @param extensionWithoutDot the file extension (suffix) without the dot - * @return the {@link MediaType} that likely corresponds to the extension. However, since the - * extension is not always enough to determine whether a file is an audio or video (3gp - * can be both, for example), this may not be correct. As a result, where possible, - * {@link #fromMimeType(String) fromMimeType} should always be tried first. - */ - public static MediaType fromFileExtension(String extensionWithoutDot) { - if (AUDIO_FILE_EXTENSIONS.contains(extensionWithoutDot)) { - return MediaType.AUDIO; - } else if (VIDEO_FILE_EXTENSIONS.contains(extensionWithoutDot)) { - return MediaType.VIDEO; - } - return MediaType.UNKNOWN; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java index 45c71a014..ca59f867b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/SimpleChapter.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.Chapter; + public class SimpleChapter extends Chapter { public static final int CHAPTERTYPE_SIMPLECHAPTER = 0; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/SubscriptionsFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/SubscriptionsFilter.java index e98b40151..a083a7220 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/SubscriptionsFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/SubscriptionsFilter.java @@ -6,6 +6,8 @@ import java.util.ArrayList; import java.util.List; import de.danoeh.antennapod.core.util.LongIntMap; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedPreferences; public class SubscriptionsFilter { private static final String divider = ","; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSetting.java b/core/src/main/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSetting.java deleted file mode 100644 index bf4fc582a..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSetting.java +++ /dev/null @@ -1,32 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -public enum VolumeAdaptionSetting { - OFF(0, 1.0f), - LIGHT_REDUCTION(1, 0.5f), - HEAVY_REDUCTION(2, 0.2f); - - private final int value; - private float adaptionFactor; - - VolumeAdaptionSetting(int value, float adaptionFactor) { - this.value = value; - this.adaptionFactor = adaptionFactor; - } - - public static VolumeAdaptionSetting fromInteger(int value) { - for (VolumeAdaptionSetting setting : values()) { - if (setting.value == value) { - return setting; - } - } - throw new IllegalArgumentException("Cannot map value to VolumeAdaptionSetting: " + value); - } - - public int toInteger() { - return value; - } - - public float getAdaptionFactor() { - return adaptionFactor; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java index eac50aed8..6e0b6859d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/VorbisCommentChapter.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.feed; import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentReaderException; +import de.danoeh.antennapod.model.feed.Chapter; public class VorbisCommentChapter extends Chapter { public static final int CHAPTERTYPE_VORBISCOMMENT_CHAPTER = 3; @@ -21,8 +22,8 @@ public class VorbisCommentChapter extends Chapter { @Override public String toString() { - return "VorbisCommentChapter [id=" + id + ", title=" + title - + ", link=" + link + ", start=" + start + "]"; + return "VorbisCommentChapter [id=" + getId() + ", title=" + getTitle() + + ", link=" + getLink() + ", start=" + getStart() + "]"; } public static long getStartTimeFromValue(String value) diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java b/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java index b0aee3d77..743cacfe2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/util/ImageResourceUtils.java @@ -3,10 +3,10 @@ package de.danoeh.antennapod.core.feed.util; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; /** * Utility class to use the appropriate image resource based on {@link UserPreferences}. diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java b/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java index d6740994d..5eaf0be68 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/util/PlaybackSpeedUtils.java @@ -1,15 +1,15 @@ package de.danoeh.antennapod.core.feed.util; import android.util.Log; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; -import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL; +import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; /** * Utility class to use the appropriate playback speed based on {@link PlaybackPreferences} diff --git a/core/src/main/java/de/danoeh/antennapod/core/glide/MetadataRetrieverLoader.java b/core/src/main/java/de/danoeh/antennapod/core/glide/MetadataRetrieverLoader.java index baa06e722..1be43052b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/glide/MetadataRetrieverLoader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/glide/MetadataRetrieverLoader.java @@ -8,7 +8,7 @@ import com.bumptech.glide.load.model.ModelLoader; import com.bumptech.glide.load.model.ModelLoaderFactory; import com.bumptech.glide.load.model.MultiModelLoaderFactory; import com.bumptech.glide.signature.ObjectKey; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import java.io.InputStream; diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java index 95b828e28..9c73ed9ae 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/PlaybackPreferences.java @@ -6,13 +6,13 @@ import androidx.preference.PreferenceManager; import android.util.Log; import de.danoeh.antennapod.core.event.PlayerStatusEvent; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.service.playback.PlayerStatus; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import org.greenrobot.eventbus.EventBus; -import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL; +import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; /** * Provides access to preferences set by the playback service. A private diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index cbfe28ded..046e5a5a7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -32,7 +32,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.feed.SubscriptionsFilter; import de.danoeh.antennapod.core.service.download.ProxyConfig; import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; @@ -41,7 +41,7 @@ import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; import de.danoeh.antennapod.core.util.Converter; -import de.danoeh.antennapod.core.util.SortOrder; +import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java index 3f503c6b4..079abef1b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java @@ -8,7 +8,7 @@ import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.model.feed.FeedFile; import de.danoeh.antennapod.core.util.URLChecker; public class DownloadRequest implements Parcelable { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index e8e85602b..9598e3bdd 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -40,9 +40,9 @@ import java.util.concurrent.atomic.AtomicInteger; import de.danoeh.antennapod.core.event.DownloadEvent; import de.danoeh.antennapod.core.event.FeedItemEvent; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.handler.FailedDownloadHandler; import de.danoeh.antennapod.core.service.download.handler.FeedSyncTask; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java index 45e81491e..37d8102b6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java @@ -9,8 +9,8 @@ import android.util.Log; import androidx.core.app.NotificationCompat; import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.util.gui.NotificationUtils; import java.util.List; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java index bad2ba1ef..8c95dab85 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java @@ -5,7 +5,7 @@ import androidx.annotation.NonNull; import java.util.Date; -import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.model.feed.FeedFile; import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.util.DownloadError; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java index 5050225f7..1320b7052 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java @@ -23,7 +23,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.util.DateUtils; import de.danoeh.antennapod.core.util.DownloadError; import de.danoeh.antennapod.core.util.StorageUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java index 799a68037..869205b64 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/NewEpisodesNotification.java @@ -15,8 +15,8 @@ import androidx.core.app.NotificationManagerCompat; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.PodDBAdapter; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FailedDownloadHandler.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FailedDownloadHandler.java index 386e5e6f7..748559909 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FailedDownloadHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FailedDownloadHandler.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.core.service.download.handler; import android.util.Log; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.storage.DBWriter; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java index d07018f13..3e3da00e7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedParserTask.java @@ -1,10 +1,10 @@ package de.danoeh.antennapod.core.service.download.handler; import android.util.Log; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.storage.DownloadRequester; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java index ed94a494c..1ca4d1194 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/FeedSyncTask.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.service.download.handler; import android.content.Context; import android.util.Log; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.storage.DBTasks; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java index 7712ca36b..2d0efd22a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/handler/MediaDownloadedHandler.java @@ -10,8 +10,8 @@ import java.io.File; import java.util.concurrent.ExecutionException; import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.storage.DBReader; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 8c874a9e6..1a9f472bb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -29,16 +29,16 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.ReentrantLock; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.MediaType; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.playback.MediaType; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.RewindAfterPauseUtils; import de.danoeh.antennapod.core.util.playback.AudioPlayer; import de.danoeh.antennapod.core.util.playback.IPlayer; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.util.playback.VideoPlayer; @@ -218,7 +218,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { * <p/> * This method requires the playerLock and is executed on the caller's thread. * - * @see #playMediaObject(de.danoeh.antennapod.core.util.playback.Playable, boolean, boolean, boolean) + * @see #playMediaObject(Playable, boolean, boolean, boolean) */ private void playMediaObject(@NonNull final Playable playable, final boolean forceReset, final boolean stream, final boolean startWhenPrepared, final boolean prepareImmediately) { if (!playerLock.isHeldByCurrentThread()) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 145590db2..77c40f32a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -57,12 +57,12 @@ import de.danoeh.antennapod.core.event.ServiceEvent; import de.danoeh.antennapod.core.event.settings.SkipIntroEndingChangedEvent; import de.danoeh.antennapod.core.event.settings.SpeedPresetChangedEvent; import de.danoeh.antennapod.core.event.settings.VolumeAdaptionChangedEvent; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.SleepTimerPreferences; @@ -78,7 +78,7 @@ import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.gui.NotificationUtils; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlayableUtils; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.danoeh.antennapod.core.widget.WidgetUpdater; @@ -93,7 +93,7 @@ import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; -import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL; +import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; /** * Controls the MediaPlayer that plays a FeedMedia-file diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java index 785784497..c393820b1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java @@ -11,8 +11,8 @@ import android.view.SurfaceHolder; import java.util.List; import java.util.concurrent.Future; -import de.danoeh.antennapod.core.feed.MediaType; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.MediaType; +import de.danoeh.antennapod.model.playback.Playable; /* diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java index cbfc36266..75ebf7e10 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java @@ -27,7 +27,7 @@ import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.util.TimeSpeedConverter; import de.danoeh.antennapod.core.util.gui.NotificationUtils; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import java.util.ArrayList; import java.util.concurrent.ExecutionException; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java index 556d9b3c0..8cfbfac2a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java @@ -24,10 +24,10 @@ import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.event.FeedItemEvent; import de.danoeh.antennapod.core.event.QueueEvent; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import io.reactivex.Completable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdater.java index d03830387..edb8bc3a9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdater.java @@ -1,9 +1,9 @@ package de.danoeh.antennapod.core.service.playback; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.playback.Playable; class PlaybackVolumeUpdater { diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java index 4765f9f4f..2be330a3e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java @@ -13,8 +13,8 @@ import java.util.List; import java.util.Locale; import java.util.concurrent.ExecutionException; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; /** * Implementation of the EpisodeCleanupAlgorithm interface used by AntennaPod. diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java index 4f33af959..9fce34a44 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java @@ -11,7 +11,7 @@ import java.util.List; import java.util.Locale; import java.util.concurrent.ExecutionException; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; /** * A cleanup algorithm that removes any item that isn't in the queue and isn't a favorite diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java index bea104c07..2456a3917 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java @@ -7,9 +7,9 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedFilter; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.FeedFilter; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.core.util.NetworkUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 827dc5f7e..dc15b8a9a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -15,12 +15,12 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedItemFilter; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItemFilter; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.feed.SubscriptionsFilter; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadStatus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index 6320fa663..4ccd34e28 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -13,9 +13,9 @@ import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.event.FeedItemEvent; import de.danoeh.antennapod.core.event.FeedListUpdateEvent; import de.danoeh.antennapod.core.event.MessageEvent; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.feed.LocalFeedUpdater; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadStatus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java index 4e2eb6e5a..46ab7502b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java @@ -6,9 +6,9 @@ import android.database.sqlite.SQLiteDatabase; import android.media.MediaMetadataRetriever; import android.util.Log; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; -import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL; +import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; class DBUpgrader { /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 827e30394..cf3983910 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -32,11 +32,11 @@ import de.danoeh.antennapod.core.event.MessageEvent; import de.danoeh.antennapod.core.event.PlaybackHistoryEvent; import de.danoeh.antennapod.core.event.QueueEvent; import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.feed.FeedEvent; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; @@ -46,8 +46,8 @@ import de.danoeh.antennapod.core.util.FeedItemPermutors; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.Permutor; -import de.danoeh.antennapod.core.util.SortOrder; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.feed.SortOrder; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlayableUtils; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java index 638c1bef5..f45cb2b66 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java @@ -23,10 +23,10 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import de.danoeh.antennapod.core.BuildConfig; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedFile; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedFile; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadService; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadStateProvider.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadStateProvider.java index ece40353f..051dc03db 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadStateProvider.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadStateProvider.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.model.feed.FeedFile; /** * Allow callers to query the states of downloads, but not affect them. diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java index f0788db33..f04daf16e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java @@ -12,7 +12,7 @@ import java.util.List; import java.util.Locale; import java.util.concurrent.ExecutionException; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.preferences.UserPreferences; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java index ea62065fc..c3dd52b49 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java @@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.storage; import android.content.Context; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import java.util.Collections; import java.util.List; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculator.java b/core/src/main/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculator.java index 4b28d36b5..ed88ac1a2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculator.java @@ -8,10 +8,10 @@ import androidx.annotation.VisibleForTesting; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; /** * @see DBWriter#addQueueItem(Context, boolean, long...) it uses the class to determine diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java index da18a2f55..7ca90d687 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.storage; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.util.LongIntMap; import java.util.ArrayList; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index bad7775f2..18810aff9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -17,7 +17,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import de.danoeh.antennapod.core.feed.FeedFunding; +import de.danoeh.antennapod.model.feed.FeedFunding; import de.danoeh.antennapod.core.storage.mapper.FeedItemFilterQuery; import org.apache.commons.io.FileUtils; @@ -30,19 +30,19 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedItemFilter; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItemFilter; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.util.LongIntMap; -import de.danoeh.antennapod.core.util.SortOrder; +import de.danoeh.antennapod.model.feed.SortOrder; -import static de.danoeh.antennapod.core.feed.FeedPreferences.SPEED_USE_GLOBAL; -import static de.danoeh.antennapod.core.util.SortOrder.toCodeString; +import static de.danoeh.antennapod.model.feed.FeedPreferences.SPEED_USE_GLOBAL; +import static de.danoeh.antennapod.model.feed.SortOrder.toCodeString; // TODO Remove media column from feeditem table diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java index 18a5403a7..90978d6b8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.storage; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; public class StatisticsItem { public final Feed feed; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/ChapterCursorMapper.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/ChapterCursorMapper.java index def426bd0..b171f2bcc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/ChapterCursorMapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/ChapterCursorMapper.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage.mapper; import android.database.Cursor; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.core.feed.ID3Chapter; import de.danoeh.antennapod.core.feed.SimpleChapter; import de.danoeh.antennapod.core.feed.VorbisCommentChapter; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapper.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapper.java index 6f48eadad..a2a180735 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapper.java @@ -4,10 +4,10 @@ import android.database.Cursor; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.core.storage.PodDBAdapter; -import de.danoeh.antennapod.core.util.SortOrder; +import de.danoeh.antennapod.model.feed.SortOrder; /** * Converts a {@link Cursor} to a {@link Feed} object. diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemCursorMapper.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemCursorMapper.java index aa2c78e03..19695ca95 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemCursorMapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemCursorMapper.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage.mapper; import android.database.Cursor; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.util.Date; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemFilterQuery.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemFilterQuery.java index f6963b5ac..1d9c8a9e6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemFilterQuery.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedItemFilterQuery.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.storage.mapper; -import de.danoeh.antennapod.core.feed.FeedItemFilter; +import de.danoeh.antennapod.model.feed.FeedItemFilter; import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.util.ArrayList; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedMediaCursorMapper.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedMediaCursorMapper.java index 44617cffa..608fce5c4 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedMediaCursorMapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedMediaCursorMapper.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.storage.mapper; import android.database.Cursor; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.util.Date; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedPreferencesCursorMapper.java b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedPreferencesCursorMapper.java index 1115d8161..cab6ea618 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedPreferencesCursorMapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/mapper/FeedPreferencesCursorMapper.java @@ -3,9 +3,9 @@ package de.danoeh.antennapod.core.storage.mapper; import android.database.Cursor; import android.text.TextUtils; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.FeedFilter; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.feed.FeedFilter; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import de.danoeh.antennapod.core.storage.PodDBAdapter; import java.util.Arrays; diff --git a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java index 551b2a24b..21b217e66 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/sync/SyncService.java @@ -21,9 +21,9 @@ import androidx.work.Worker; import androidx.work.WorkerParameters; import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.event.SyncServiceEvent; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; diff --git a/core/src/main/java/de/danoeh/antennapod/core/sync/model/EpisodeAction.java b/core/src/main/java/de/danoeh/antennapod/core/sync/model/EpisodeAction.java index 798be8d96..7a97b7755 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/sync/model/EpisodeAction.java +++ b/core/src/main/java/de/danoeh/antennapod/core/sync/model/EpisodeAction.java @@ -5,7 +5,7 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.core.util.ObjectsCompat; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.util.DateUtils; import org.json.JSONException; import org.json.JSONObject; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java index 8f2ce5465..c9e6ce5fa 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandler.java @@ -12,7 +12,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; public class FeedHandler { diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java index 77300d864..fb4bf4707 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.syndication.handler; import java.util.Map; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; /** * Container for results returned by the Feed parser diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java index 7aaf66668..2fecb0536 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java @@ -6,9 +6,9 @@ import java.util.ArrayList; import java.util.Map; import java.util.Stack; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedFunding; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedFunding; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.syndication.namespace.Namespace; import de.danoeh.antennapod.core.syndication.namespace.SyndElement; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java index 5beb36d6d..9c09be714 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java @@ -6,7 +6,7 @@ import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.syndication.namespace.NSContent; import de.danoeh.antennapod.core.syndication.namespace.NSDublinCore; import de.danoeh.antennapod.core.syndication.namespace.NSITunes; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java index b4c77e58d..e6011e3fa 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java @@ -13,7 +13,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.Reader; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; /** Gets the type of a specific feed by reading the root element. */ public class TypeGetter { diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSDublinCore.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSDublinCore.java index 59d66a97e..14286d850 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSDublinCore.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSDublinCore.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.syndication.namespace; import org.xml.sax.Attributes; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.syndication.handler.HandlerState; import de.danoeh.antennapod.core.util.DateUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java index b5d5a1b3f..348ffaa60 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSMedia.java @@ -7,7 +7,7 @@ import org.xml.sax.Attributes; import java.util.concurrent.TimeUnit; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.syndication.handler.HandlerState; import de.danoeh.antennapod.core.syndication.namespace.atom.AtomText; import de.danoeh.antennapod.core.syndication.util.SyndTypeUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java index b1cd6d1c2..87423b6b1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java @@ -6,8 +6,8 @@ import android.util.Log; import de.danoeh.antennapod.core.syndication.util.SyndStringUtils; import org.xml.sax.Attributes; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.syndication.handler.HandlerState; import de.danoeh.antennapod.core.syndication.util.SyndTypeUtils; import de.danoeh.antennapod.core.util.DateUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java index 5761f37c8..97d0ebb53 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java @@ -6,7 +6,7 @@ import org.xml.sax.Attributes; import java.util.ArrayList; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.feed.SimpleChapter; import de.danoeh.antennapod.core.syndication.handler.HandlerState; import de.danoeh.antennapod.core.util.DateUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/PodcastIndex.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/PodcastIndex.java index eb68c0915..ee150f839 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/PodcastIndex.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/PodcastIndex.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.syndication.namespace; import org.jsoup.helper.StringUtil; import org.xml.sax.Attributes; -import de.danoeh.antennapod.core.feed.FeedFunding; +import de.danoeh.antennapod.model.feed.FeedFunding; import de.danoeh.antennapod.core.syndication.handler.HandlerState; public class PodcastIndex extends Namespace { diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java index eeca82aee..7c5ed2d30 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java @@ -3,12 +3,12 @@ package de.danoeh.antennapod.core.syndication.namespace.atom; import android.text.TextUtils; import android.util.Log; -import de.danoeh.antennapod.core.feed.FeedFunding; +import de.danoeh.antennapod.model.feed.FeedFunding; import de.danoeh.antennapod.core.syndication.util.SyndStringUtils; import org.xml.sax.Attributes; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.syndication.handler.HandlerState; import de.danoeh.antennapod.core.syndication.namespace.NSITunes; import de.danoeh.antennapod.core.syndication.namespace.NSRSS20; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java index ca9689048..1bc2c13ee 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java @@ -5,15 +5,15 @@ import android.content.Context; import android.net.Uri; import android.util.Log; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.core.feed.ChapterMerger; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.comparator.ChapterStartTimeComparator; import de.danoeh.antennapod.core.util.id3reader.ChapterReader; import de.danoeh.antennapod.core.util.id3reader.ID3ReaderException; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentChapterReader; import de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentReaderException; import okhttp3.Request; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java b/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java index deeba9238..a3966a24c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/EmbeddedChapterImage.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.core.util; import android.text.TextUtils; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java index 9bf9b9db0..e5f60d64b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemPermutors.java @@ -11,7 +11,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.SortOrder; /** * Provides method for sorting the a list of {@link FeedItem} according to rules. diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java index beaba59c3..82c132dc1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; @@ -11,7 +11,7 @@ import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; public class FeedItemUtil { private FeedItemUtil(){} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java index 8cca2f28f..12f1e98f9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java @@ -17,7 +17,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.storage.DBWriter; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java index 2622d81aa..c1c48f70d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java @@ -13,9 +13,9 @@ import java.io.File; import java.util.List; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; /** Utility methods for sharing data */ public class ShareUtils { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/SortOrder.java b/core/src/main/java/de/danoeh/antennapod/core/util/SortOrder.java deleted file mode 100644 index e3a10b14a..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/util/SortOrder.java +++ /dev/null @@ -1,71 +0,0 @@ -package de.danoeh.antennapod.core.util; - -import android.text.TextUtils; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import static de.danoeh.antennapod.core.util.SortOrder.Scope.INTER_FEED; -import static de.danoeh.antennapod.core.util.SortOrder.Scope.INTRA_FEED; - -/** - * Provides sort orders to sort a list of episodes. - */ -public enum SortOrder { - DATE_OLD_NEW(1, INTRA_FEED), - DATE_NEW_OLD(2, INTRA_FEED), - EPISODE_TITLE_A_Z(3, INTRA_FEED), - EPISODE_TITLE_Z_A(4, INTRA_FEED), - DURATION_SHORT_LONG(5, INTRA_FEED), - DURATION_LONG_SHORT(6, INTRA_FEED), - FEED_TITLE_A_Z(101, INTER_FEED), - FEED_TITLE_Z_A(102, INTER_FEED), - RANDOM(103, INTER_FEED), - SMART_SHUFFLE_OLD_NEW(104, INTER_FEED), - SMART_SHUFFLE_NEW_OLD(105, INTER_FEED); - - public enum Scope { - INTRA_FEED, INTER_FEED - } - - public final int code; - - @NonNull - public final Scope scope; - - SortOrder(int code, @NonNull Scope scope) { - this.code = code; - this.scope = scope; - } - - /** - * Converts the string representation to its enum value. If the string value is unknown, - * the given default value is returned. - */ - public static SortOrder parseWithDefault(String value, SortOrder defaultValue) { - try { - return valueOf(value); - } catch (IllegalArgumentException e) { - return defaultValue; - } - } - - @Nullable - public static SortOrder fromCodeString(@Nullable String codeStr) { - if (TextUtils.isEmpty(codeStr)) { - return null; - } - int code = Integer.parseInt(codeStr); - for (SortOrder sortOrder : values()) { - if (sortOrder.code == code) { - return sortOrder; - } - } - throw new IllegalArgumentException("Unsupported code: " + code); - } - - @Nullable - public static String toCodeString(@Nullable SortOrder sortOrder) { - return sortOrder != null ? Integer.toString(sortOrder.code) : null; - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java index 920a1ef8a..e36f8d0a1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/ChapterStartTimeComparator.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.comparator; import java.util.Comparator; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; public class ChapterStartTimeComparator implements Comparator<Chapter> { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java index 766986bed..b16f0f1aa 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/FeedItemPubdateComparator.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.comparator; import java.util.Comparator; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; /** * Compares the pubDate of two FeedItems for sorting. diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java index d65eb3e0b..b1e62bcf1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/comparator/PlaybackCompletionDateComparator.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.comparator; import java.util.Comparator; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedItem; public class PlaybackCompletionDateComparator implements Comparator<FeedItem> { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java index 69d8316c2..adc38b0d2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ChapterReader.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.util.id3reader; import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.core.feed.ID3Chapter; import de.danoeh.antennapod.core.util.EmbeddedChapterImage; import de.danoeh.antennapod.core.util.id3reader.model.FrameHeader; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java deleted file mode 100644 index 2c4b93d38..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java +++ /dev/null @@ -1,153 +0,0 @@ -package de.danoeh.antennapod.core.util.playback; - -import android.content.Context; -import android.content.SharedPreferences; -import android.os.Parcelable; - -import androidx.annotation.Nullable; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.MediaType; -import java.util.Date; -import java.util.List; - -/** - * Interface for objects that can be played by the PlaybackService. - */ -public interface Playable extends Parcelable { - int INVALID_TIME = -1; - - /** - * Save information about the playable in a preference so that it can be - * restored later via PlayableUtils.createInstanceFromPreferences. - * Implementations must NOT call commit() after they have written the values - * to the preferences file. - */ - void writeToPreferences(SharedPreferences.Editor prefEditor); - - /** - * Returns the title of the episode that this playable represents - */ - String getEpisodeTitle(); - - /** - * Returns a list of chapter marks or null if this Playable has no chapters. - */ - List<Chapter> getChapters(); - - /** - * Returns a link to a website that is meant to be shown in a browser - */ - String getWebsiteLink(); - - /** - * Returns the title of the feed this Playable belongs to. - */ - String getFeedTitle(); - - /** - * Returns the published date - */ - Date getPubDate(); - - /** - * Returns a unique identifier, for example a file url or an ID from a - * database. - */ - Object getIdentifier(); - - /** - * Return duration of object or 0 if duration is unknown. - */ - int getDuration(); - - /** - * Return position of object or 0 if position is unknown. - */ - int getPosition(); - - /** - * Returns last time (in ms) when this playable was played or 0 - * if last played time is unknown. - */ - long getLastPlayedTime(); - - /** - * Returns the description of the item, if available. - * For FeedItems, the description needs to be loaded from the database first. - */ - @Nullable - String getDescription(); - - /** - * Returns the type of media. - */ - MediaType getMediaType(); - - /** - * Returns an url to a local file that can be played or null if this file - * does not exist. - */ - String getLocalMediaUrl(); - - /** - * Returns an url to a file that can be streamed by the player or null if - * this url is not known. - */ - String getStreamUrl(); - - /** - * Returns true if a local file that can be played is available. getFileUrl - * MUST return a non-null string if this method returns true. - */ - boolean localFileAvailable(); - - void setPosition(int newPosition); - - void setDuration(int newDuration); - - /** - * @param lastPlayedTimestamp timestamp in ms - */ - void setLastPlayedTime(long lastPlayedTimestamp); - - /** - * This method should be called every time playback starts on this object. - * <p/> - * Position held by this Playable should be set accurately before a call to this method is made. - */ - void onPlaybackStart(); - - /** - * This method should be called every time playback pauses or stops on this object, - * including just before a seeking operation is performed, after which a call to - * {@link #onPlaybackStart()} should be made. If playback completes, calling this method is not - * necessary, as long as a call to {@link #onPlaybackCompleted(Context)} is made. - * <p/> - * Position held by this Playable should be set accurately before a call to this method is made. - */ - void onPlaybackPause(Context context); - - /** - * This method should be called when playback completes for this object. - * @param context - */ - void onPlaybackCompleted(Context context); - - /** - * Returns an integer that must be unique among all Playable classes. The - * return value is later used by PlayableUtils to determine the type of the - * Playable object that is restored. - */ - int getPlayableType(); - - void setChapters(List<Chapter> chapters); - - /** - * Returns the location of the image or null if no image is available. - * This can be the feed item image URL, the local embedded media image path, the feed image URL, - * or the remote media image URL, depending on what's available. - */ - @Nullable - String getImageLocation(); - -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlayableUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlayableUtils.java index 47a8e6a1d..56b46903d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlayableUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlayableUtils.java @@ -8,11 +8,12 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.preference.PreferenceManager; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; +import de.danoeh.antennapod.model.playback.Playable; /** * Provides utility methods for Playable objects. diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java index ac801e6da..c6166264b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java @@ -18,14 +18,15 @@ import androidx.annotation.NonNull; import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.event.MessageEvent; import de.danoeh.antennapod.core.event.ServiceEvent; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer; import de.danoeh.antennapod.core.service.playback.PlayerStatus; +import de.danoeh.antennapod.model.playback.Playable; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java index 107399e60..061a976dc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java @@ -6,6 +6,7 @@ import androidx.core.content.ContextCompat; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.model.playback.Playable; public class PlaybackServiceStarter { private final Context context; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java deleted file mode 100644 index 8585e3110..000000000 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/RemoteMedia.java +++ /dev/null @@ -1,315 +0,0 @@ -package de.danoeh.antennapod.core.util.playback; - -import android.content.Context; -import android.content.SharedPreferences; -import android.os.Parcel; -import android.os.Parcelable; -import android.text.TextUtils; -import androidx.annotation.Nullable; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.MediaType; -import java.util.Date; -import java.util.List; -import org.apache.commons.lang3.builder.HashCodeBuilder; - -/** - * Playable implementation for media for which a local version of - * {@link de.danoeh.antennapod.core.feed.FeedMedia} hasn't been found. - * Used for Casting and for previewing unsubscribed feeds. - */ -public class RemoteMedia implements Playable { - public static final String TAG = "RemoteMedia"; - - public static final int PLAYABLE_TYPE_REMOTE_MEDIA = 3; - - private final String downloadUrl; - private final String itemIdentifier; - private final String feedUrl; - private final String feedTitle; - private final String episodeTitle; - private final String episodeLink; - private final String feedAuthor; - private final String imageUrl; - private final String feedLink; - private final String mimeType; - private final Date pubDate; - private final String notes; - private List<Chapter> chapters; - private int duration; - private int position; - private long lastPlayedTime; - - public RemoteMedia(String downloadUrl, String itemId, String feedUrl, String feedTitle, - String episodeTitle, String episodeLink, String feedAuthor, - String imageUrl, String feedLink, String mimeType, Date pubDate, - String notes) { - this.downloadUrl = downloadUrl; - this.itemIdentifier = itemId; - this.feedUrl = feedUrl; - this.feedTitle = feedTitle; - this.episodeTitle = episodeTitle; - this.episodeLink = episodeLink; - this.feedAuthor = feedAuthor; - this.imageUrl = imageUrl; - this.feedLink = feedLink; - this.mimeType = mimeType; - this.pubDate = pubDate; - this.notes = notes; - } - - public RemoteMedia(FeedItem item) { - this.downloadUrl = item.getMedia().getDownload_url(); - this.itemIdentifier = item.getItemIdentifier(); - this.feedUrl = item.getFeed().getDownload_url(); - this.feedTitle = item.getFeed().getTitle(); - this.episodeTitle = item.getTitle(); - this.episodeLink = item.getLink(); - this.feedAuthor = item.getFeed().getAuthor(); - if (!TextUtils.isEmpty(item.getImageUrl())) { - this.imageUrl = item.getImageUrl(); - } else { - this.imageUrl = item.getFeed().getImageUrl(); - } - this.feedLink = item.getFeed().getLink(); - this.mimeType = item.getMedia().getMime_type(); - this.pubDate = item.getPubDate(); - this.notes = item.getDescription(); - } - - public String getEpisodeIdentifier() { - return itemIdentifier; - } - - public String getFeedUrl() { - return feedUrl; - } - - public String getDownloadUrl() { - return downloadUrl; - } - - public String getEpisodeLink() { - return episodeLink; - } - - public String getFeedAuthor() { - return feedAuthor; - } - - public String getImageUrl() { - return imageUrl; - } - - public String getFeedLink() { - return feedLink; - } - - public String getMimeType() { - return mimeType; - } - - public Date getPubDate() { - return pubDate; - } - - public String getNotes() { - return notes; - } - - @Override - public void writeToPreferences(SharedPreferences.Editor prefEditor) { - //it seems pointless to do it, since the session should be kept by the remote device. - } - - @Override - public String getEpisodeTitle() { - return episodeTitle; - } - - @Override - public List<Chapter> getChapters() { - return chapters; - } - - @Override - public String getWebsiteLink() { - if (episodeLink != null) { - return episodeLink; - } else { - return feedUrl; - } - } - - @Override - public String getFeedTitle() { - return feedTitle; - } - - @Override - public Object getIdentifier() { - return itemIdentifier + "@" + feedUrl; - } - - @Override - public int getDuration() { - return duration; - } - - @Override - public int getPosition() { - return position; - } - - @Override - public long getLastPlayedTime() { - return lastPlayedTime; - } - - @Override - public MediaType getMediaType() { - return MediaType.fromMimeType(mimeType); - } - - @Override - public String getLocalMediaUrl() { - return null; - } - - @Override - public String getStreamUrl() { - return downloadUrl; - } - - @Override - public boolean localFileAvailable() { - return false; - } - - @Override - public void setPosition(int newPosition) { - position = newPosition; - } - - @Override - public void setDuration(int newDuration) { - duration = newDuration; - } - - @Override - public void setLastPlayedTime(long lastPlayedTimestamp) { - lastPlayedTime = lastPlayedTimestamp; - } - - @Override - public void onPlaybackStart() { - // no-op - } - - @Override - public void onPlaybackPause(Context context) { - // no-op - } - - @Override - public void onPlaybackCompleted(Context context) { - // no-op - } - - @Override - public int getPlayableType() { - return PLAYABLE_TYPE_REMOTE_MEDIA; - } - - @Override - public void setChapters(List<Chapter> chapters) { - this.chapters = chapters; - } - - @Override - @Nullable - public String getImageLocation() { - return imageUrl; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public String getDescription() { - return notes; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(downloadUrl); - dest.writeString(itemIdentifier); - dest.writeString(feedUrl); - dest.writeString(feedTitle); - dest.writeString(episodeTitle); - dest.writeString(episodeLink); - dest.writeString(feedAuthor); - dest.writeString(imageUrl); - dest.writeString(feedLink); - dest.writeString(mimeType); - dest.writeLong((pubDate != null) ? pubDate.getTime() : 0); - dest.writeString(notes); - dest.writeInt(duration); - dest.writeInt(position); - dest.writeLong(lastPlayedTime); - } - - public static final Parcelable.Creator<RemoteMedia> CREATOR = new Parcelable.Creator<RemoteMedia>() { - @Override - public RemoteMedia createFromParcel(Parcel in) { - RemoteMedia result = new RemoteMedia(in.readString(), in.readString(), in.readString(), - in.readString(), in.readString(), in.readString(), in.readString(), in.readString(), - in.readString(), in.readString(), new Date(in.readLong()), in.readString()); - result.setDuration(in.readInt()); - result.setPosition(in.readInt()); - result.setLastPlayedTime(in.readLong()); - return result; - } - - @Override - public RemoteMedia[] newArray(int size) { - return new RemoteMedia[size]; - } - }; - - @Override - public boolean equals(Object other) { - if (other instanceof RemoteMedia) { - RemoteMedia rm = (RemoteMedia) other; - return TextUtils.equals(downloadUrl, rm.downloadUrl) - && TextUtils.equals(feedUrl, rm.feedUrl) - && TextUtils.equals(itemIdentifier, rm.itemIdentifier); - } - if (other instanceof FeedMedia) { - FeedMedia fm = (FeedMedia) other; - if (!TextUtils.equals(downloadUrl, fm.getStreamUrl())) { - return false; - } - FeedItem fi = fm.getItem(); - if (fi == null || !TextUtils.equals(itemIdentifier, fi.getItemIdentifier())) { - return false; - } - Feed feed = fi.getFeed(); - return feed != null && TextUtils.equals(feedUrl, feed.getDownload_url()); - } - return false; - } - - @Override - public int hashCode() { - return new HashCodeBuilder() - .append(downloadUrl) - .append(feedUrl) - .append(itemIdentifier) - .toHashCode(); - } -} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java index c4fe76780..26955effc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReader.java @@ -6,7 +6,7 @@ import java.util.ArrayList; import java.util.List; import de.danoeh.antennapod.core.BuildConfig; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.core.feed.VorbisCommentChapter; public class VorbisCommentChapterReader extends VorbisCommentReader { diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java index c541285b4..0ccdb2d81 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java +++ b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdater.java @@ -19,7 +19,7 @@ import com.bumptech.glide.request.RequestOptions; import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; import de.danoeh.antennapod.core.receiver.PlayerWidget; @@ -27,7 +27,7 @@ import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.feed.util.ImageResourceUtils; import de.danoeh.antennapod.core.util.TimeSpeedConverter; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.ui.appstartintent.MainActivityStarter; import de.danoeh.antennapod.ui.appstartintent.VideoPlayerActivityStarter; diff --git a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterJobService.java b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterJobService.java index 004588945..b14fb3b0b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/widget/WidgetUpdaterJobService.java @@ -7,7 +7,7 @@ import androidx.core.app.SafeJobIntentService; import de.danoeh.antennapod.core.feed.util.PlaybackSpeedUtils; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.service.playback.PlayerStatus; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.core.util.playback.PlayableUtils; public class WidgetUpdaterJobService extends SafeJobIntentService { diff --git a/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java b/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java index e87161d75..e7daf866c 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java +++ b/core/src/play/java/de/danoeh/antennapod/core/cast/CastUtils.java @@ -10,15 +10,15 @@ import com.google.android.gms.cast.MediaInfo; import com.google.android.gms.cast.MediaMetadata; import com.google.android.gms.common.images.WebImage; -import de.danoeh.antennapod.core.util.playback.RemoteMedia; import java.util.Calendar; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.Playable; +import de.danoeh.antennapod.model.playback.RemoteMedia; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.util.playback.Playable; /** * Helper functions for Cast support. diff --git a/core/src/play/java/de/danoeh/antennapod/core/cast/MediaInfoCreator.java b/core/src/play/java/de/danoeh/antennapod/core/cast/MediaInfoCreator.java index a9df49176..00011ef05 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/cast/MediaInfoCreator.java +++ b/core/src/play/java/de/danoeh/antennapod/core/cast/MediaInfoCreator.java @@ -5,7 +5,7 @@ import android.text.TextUtils; import com.google.android.gms.cast.MediaInfo; import com.google.android.gms.cast.MediaMetadata; import com.google.android.gms.common.images.WebImage; -import de.danoeh.antennapod.core.util.playback.RemoteMedia; +import de.danoeh.antennapod.model.playback.RemoteMedia; import java.util.Calendar; public class MediaInfoCreator { diff --git a/core/src/play/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java b/core/src/play/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java deleted file mode 100644 index 2502f17c0..000000000 --- a/core/src/play/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java +++ /dev/null @@ -1,13 +0,0 @@ -package de.danoeh.antennapod.core.feed; - -import de.danoeh.antennapod.core.util.playback.RemoteMedia; - -/** - * Implements methods for FeedMedia that are flavor dependent. - */ -public class FeedMediaFlavorHelper { - private FeedMediaFlavorHelper(){} - static boolean instanceOfRemoteMedia(Object o) { - return o instanceof RemoteMedia; - } -} diff --git a/core/src/play/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java b/core/src/play/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java index 31e955017..38e84017f 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java +++ b/core/src/play/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java @@ -27,7 +27,7 @@ import de.danoeh.antennapod.core.cast.CastConsumer; import de.danoeh.antennapod.core.cast.CastManager; import de.danoeh.antennapod.core.cast.DefaultCastConsumer; import de.danoeh.antennapod.core.event.MessageEvent; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.NetworkUtils; import org.greenrobot.eventbus.EventBus; diff --git a/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java b/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java index fe39ca0b1..b114663f0 100644 --- a/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java +++ b/core/src/play/java/de/danoeh/antennapod/core/service/playback/RemotePSMP.java @@ -29,12 +29,12 @@ import de.danoeh.antennapod.core.cast.CastManager; import de.danoeh.antennapod.core.cast.CastUtils; import de.danoeh.antennapod.core.cast.DefaultCastConsumer; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.util.playback.RemoteMedia; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.playback.RemoteMedia; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.MediaType; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.RewindAfterPauseUtils; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; /** * Implementation of PlaybackServiceMediaPlayer suitable for remote playback on Cast Devices. @@ -305,7 +305,7 @@ public class RemotePSMP extends PlaybackServiceMediaPlayer { * Internal implementation of playMediaObject. This method has an additional parameter that allows the caller to force a media player reset even if * the given playable parameter is the same object as the currently playing media. * - * @see #playMediaObject(de.danoeh.antennapod.core.util.playback.Playable, boolean, boolean, boolean) + * @see #playMediaObject(Playable, boolean, boolean, boolean) */ private void playMediaObject(@NonNull final Playable playable, final boolean forceReset, final boolean stream, final boolean startWhenPrepared, final boolean prepareImmediately) { if (!CastUtils.isCastable(playable)) { diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java index 8b4a13473..4ad578727 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.FeedFilter; +import de.danoeh.antennapod.model.feed.FeedItem; import org.junit.Test; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java index b78cecc23..cd96dca89 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.FeedItem; + import java.util.Date; import static de.danoeh.antennapod.core.feed.FeedMother.anyFeed; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java index 4d9c247f7..c4860d818 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.FeedItem; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java index d95b8787c..35a85af02 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.FeedMedia; + class FeedMediaMother { private static final String EPISODE_URL = "http://example.com/episode"; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java index f27a54f84..43d855cc4 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java index 991495a3f..b1f3fca27 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.Feed; + public class FeedMother { public static final String IMAGE_URL = "http://example.com/image"; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java index 88b342850..c256fea11 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java @@ -1,9 +1,10 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.Feed; import org.junit.Before; import org.junit.Test; -import de.danoeh.antennapod.core.util.SortOrder; +import de.danoeh.antennapod.model.feed.SortOrder; import static de.danoeh.antennapod.core.feed.FeedMother.anyFeed; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/LocalFeedUpdaterTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/LocalFeedUpdaterTest.java index 169146c07..eb56a1876 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/LocalFeedUpdaterTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/LocalFeedUpdaterTest.java @@ -12,6 +12,8 @@ import androidx.documentfile.provider.DocumentFile; import androidx.test.platform.app.InstrumentationRegistry; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSettingTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSettingTest.java index e933ce034..4241707bc 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSettingTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/VolumeAdaptionSettingTest.java @@ -1,5 +1,6 @@ package de.danoeh.antennapod.core.feed; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; import org.junit.Test; import static org.hamcrest.Matchers.equalTo; diff --git a/core/src/test/java/de/danoeh/antennapod/core/service/download/DownloadRequestTest.java b/core/src/test/java/de/danoeh/antennapod/core/service/download/DownloadRequestTest.java index 8c7ecbc52..ddf802858 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/service/download/DownloadRequestTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/service/download/DownloadRequestTest.java @@ -9,7 +9,7 @@ import org.robolectric.RobolectricTestRunner; import java.util.ArrayList; -import de.danoeh.antennapod.core.feed.FeedFile; +import de.danoeh.antennapod.model.feed.FeedFile; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdaterTest.java b/core/src/test/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdaterTest.java index 22f67933f..4890c471a 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdaterTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/service/playback/PlaybackVolumeUpdaterTest.java @@ -1,11 +1,11 @@ package de.danoeh.antennapod.core.service.playback; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedPreferences; -import de.danoeh.antennapod.core.feed.VolumeAdaptionSetting; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedPreferences; +import de.danoeh.antennapod.model.feed.VolumeAdaptionSetting; +import de.danoeh.antennapod.model.playback.Playable; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java index 13d24adc1..1c4c92574 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java @@ -15,9 +15,9 @@ import androidx.test.platform.app.InstrumentationRegistry; import de.danoeh.antennapod.core.ApplicationCallbacks; import de.danoeh.antennapod.core.ClientConfig; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java index b4dbacb82..733318724 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java @@ -11,9 +11,9 @@ import java.util.Date; import java.util.List; import androidx.test.platform.app.InstrumentationRegistry; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import org.junit.After; import org.junit.Before; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java index 6e53bd20e..7d851c322 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.preferences.UserPreferences; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java index 2a1e6f4c8..07d7242aa 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java @@ -8,9 +8,9 @@ import java.util.List; import java.util.Random; import androidx.test.platform.app.InstrumentationRegistry; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.LongList; import org.junit.After; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java index ef4d1aa03..9e3dca0f7 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java @@ -19,9 +19,9 @@ import java.util.List; import de.danoeh.antennapod.core.ApplicationCallbacks; import de.danoeh.antennapod.core.ClientConfig; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java index 400ddda36..6c1e8d4f9 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java @@ -5,10 +5,10 @@ import java.util.Collections; import java.util.Date; import java.util.List; -import de.danoeh.antennapod.core.feed.Chapter; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Chapter; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.feed.SimpleChapter; import de.danoeh.antennapod.core.util.comparator.FeedItemPubdateComparator; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java index 3efb2705f..093c416d1 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java @@ -27,9 +27,9 @@ import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.ApplicationCallbacks; import de.danoeh.antennapod.core.ClientConfig; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.FeedItemUtil; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java index 8c02391ca..2224cff4f 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java @@ -9,8 +9,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.core.preferences.UserPreferences; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java index 00fa1b8f5..91693a084 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.storage; -import de.danoeh.antennapod.core.util.playback.RemoteMedia; +import de.danoeh.antennapod.model.playback.RemoteMedia; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -14,12 +14,12 @@ import java.util.Date; import java.util.List; import java.util.stream.Collectors; -import de.danoeh.antennapod.core.feed.FeedComponent; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.FeedComponent; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.core.feed.FeedMother; import de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation; -import de.danoeh.antennapod.core.util.playback.Playable; +import de.danoeh.antennapod.model.playback.Playable; import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING; import static de.danoeh.antennapod.core.preferences.UserPreferences.EnqueueLocation.BACK; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java index 89843e941..8695f98b1 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/mapper/FeedCursorMapperTest.java @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.core.storage.PodDBAdapter; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java index 5e982ed3c..2acc73204 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java @@ -7,9 +7,9 @@ import org.robolectric.RobolectricTestRunner; import java.io.File; import java.util.Date; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/FeedParserTestHelper.java b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/FeedParserTestHelper.java index c02a7d209..b9318b377 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/FeedParserTestHelper.java +++ b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/FeedParserTestHelper.java @@ -4,7 +4,7 @@ import androidx.annotation.NonNull; import java.io.File; -import de.danoeh.antennapod.core.feed.Feed; +import de.danoeh.antennapod.model.feed.Feed; /** * Tests for FeedHandler. diff --git a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/RssParserTest.java b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/RssParserTest.java index 90b14c875..d95c8b3ab 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/RssParserTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/RssParserTest.java @@ -8,10 +8,10 @@ import org.robolectric.RobolectricTestRunner; import java.io.File; import java.util.Date; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.MediaType; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; +import de.danoeh.antennapod.model.playback.MediaType; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemPermutorsTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemPermutorsTest.java index ccaa77ae8..9c48f8df7 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemPermutorsTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemPermutorsTest.java @@ -1,14 +1,15 @@ package de.danoeh.antennapod.core.util; +import de.danoeh.antennapod.model.feed.SortOrder; import org.junit.Test; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; -import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; +import de.danoeh.antennapod.model.feed.FeedMedia; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java index a3744035b..ffb788c25 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java @@ -9,8 +9,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.model.feed.Feed; +import de.danoeh.antennapod.model.feed.FeedItem; import static org.junit.Assert.assertEquals; diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java index 84fe9d94d..5e2e46e74 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/id3reader/ChapterReaderTest.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.util.id3reader; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import de.danoeh.antennapod.core.feed.ID3Chapter; import de.danoeh.antennapod.core.util.EmbeddedChapterImage; import de.danoeh.antennapod.core.util.id3reader.model.FrameHeader; diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReaderTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReaderTest.java index cf9228292..40f8b381f 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReaderTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentChapterReaderTest.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.util.vorbiscommentreader; -import de.danoeh.antennapod.core.feed.Chapter; +import de.danoeh.antennapod.model.feed.Chapter; import org.junit.Test; import java.io.IOException; |