summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-04-05 19:20:27 +0200
committerGitHub <noreply@github.com>2024-04-05 19:20:27 +0200
commit92ab575b150ab49ca85e0ac994558142e49c9e68 (patch)
tree422dcd76895a4ba06ed02723ff61351435c0fe49
parent2143ab135182434911d4554a8ef08115eaa0d2d0 (diff)
downloadAntennaPod-92ab575b150ab49ca85e0ac994558142e49c9e68.zip
Delete core module (#7060)
-rw-r--r--app/build.gradle2
-rw-r--r--app/src/main/AndroidManifest.xml7
-rw-r--r--app/src/main/assets/shownotes-style.css (renamed from core/src/main/assets/shownotes-style.css)0
-rw-r--r--app/src/main/java/de/danoeh/antennapod/actionbutton/VisitWebsiteActionButton.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/cleaner/ShownotesCleaner.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeItemListAdapter.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodesListFragment.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java9
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/episodeslist/HorizontalItemListAdapter.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/episodeslist/MoreContentListFooterUtil.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/PlaybackHistoryFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersListAdapter.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/download/DownloadErrorLabel.java4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemPagerFragment.java18
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedInfoFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemFilterGroup.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java10
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RemoveFeedDialog.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RenameFeedDialog.java4
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java3
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/AudioPlayerFragment.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java6
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/playback/video/VideoplayerActivity.java5
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/BugReportActivity.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/MainPreferencesFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/queue/QueueFragment.java11
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogManager.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMenuHandler.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsFilterGroup.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/share/ShareUtils.java7
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/view/ShownotesWebView.java2
-rw-r--r--app/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml (renamed from core/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml)0
-rw-r--r--app/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml (renamed from core/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml)0
-rw-r--r--app/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml (renamed from core/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml)0
-rw-r--r--app/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml (renamed from core/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml)0
-rw-r--r--app/src/main/res/drawable/ic_shortcut_feed.xml (renamed from core/src/main/res/drawable/ic_shortcut_feed.xml)0
-rw-r--r--app/src/main/res/drawable/ic_shortcut_playlist.xml (renamed from core/src/main/res/drawable/ic_shortcut_playlist.xml)0
-rw-r--r--app/src/main/res/drawable/ic_shortcut_refresh.xml (renamed from core/src/main/res/drawable/ic_shortcut_refresh.xml)0
-rw-r--r--app/src/main/res/drawable/ic_shortcut_subscriptions.xml (renamed from core/src/main/res/drawable/ic_shortcut_subscriptions.xml)0
-rw-r--r--app/src/main/res/layout/more_content_list_footer.xml (renamed from core/src/main/res/layout/more_content_list_footer.xml)0
-rw-r--r--app/src/main/res/layout/popup_bubble_view.xml (renamed from core/src/main/res/layout/popup_bubble_view.xml)0
-rw-r--r--app/src/main/res/values/ids.xml (renamed from core/src/main/res/values/ids.xml)0
-rw-r--r--core/.gitignore1
-rw-r--r--core/build.gradle65
-rw-r--r--core/lint.xml7
-rw-r--r--core/src/main/AndroidManifest.xml15
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java69
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/FeedUtil.java13
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java42
-rw-r--r--core/src/test/java/android/util/Log.java246
-rw-r--r--event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java12
-rw-r--r--event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java10
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java14
-rw-r--r--model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java14
-rw-r--r--model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemFallbackLinkTest.java (renamed from core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java)54
-rw-r--r--net/download/service/build.gradle2
-rw-r--r--net/download/service/src/main/AndroidManifest.xml1
-rw-r--r--net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java2
-rw-r--r--net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java2
-rw-r--r--net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java17
-rw-r--r--net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java8
-rw-r--r--parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java9
-rw-r--r--playback/service/build.gradle2
-rw-r--r--playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java12
-rw-r--r--playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/PlaybackServiceTaskManager.java2
-rw-r--r--scripts/makeRelease.sh2
-rw-r--r--settings.gradle2
-rw-r--r--storage/database/build.gradle1
-rw-r--r--storage/database/src/main/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesser.java (renamed from core/src/main/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesser.java)2
-rw-r--r--storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserRealWorldTest.java (renamed from core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserRealWorldTest.java)11
-rw-r--r--storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserTest.java (renamed from core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserTest.java)10
-rw-r--r--storage/database/src/test/resources/release_dates.csv (renamed from core/src/test/resources/release_dates.csv)0
-rw-r--r--[-rwxr-xr-x]storage/database/src/test/resources/release_dates.sh (renamed from core/src/test/resources/release_dates.sh)0
-rw-r--r--ui/chapters/README.md3
-rw-r--r--ui/chapters/build.gradle21
-rw-r--r--ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterMerger.java (renamed from core/src/main/java/de/danoeh/antennapod/core/util/ChapterMerger.java)2
-rw-r--r--ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterUtils.java (renamed from core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java)15
-rw-r--r--ui/common/build.gradle2
-rw-r--r--ui/common/src/main/java/de/danoeh/antennapod/ui/common/ConfirmationDialog.java (renamed from core/src/main/java/de/danoeh/antennapod/core/util/ConfirmationDialog.java)4
-rw-r--r--ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java (renamed from core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java)4
-rw-r--r--ui/common/src/main/res/drawable/bg_blue_gradient.xml (renamed from core/src/main/res/drawable/bg_blue_gradient.xml)0
-rw-r--r--ui/common/src/main/res/drawable/bg_circle.xml (renamed from core/src/main/res/drawable/bg_circle.xml)0
-rw-r--r--ui/common/src/main/res/drawable/bg_drawer_item.xml (renamed from core/src/main/res/drawable/bg_drawer_item.xml)0
-rw-r--r--ui/common/src/main/res/drawable/bg_gradient.xml (renamed from core/src/main/res/drawable/bg_gradient.xml)0
-rw-r--r--ui/common/src/main/res/drawable/bg_pill.xml (renamed from core/src/main/res/drawable/bg_pill.xml)0
-rw-r--r--ui/common/src/main/res/drawable/bg_rounded_corners.xml (renamed from core/src/main/res/drawable/bg_rounded_corners.xml)0
-rw-r--r--ui/common/website-languages.txt (renamed from ui/preferences/src/main/assets/website-languages.txt)0
-rw-r--r--ui/preferences/build.gradle1
-rw-r--r--ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java2
-rw-r--r--ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/LicensesFragment.java2
-rw-r--r--ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/downloads/DataFolderAdapter.java12
-rw-r--r--ui/preferences/src/main/res/values/arrays.xml (renamed from core/src/main/res/values/arrays.xml)0
-rw-r--r--ui/preferences/src/main/res/values/keycodes.xml (renamed from core/src/main/res/values/keycodes.xml)0
-rw-r--r--ui/statistics/build.gradle1
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java2
-rw-r--r--ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsFragment.java2
104 files changed, 223 insertions, 669 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 449488f58..b96b96677 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -62,7 +62,6 @@ android {
}
dependencies {
- implementation project(":core")
implementation project(":event")
implementation project(':model')
implementation project(':net:common')
@@ -91,6 +90,7 @@ dependencies {
implementation project(':ui:statistics')
implementation project(':net:sync:service-interface')
implementation project(':playback:service')
+ implementation project(':ui:chapters')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3d608133f..81b809c89 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,12 +4,15 @@
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
- tools:ignore="ScopedStorage" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
+ <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.VIBRATE" />
<supports-screens
android:anyDensity="true"
diff --git a/core/src/main/assets/shownotes-style.css b/app/src/main/assets/shownotes-style.css
index 01d13bc16..01d13bc16 100644
--- a/core/src/main/assets/shownotes-style.css
+++ b/app/src/main/assets/shownotes-style.css
diff --git a/app/src/main/java/de/danoeh/antennapod/actionbutton/VisitWebsiteActionButton.java b/app/src/main/java/de/danoeh/antennapod/actionbutton/VisitWebsiteActionButton.java
index dbe937c14..1c781fee0 100644
--- a/app/src/main/java/de/danoeh/antennapod/actionbutton/VisitWebsiteActionButton.java
+++ b/app/src/main/java/de/danoeh/antennapod/actionbutton/VisitWebsiteActionButton.java
@@ -6,7 +6,7 @@ import androidx.annotation.DrawableRes;
import androidx.annotation.StringRes;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.FeedItem;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
public class VisitWebsiteActionButton extends ItemActionButton {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/cleaner/ShownotesCleaner.java b/app/src/main/java/de/danoeh/antennapod/ui/cleaner/ShownotesCleaner.java
index 57f91e35c..03ce01d5e 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/cleaner/ShownotesCleaner.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/cleaner/ShownotesCleaner.java
@@ -22,7 +22,7 @@ import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.R;
import de.danoeh.antennapod.ui.common.Converter;
/**
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeItemListAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeItemListAdapter.java
index cb026240a..34f473953 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeItemListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodeItemListAdapter.java
@@ -16,7 +16,6 @@ import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.ui.SelectableAdapter;
import de.danoeh.antennapod.ui.common.ThemeUtils;
-import org.apache.commons.lang3.ArrayUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -25,7 +24,6 @@ import java.util.List;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.model.feed.FeedItem;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.screen.episode.ItemPagerFragment;
/**
@@ -90,9 +88,7 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
holder.itemView.setOnClickListener(v -> {
MainActivity activity = mainActivityRef.get();
if (activity != null && !inActionMode()) {
- long[] ids = FeedItemUtil.getIds(episodes);
- int position = ArrayUtils.indexOf(ids, item.getId());
- activity.loadChildFragment(ItemPagerFragment.newInstance(ids, position));
+ activity.loadChildFragment(ItemPagerFragment.newInstance(episodes, item));
} else {
toggleSelection(holder.getBindingAdapterPosition());
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodesListFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodesListFragment.java
index 054183f7c..90f7cf1e5 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodesListFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/EpisodesListFragment.java
@@ -36,9 +36,8 @@ import java.util.List;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.ui.MenuItemUtils;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.FeedListUpdateEvent;
@@ -334,7 +333,7 @@ public abstract class EpisodesListFragment extends Fragment
public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
for (FeedItem item : event.items) {
- int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(episodes, item.getId());
if (pos >= 0) {
episodes.remove(pos);
if (getFilter().matches(item)) {
@@ -378,7 +377,7 @@ public abstract class EpisodesListFragment extends Fragment
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(EpisodeDownloadEvent event) {
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(episodes, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(episodes, downloadUrl);
if (pos >= 0) {
listAdapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java
index 12b455d1f..55f865ef6 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/FeedItemMenuHandler.java
@@ -18,12 +18,10 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
-import de.danoeh.antennapod.core.util.FeedUtil;
import de.danoeh.antennapod.playback.service.PlaybackServiceInterface;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.storage.preferences.SynchronizationSettings;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.playback.service.PlaybackStatus;
import de.danoeh.antennapod.ui.share.ShareUtils;
import de.danoeh.antennapod.ui.share.ShareDialog;
@@ -198,7 +196,7 @@ public class FeedItemMenuHandler {
}
DBWriter.markItemPlayed(selectedItem, FeedItem.UNPLAYED, true);
} else if (menuItemId == R.id.visit_website_item) {
- IntentUtils.openInBrowser(context, FeedItemUtil.getLinkWithFallback(selectedItem));
+ IntentUtils.openInBrowser(context, selectedItem.getLinkWithFallback());
} else if (menuItemId == R.id.share_item) {
ShareDialog shareDialog = ShareDialog.newInstance(selectedItem);
shareDialog.show((fragment.getActivity().getSupportFragmentManager()), "ShareEpisodeDialog");
@@ -234,7 +232,8 @@ public class FeedItemMenuHandler {
if (media == null) {
return;
}
- boolean shouldAutoDelete = FeedUtil.shouldAutoDeleteItemsOnThatFeed(item.getFeed());
+ boolean shouldAutoDelete = UserPreferences.isAutoDelete()
+ && (!item.getFeed().isLocalFeed() || UserPreferences.isAutoDeleteLocal());
int smartMarkAsPlayedSecs = UserPreferences.getSmartMarkAsPlayedSecs();
boolean almostEnded = media.getDuration() > 0
&& media.getPosition() >= media.getDuration() - smartMarkAsPlayedSecs * 1000;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/HorizontalItemListAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/HorizontalItemListAdapter.java
index f40851ec2..d4407bf86 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/HorizontalItemListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/HorizontalItemListAdapter.java
@@ -9,10 +9,8 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.screen.episode.ItemPagerFragment;
import de.danoeh.antennapod.model.feed.FeedItem;
-import org.apache.commons.lang3.ArrayUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
@@ -68,9 +66,7 @@ public class HorizontalItemListAdapter extends RecyclerView.Adapter<HorizontalIt
holder.card.setOnClickListener(v -> {
MainActivity activity = mainActivityRef.get();
if (activity != null) {
- long[] ids = FeedItemUtil.getIds(data);
- int clickPosition = ArrayUtils.indexOf(ids, item.getId());
- activity.loadChildFragment(ItemPagerFragment.newInstance(ids, clickPosition));
+ activity.loadChildFragment(ItemPagerFragment.newInstance(data, item));
}
});
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/MoreContentListFooterUtil.java b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/MoreContentListFooterUtil.java
index fe9ce71f0..d120e5943 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/MoreContentListFooterUtil.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/episodeslist/MoreContentListFooterUtil.java
@@ -3,8 +3,7 @@ package de.danoeh.antennapod.ui.episodeslist;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
-
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.R;
/**
* Utility methods for the more_content_list_footer layout.
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/PlaybackHistoryFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/PlaybackHistoryFragment.java
index 4efdf38a3..a02f86bd2 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/PlaybackHistoryFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/PlaybackHistoryFragment.java
@@ -8,7 +8,7 @@ import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java
index 8e21117b3..85d837a51 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/SearchFragment.java
@@ -40,7 +40,6 @@ import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.ui.episodeslist.EpisodeMultiSelectActionHandler;
import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.episodeslist.FeedItemMenuHandler;
import de.danoeh.antennapod.net.discovery.CombinedSearcher;
import de.danoeh.antennapod.storage.database.DBReader;
@@ -327,7 +326,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(results, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(results, item.getId());
if (pos >= 0) {
results.remove(pos);
results.add(pos, item);
@@ -342,7 +341,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O
return;
}
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(results, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(results, downloadUrl);
if (pos >= 0) {
adapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java
index f1dcbf415..8fea6e209 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersFragment.java
@@ -19,13 +19,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.ChapterUtils;
import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
import de.danoeh.antennapod.model.feed.Chapter;
import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.playback.base.PlayerStatus;
import de.danoeh.antennapod.playback.service.PlaybackController;
+import de.danoeh.antennapod.ui.chapters.ChapterUtils;
import io.reactivex.Maybe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
@@ -130,7 +130,7 @@ public class ChaptersFragment extends AppCompatDialogFragment {
if (controller == null) {
return -1;
}
- return ChapterUtils.getCurrentChapterIndex(media, controller.getPosition());
+ return Chapter.getAfterPosition(media.getChapters(), controller.getPosition());
}
private void loadMediaInfo(boolean forceRefresh) {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersListAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersListAdapter.java
index 33e55a7e2..bf84b7bd7 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersListAdapter.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/chapter/ChaptersListAdapter.java
@@ -19,7 +19,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.Chapter;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.model.playback.Playable;
import de.danoeh.antennapod.ui.common.CircularProgressBar;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
index 15be1e230..260f3e6a0 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/CompletedDownloadsFragment.java
@@ -23,7 +23,6 @@ import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.ui.screen.SearchFragment;
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
import de.danoeh.antennapod.storage.database.DBReader;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.screen.feed.ItemSortDialog;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
@@ -209,7 +208,7 @@ public class CompletedDownloadsFragment extends Fragment
return; // Refreshed anyway
}
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(items, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(items, downloadUrl);
if (pos >= 0) {
adapter.notifyItemChangedCompat(pos);
}
@@ -249,7 +248,7 @@ public class CompletedDownloadsFragment extends Fragment
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(items, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(items, item.getId());
if (pos >= 0) {
items.remove(pos);
if (item.getMedia().isDownloaded()) {
@@ -305,7 +304,7 @@ public class CompletedDownloadsFragment extends Fragment
return downloadedItems;
}
for (String url : runningDownloads) {
- if (FeedItemUtil.indexOfItemWithDownloadUrl(downloadedItems, url) != -1) {
+ if (EpisodeDownloadEvent.indexOfItemWithDownloadUrl(downloadedItems, url) != -1) {
continue; // Already in list
}
mediaUrls.add(url);
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/DownloadErrorLabel.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/DownloadErrorLabel.java
index e5eedd54b..7940146db 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/download/DownloadErrorLabel.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/download/DownloadErrorLabel.java
@@ -1,8 +1,8 @@
package de.danoeh.antennapod.ui.screen.download;
import androidx.annotation.StringRes;
-import de.danoeh.antennapod.core.BuildConfig;
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.BuildConfig;
+import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.download.DownloadError;
/**
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java
index 98690e0cf..b6580575a 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java
@@ -55,7 +55,7 @@ import java.util.Set;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.screen.preferences.PreferenceActivity;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemPagerFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemPagerFragment.java
index 524066587..e7f345617 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemPagerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemPagerFragment.java
@@ -29,6 +29,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
+import java.util.List;
+
/**
* Displays information about a list of FeedItems.
*/
@@ -41,15 +43,21 @@ public class ItemPagerFragment extends Fragment implements MaterialToolbar.OnMen
/**
* Creates a new instance of an ItemPagerFragment.
*
- * @param feeditems The IDs of the FeedItems that belong to the same list
- * @param feedItemPos The position of the FeedItem that is currently shown
* @return The ItemFragment instance
*/
- public static ItemPagerFragment newInstance(long[] feeditems, int feedItemPos) {
+ public static ItemPagerFragment newInstance(List<FeedItem> allItems, FeedItem currentItem) {
+ int position = 0;
+ long[] ids = new long[allItems.size()];
+ for (int i = 0; i < allItems.size(); i++) {
+ ids[i] = allItems.get(i).getId();
+ if (ids[i] == currentItem.getId()) {
+ position = i;
+ }
+ }
ItemPagerFragment fragment = new ItemPagerFragment();
Bundle args = new Bundle();
- args.putLongArray(ARG_FEEDITEMS, feeditems);
- args.putInt(ARG_FEEDITEM_POS, Math.max(0, feedItemPos));
+ args.putLongArray(ARG_FEEDITEMS, ids);
+ args.putInt(ARG_FEEDITEM_POS, position);
fragment.setArguments(args);
return fragment;
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedInfoFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedInfoFragment.java
index 3e7fd3cdc..929a68fff 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedInfoFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedInfoFragment.java
@@ -37,7 +37,7 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.TransitionEffect;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.FeedDatabaseWriter;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.share.ShareUtils;
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
import de.danoeh.antennapod.model.feed.Feed;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemFilterGroup.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemFilterGroup.java
index 5cb0f36fd..b19d680da 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemFilterGroup.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemFilterGroup.java
@@ -1,6 +1,6 @@
package de.danoeh.antennapod.ui.screen.feed;
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
public enum FeedItemFilterGroup {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
index 7743f1cd9..b4a2556d1 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/FeedItemlistFragment.java
@@ -50,8 +50,7 @@ import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.storage.database.FeedItemPermutors;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.share.ShareUtils;
import de.danoeh.antennapod.ui.episodeslist.MoreContentListFooterUtil;
import de.danoeh.antennapod.databinding.FeedItemListFragmentBinding;
@@ -321,8 +320,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MainActivity activity = (MainActivity) getActivity();
- long[] ids = FeedItemUtil.getIds(feed.getItems());
- activity.loadChildFragment(ItemPagerFragment.newInstance(ids, position));
+ activity.loadChildFragment(ItemPagerFragment.newInstance(feed.getItems(), feed.getItems().get(position)));
}
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -341,7 +339,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(feed.getItems(), item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(feed.getItems(), item.getId());
if (pos >= 0) {
feed.getItems().remove(pos);
feed.getItems().add(pos, item);
@@ -356,7 +354,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
return;
}
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(feed.getItems(), downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(feed.getItems(), downloadUrl);
if (pos >= 0) {
adapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RemoveFeedDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RemoveFeedDialog.java
index 415948a81..52bb36867 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RemoveFeedDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RemoveFeedDialog.java
@@ -11,7 +11,7 @@ import java.util.Collections;
import java.util.List;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.storage.database.DBWriter;
import io.reactivex.Completable;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RenameFeedDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RenameFeedDialog.java
index 4bc63f732..a2c2caaaf 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RenameFeedDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/feed/RenameFeedDialog.java
@@ -54,8 +54,8 @@ public class RenameFeedDialog {
renameTag(newTitle);
}
})
- .setNeutralButton(de.danoeh.antennapod.core.R.string.reset, null)
- .setNegativeButton(de.danoeh.antennapod.core.R.string.cancel_label, null)
+ .setNeutralButton(R.string.reset, null)
+ .setNegativeButton(R.string.cancel_label, null)
.show();
// To prevent cancelling the dialog on button click
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java
index 451a0aedc..09f060f81 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/EpisodesSurpriseSection.java
@@ -15,7 +15,6 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.PlayerStatusEvent;
@@ -105,7 +104,7 @@ public class EpisodesSurpriseSection extends HomeSection {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(episodes, item.getId());
if (pos >= 0) {
episodes.remove(pos);
episodes.add(pos, item);
@@ -117,7 +116,7 @@ public class EpisodesSurpriseSection extends HomeSection {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(EpisodeDownloadEvent event) {
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(episodes, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(episodes, downloadUrl);
if (pos >= 0) {
listAdapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java
index de6f6bef4..d30fa85bc 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/InboxSection.java
@@ -16,7 +16,6 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.FeedListUpdateEvent;
@@ -99,7 +98,7 @@ public class InboxSection extends HomeSection {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(EpisodeDownloadEvent event) {
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(items, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(items, downloadUrl);
if (pos >= 0) {
adapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java
index 57d896ae9..790992420 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/home/sections/QueueSection.java
@@ -15,7 +15,6 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
import de.danoeh.antennapod.event.PlayerStatusEvent;
@@ -92,7 +91,7 @@ public class QueueSection extends HomeSection {
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(queue, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(queue, item.getId());
if (pos >= 0) {
queue.remove(pos);
queue.add(pos, item);
@@ -104,7 +103,7 @@ public class QueueSection extends HomeSection {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(EpisodeDownloadEvent event) {
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(queue, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(queue, downloadUrl);
if (pos >= 0) {
listAdapter.notifyItemChangedCompat(pos);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
index 42050e718..799366ecb 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/onlinefeedview/OnlineFeedViewActivity.java
@@ -54,7 +54,7 @@ import de.danoeh.antennapod.net.discovery.PodcastSearcherRegistry;
import de.danoeh.antennapod.parser.feed.FeedHandler;
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
import de.danoeh.antennapod.model.download.DownloadError;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.net.common.UrlChecker;
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/AudioPlayerFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/AudioPlayerFragment.java
index 5e1f5c818..e66ed6d3e 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/AudioPlayerFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/AudioPlayerFragment.java
@@ -27,6 +27,7 @@ import com.google.android.material.elevation.SurfaceColors;
import de.danoeh.antennapod.playback.service.PlaybackController;
import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter;
+import de.danoeh.antennapod.ui.chapters.ChapterUtils;
import de.danoeh.antennapod.ui.episodes.PlaybackSpeedUtils;
import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter;
import de.danoeh.antennapod.ui.screen.playback.MediaPlayerErrorDialog;
@@ -43,7 +44,6 @@ import java.util.List;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
-import de.danoeh.antennapod.core.util.ChapterUtils;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.ui.screen.feed.preferences.SkipPreferenceDialog;
import de.danoeh.antennapod.event.FavoritesEvent;
@@ -360,7 +360,7 @@ public class AudioPlayerFragment extends Fragment implements
int currentPosition = converter.convert(event.getPosition());
int duration = converter.convert(event.getDuration());
int remainingTime = converter.convert(Math.max(event.getDuration() - event.getPosition(), 0));
- currentChapterIndex = ChapterUtils.getCurrentChapterIndex(controller.getMedia(), currentPosition);
+ currentChapterIndex = Chapter.getAfterPosition(controller.getMedia().getChapters(), currentPosition);
Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition));
if (currentPosition == Playable.INVALID_TIME || duration == Playable.INVALID_TIME) {
Log.w(TAG, "Could not react to position observer update because of invalid time");
@@ -406,7 +406,7 @@ public class AudioPlayerFragment extends Fragment implements
float prog = progress / ((float) seekBar.getMax());
TimeSpeedConverter converter = new TimeSpeedConverter(controller.getCurrentPlaybackSpeedMultiplier());
int position = converter.convert((int) (prog * controller.getDuration()));
- int newChapterIndex = ChapterUtils.getCurrentChapterIndex(controller.getMedia(), position);
+ int newChapterIndex = Chapter.getAfterPosition(controller.getMedia().getChapters(), position);
if (newChapterIndex > -1) {
if (!sbPosition.isPressed() && currentChapterIndex != newChapterIndex) {
currentChapterIndex = newChapterIndex;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java
index 05e6f3d6c..57794b410 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/CoverFragment.java
@@ -32,7 +32,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
-import de.danoeh.antennapod.core.util.ChapterUtils;
+import de.danoeh.antennapod.ui.chapters.ChapterUtils;
import de.danoeh.antennapod.ui.screen.chapter.ChaptersFragment;
import de.danoeh.antennapod.playback.service.PlaybackController;
import de.danoeh.antennapod.ui.common.DateFormatter;
@@ -160,7 +160,7 @@ public class CoverFragment extends Fragment {
});
displayedChapterIndex = -1;
- refreshChapterData(ChapterUtils.getCurrentChapterIndex(media, media.getPosition())); //calls displayCoverImage
+ refreshChapterData(Chapter.getAfterPosition(media.getChapters(), media.getPosition()));
updateChapterControlVisibility();
}
@@ -261,7 +261,7 @@ public class CoverFragment extends Fragment {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(PlaybackPositionEvent event) {
- int newChapterIndex = ChapterUtils.getCurrentChapterIndex(media, event.getPosition());
+ int newChapterIndex = Chapter.getAfterPosition(media.getChapters(), event.getPosition());
if (newChapterIndex > -1 && newChapterIndex != displayedChapterIndex) {
refreshChapterData(newChapterIndex);
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/video/VideoplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/video/VideoplayerActivity.java
index 2a0746f54..d5289d8d2 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/video/VideoplayerActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/video/VideoplayerActivity.java
@@ -48,8 +48,7 @@ import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.ui.common.Converter;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.share.ShareUtils;
import de.danoeh.antennapod.databinding.VideoplayerActivityBinding;
import de.danoeh.antennapod.ui.share.ShareDialog;
@@ -636,7 +635,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
} else if (StringUtils.isNotBlank(media.getWebsiteLink())) {
return media.getWebsiteLink();
} else if (media instanceof FeedMedia) {
- return FeedItemUtil.getLinkWithFallback(((FeedMedia) media).getItem());
+ return (((FeedMedia) media).getItem()).getLinkWithFallback();
}
return null;
}
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/BugReportActivity.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/BugReportActivity.java
index b4a5218ee..5e9de4703 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/BugReportActivity.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/BugReportActivity.java
@@ -25,7 +25,7 @@ import de.danoeh.antennapod.ui.common.ThemeSwitcher;
import de.danoeh.antennapod.CrashReportWriter;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import org.apache.commons.io.IOUtils;
import java.io.File;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/MainPreferencesFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/MainPreferencesFragment.java
index 40a9dd605..7c036974b 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/MainPreferencesFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/preferences/MainPreferencesFragment.java
@@ -13,7 +13,7 @@ import com.bytehamster.lib.preferencesearch.SearchConfiguration;
import com.bytehamster.lib.preferencesearch.SearchPreference;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.preferences.screen.about.AboutFragment;
public class MainPreferencesFragment extends PreferenceFragmentCompat {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/queue/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/queue/QueueFragment.java
index 31fedda1d..471d4f17d 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/queue/QueueFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/queue/QueueFragment.java
@@ -40,12 +40,11 @@ import java.util.List;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.ui.common.Converter;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.screen.feed.ItemSortDialog;
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
import de.danoeh.antennapod.event.FeedItemEvent;
@@ -150,7 +149,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
break;
case REMOVED:
case IRREVERSIBLE_REMOVED:
- int position = FeedItemUtil.indexOfItemWithId(queue, event.item.getId());
+ int position = FeedItemEvent.indexOfItemWithId(queue, event.item.getId());
queue.remove(position);
recyclerAdapter.notifyItemRemoved(position);
break;
@@ -178,7 +177,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
- int pos = FeedItemUtil.indexOfItemWithId(queue, item.getId());
+ int pos = FeedItemEvent.indexOfItemWithId(queue, item.getId());
if (pos >= 0) {
queue.remove(pos);
queue.add(pos, item);
@@ -194,7 +193,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
return;
}
for (String downloadUrl : event.getUrls()) {
- int pos = FeedItemUtil.indexOfItemWithDownloadUrl(queue, downloadUrl);
+ int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(queue, downloadUrl);
if (pos >= 0) {
recyclerAdapter.notifyItemChangedCompat(pos);
}
@@ -357,7 +356,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
return super.onContextItemSelected(item);
}
- int position = FeedItemUtil.indexOfItemWithId(queue, selectedItem.getId());
+ int position = FeedItemEvent.indexOfItemWithId(queue, selectedItem.getId());
if (position < 0) {
Log.i(TAG, "Selected item no longer exist, ignoring selection");
return super.onContextItemSelected(item);
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogFragment.java
index 9adf885b1..f0dedb13e 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogFragment.java
@@ -12,7 +12,7 @@ import androidx.core.text.HtmlCompat;
import androidx.fragment.app.DialogFragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.databinding.RatingDialogBinding;
import de.danoeh.antennapod.ui.common.DateFormatter;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogManager.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogManager.java
index edba0ec83..89a984e42 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogManager.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/rating/RatingDialogManager.java
@@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit;
import android.util.Log;
import androidx.fragment.app.FragmentActivity;
-import de.danoeh.antennapod.core.BuildConfig;
+import de.danoeh.antennapod.BuildConfig;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.StatisticsItem;
import io.reactivex.Observable;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMenuHandler.java
index e1e9f2287..f5761020c 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMenuHandler.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/FeedMenuHandler.java
@@ -7,7 +7,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.R;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.ui.screen.feed.RemoveFeedDialog;
import de.danoeh.antennapod.ui.screen.feed.RenameFeedDialog;
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsFilterGroup.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsFilterGroup.java
index 41dce16f0..d952d610f 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsFilterGroup.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsFilterGroup.java
@@ -1,6 +1,6 @@
package de.danoeh.antennapod.ui.screen.subscriptions;
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.R;
public enum SubscriptionsFilterGroup {
COUNTER_GREATER_ZERO(new ItemProperties(R.string.subscriptions_counter_greater_zero, "counter_greater_zero")),
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/share/ShareUtils.java b/app/src/main/java/de/danoeh/antennapod/ui/share/ShareUtils.java
index 77d5f4305..7b685f8bc 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/share/ShareUtils.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/share/ShareUtils.java
@@ -9,12 +9,11 @@ import androidx.annotation.NonNull;
import androidx.core.app.ShareCompat;
import androidx.core.content.FileProvider;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.ui.common.Converter;
import java.io.File;
import java.net.URLEncoder;
-import de.danoeh.antennapod.core.R;
+import de.danoeh.antennapod.R;
import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia;
@@ -46,7 +45,7 @@ public class ShareUtils {
}
public static boolean hasLinkToShare(FeedItem item) {
- return FeedItemUtil.getLinkWithFallback(item) != null;
+ return item.getLinkWithFallback() != null;
}
public static void shareMediaDownloadLink(Context context, FeedMedia media) {
@@ -64,7 +63,7 @@ public class ShareUtils {
if (hasLinkToShare(item)) {
text += "\n\n" + context.getResources().getString(R.string.share_dialog_episode_website_label) + ": ";
- text += FeedItemUtil.getLinkWithFallback(item);
+ text += item.getLinkWithFallback();
}
if (item.getMedia() != null && item.getMedia().getDownloadUrl() != null) {
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/view/ShownotesWebView.java b/app/src/main/java/de/danoeh/antennapod/ui/view/ShownotesWebView.java
index 67a659418..ae8654e83 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/view/ShownotesWebView.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/view/ShownotesWebView.java
@@ -26,7 +26,7 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.ui.MenuItemUtils;
import de.danoeh.antennapod.ui.common.Converter;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.ui.share.ShareUtils;
import de.danoeh.antennapod.ui.cleaner.ShownotesCleaner;
diff --git a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml
index ae080d335..ae080d335 100644
--- a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml
+++ b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_feed.xml
diff --git a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml
index 5d3ce4954..5d3ce4954 100644
--- a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml
+++ b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_playlist.xml
diff --git a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml
index 1a7752443..1a7752443 100644
--- a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml
+++ b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_refresh.xml
diff --git a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml
index 10f437917..10f437917 100644
--- a/core/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml
+++ b/app/src/main/res/drawable-anydpi-v26/ic_shortcut_subscriptions.xml
diff --git a/core/src/main/res/drawable/ic_shortcut_feed.xml b/app/src/main/res/drawable/ic_shortcut_feed.xml
index fa5a0267c..fa5a0267c 100644
--- a/core/src/main/res/drawable/ic_shortcut_feed.xml
+++ b/app/src/main/res/drawable/ic_shortcut_feed.xml
diff --git a/core/src/main/res/drawable/ic_shortcut_playlist.xml b/app/src/main/res/drawable/ic_shortcut_playlist.xml
index 8d01f24a3..8d01f24a3 100644
--- a/core/src/main/res/drawable/ic_shortcut_playlist.xml
+++ b/app/src/main/res/drawable/ic_shortcut_playlist.xml
diff --git a/core/src/main/res/drawable/ic_shortcut_refresh.xml b/app/src/main/res/drawable/ic_shortcut_refresh.xml
index 2f1b37337..2f1b37337 100644
--- a/core/src/main/res/drawable/ic_shortcut_refresh.xml
+++ b/app/src/main/res/drawable/ic_shortcut_refresh.xml
diff --git a/core/src/main/res/drawable/ic_shortcut_subscriptions.xml b/app/src/main/res/drawable/ic_shortcut_subscriptions.xml
index b932aebaf..b932aebaf 100644
--- a/core/src/main/res/drawable/ic_shortcut_subscriptions.xml
+++ b/app/src/main/res/drawable/ic_shortcut_subscriptions.xml
diff --git a/core/src/main/res/layout/more_content_list_footer.xml b/app/src/main/res/layout/more_content_list_footer.xml
index a3fcd5489..a3fcd5489 100644
--- a/core/src/main/res/layout/more_content_list_footer.xml
+++ b/app/src/main/res/layout/more_content_list_footer.xml
diff --git a/core/src/main/res/layout/popup_bubble_view.xml b/app/src/main/res/layout/popup_bubble_view.xml
index 7dee08eb5..7dee08eb5 100644
--- a/core/src/main/res/layout/popup_bubble_view.xml
+++ b/app/src/main/res/layout/popup_bubble_view.xml
diff --git a/core/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml
index 8c4091390..8c4091390 100644
--- a/core/src/main/res/values/ids.xml
+++ b/app/src/main/res/values/ids.xml
diff --git a/core/.gitignore b/core/.gitignore
deleted file mode 100644
index 796b96d1c..000000000
--- a/core/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/core/build.gradle b/core/build.gradle
deleted file mode 100644
index ad0ad1e3b..000000000
--- a/core/build.gradle
+++ /dev/null
@@ -1,65 +0,0 @@
-plugins {
- id("com.android.library")
-}
-apply from: "../common.gradle"
-apply from: "../playFlavor.gradle"
-
-android {
- namespace "de.danoeh.antennapod.core"
-
- lint {
- disable "InvalidPeriodicWorkRequestInterval", "ObsoleteLintCustomCheck", "DefaultLocale", "UnusedAttribute",
- "ParcelClassLoader", "CheckResult", "TrustAllX509TrustManager",
- "StaticFieldLeak", "IconDensities", "IconDuplicates", "UnsafeOptInUsageError"
- }
-
- defaultConfig {
- javaCompileOptions {
- annotationProcessorOptions {
- arguments = [eventBusIndex: 'de.danoeh.antennapod.core.ApCoreEventBusIndex']
- }
- }
- }
-}
-
-dependencies {
- implementation project(':model')
- implementation project(':net:common')
- implementation project(':net:download:service-interface')
- implementation project(':parser:feed')
- implementation project(':parser:media')
- implementation project(':storage:preferences')
- implementation project(':storage:database')
- implementation project(':ui:common')
-
- annotationProcessor "androidx.annotation:annotation:$annotationVersion"
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
- implementation "androidx.core:core:$coreVersion"
- implementation 'androidx.documentfile:documentfile:1.0.1'
- implementation "androidx.fragment:fragment:$fragmentVersion"
- implementation "androidx.preference:preference:$preferenceVersion"
- implementation "androidx.work:work-runtime:$workManagerVersion"
- implementation "com.google.android.material:material:$googleMaterialVersion"
-
- implementation "org.apache.commons:commons-lang3:$commonslangVersion"
- implementation "commons-io:commons-io:$commonsioVersion"
- implementation "org.jsoup:jsoup:$jsoupVersion"
- implementation "com.github.bumptech.glide:glide:$glideVersion"
- implementation "com.github.bumptech.glide:okhttp3-integration:$glideVersion@aar"
- implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
- implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttpVersion"
- implementation "org.greenrobot:eventbus:$eventbusVersion"
- annotationProcessor "org.greenrobot:eventbus-annotation-processor:$eventbusVersion"
- implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
- implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
-
- testImplementation "androidx.test:core:$testCoreVersion"
- testImplementation "org.awaitility:awaitility:$awaitilityVersion"
- testImplementation "junit:junit:$junitVersion"
- testImplementation "org.mockito:mockito-core:$mockitoVersion"
- testImplementation "org.robolectric:robolectric:$robolectricVersion"
- testImplementation 'javax.inject:javax.inject:1'
- androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
- androidTestImplementation "androidx.test:runner:$runnerVersion"
- androidTestImplementation "androidx.test:rules:$rulesVersion"
-}
diff --git a/core/lint.xml b/core/lint.xml
deleted file mode 100644
index f3cb24810..000000000
--- a/core/lint.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<lint>
- <issue id="VectorPath">
- <ignore path="res/drawable/ic_settings.xml" />
- <ignore path="res/drawable/ic_settings_white.xml" />
- </issue>
-</lint>
diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml
deleted file mode 100644
index 73c47d636..000000000
--- a/core/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools">
-
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
- tools:ignore="ScopedStorage" />
- <uses-permission android:name="android.permission.WAKE_LOCK" />
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
- <uses-permission android:name="android.permission.BLUETOOTH" />
- <uses-permission android:name="android.permission.VIBRATE" />
- <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
-
-</manifest>
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
deleted file mode 100644
index db8a33576..000000000
--- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package de.danoeh.antennapod.core.util;
-
-import androidx.annotation.NonNull;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import de.danoeh.antennapod.model.feed.FeedItem;
-
-public class FeedItemUtil {
- private FeedItemUtil(){}
-
- public static int indexOfItemWithId(List<FeedItem> items, long id) {
- for(int i=0; i < items.size(); i++) {
- FeedItem item = items.get(i);
- if(item != null && item.getId() == id) {
- return i;
- }
- }
- return -1;
- }
-
- public static int indexOfItemWithDownloadUrl(List<FeedItem> items, String downloadUrl) {
- for (int i = 0; i < items.size(); i++) {
- FeedItem item = items.get(i);
- if (item != null && item.getMedia() != null && item.getMedia().getDownloadUrl().equals(downloadUrl)) {
- return i;
- }
- }
- return -1;
- }
-
- public static long[] getIds(List<FeedItem> items) {
- if(items == null || items.size() == 0) {
- return new long[0];
- }
- long[] result = new long[items.size()];
- for(int i=0; i < items.size(); i++) {
- result[i] = items.get(i).getId();
- }
- return result;
- }
-
- @NonNull
- public static List<Long> getIdList(List<? extends FeedItem> items) {
- List<Long> result = new ArrayList<>();
- for (FeedItem item : items) {
- result.add(item.getId());
- }
- return result;
- }
-
- /**
- * Get the link for the feed item for the purpose of Share. It fallbacks to
- * use the feed's link if the named feed item has no link.
- */
- public static String getLinkWithFallback(FeedItem item) {
- if (item == null) {
- return null;
- } else if (StringUtils.isNotBlank(item.getLink())) {
- return item.getLink();
- } else if (StringUtils.isNotBlank(item.getFeed().getLink())) {
- return item.getFeed().getLink();
- }
- return null;
- }
-}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedUtil.java
deleted file mode 100644
index 201207816..000000000
--- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedUtil.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package de.danoeh.antennapod.core.util;
-
-import de.danoeh.antennapod.model.feed.Feed;
-import de.danoeh.antennapod.storage.preferences.UserPreferences;
-
-public abstract class FeedUtil {
- public static boolean shouldAutoDeleteItemsOnThatFeed(Feed feed) {
- if (!UserPreferences.isAutoDelete()) {
- return false;
- }
- return !feed.isLocalFeed() || UserPreferences.isAutoDeleteLocal();
- }
-}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java
deleted file mode 100644
index eed9fcf37..000000000
--- a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package de.danoeh.antennapod.core.util;
-
-import android.os.StatFs;
-import de.danoeh.antennapod.storage.preferences.UserPreferences;
-
-import java.io.File;
-
-/**
- * Utility functions for handling storage errors
- */
-public class StorageUtils {
- private StorageUtils(){}
-
- /**
- * Get the number of free bytes that are available on the external storage.
- */
- public static long getFreeSpaceAvailable() {
- File dataFolder = UserPreferences.getDataFolder(null);
- if (dataFolder != null) {
- return getFreeSpaceAvailable(dataFolder.getAbsolutePath());
- } else {
- return 0;
- }
- }
-
- /**
- * Get the number of free bytes that are available on the external storage.
- */
- public static long getFreeSpaceAvailable(String path) {
- StatFs stat = new StatFs(path);
- long availableBlocks = stat.getAvailableBlocksLong();
- long blockSize = stat.getBlockSizeLong();
- return availableBlocks * blockSize;
- }
-
- public static long getTotalSpaceAvailable(String path) {
- StatFs stat = new StatFs(path);
- long blockCount = stat.getBlockCountLong();
- long blockSize = stat.getBlockSizeLong();
- return blockCount * blockSize;
- }
-}
diff --git a/core/src/test/java/android/util/Log.java b/core/src/test/java/android/util/Log.java
deleted file mode 100644
index a65bc80fa..000000000
--- a/core/src/test/java/android/util/Log.java
+++ /dev/null
@@ -1,246 +0,0 @@
-package android.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * A stub for {@link android.util.Log} to be used in unit tests.
- *
- * It outputs the log statements to standard error.
- */
-public final class Log {
-
- /**
- * Priority constant for the println method; use Log.v.
- */
- public static final int VERBOSE = 2;
-
- /**
- * Priority constant for the println method; use Log.d.
- */
- public static final int DEBUG = 3;
-
- /**
- * Priority constant for the println method; use Log.i.
- */
- public static final int INFO = 4;
-
- /**
- * Priority constant for the println method; use Log.w.
- */
- public static final int WARN = 5;
-
- /**
- * Priority constant for the println method; use Log.e.
- */
- public static final int ERROR = 6;
-
- /**
- * Priority constant for the println method.
- */
- public static final int ASSERT = 7;
-
- private Log() {
- }
-
- /**
- * Send a {@link #VERBOSE} log message.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- */
- public static int v(String tag, String msg) {
- return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);
- }
-
- /**
- * Send a {@link #VERBOSE} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- * @param tr An exception to log
- */
- public static int v(String tag, String msg, Throwable tr) {
- return printlns(LOG_ID_MAIN, VERBOSE, tag, msg, tr);
- }
-
- /**
- * Send a {@link #DEBUG} log message.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- */
- public static int d(String tag, String msg) {
- return println_native(LOG_ID_MAIN, DEBUG, tag, msg);
- }
-
- /**
- * Send a {@link #DEBUG} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- * @param tr An exception to log
- */
- public static int d(String tag, String msg, Throwable tr) {
- return printlns(LOG_ID_MAIN, DEBUG, tag, msg, tr);
- }
-
- /**
- * Send an {@link #INFO} log message.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- */
- public static int i(String tag, String msg) {
- return println_native(LOG_ID_MAIN, INFO, tag, msg);
- }
-
- /**
- * Send a {@link #INFO} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- * @param tr An exception to log
- */
- public static int i(String tag, String msg, Throwable tr) {
- return printlns(LOG_ID_MAIN, INFO, tag, msg, tr);
- }
-
- /**
- * Send a {@link #WARN} log message.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- */
- public static int w(String tag, String msg) {
- return println_native(LOG_ID_MAIN, WARN, tag, msg);
- }
-
- /**
- * Send a {@link #WARN} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- * @param tr An exception to log
- */
- public static int w(String tag, String msg, Throwable tr) {
- return printlns(LOG_ID_MAIN, WARN, tag, msg, tr);
- }
-
- /**
- * Checks to see whether or not a log for the specified tag is loggable at the specified level.
- *
- * @return true in all cases (for unit test environment)
- */
- public static boolean isLoggable(String tag, int level) {
- return true;
- }
-
- /*
- * Send a {@link #WARN} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param tr An exception to log
- */
- public static int w(String tag, Throwable tr) {
- return printlns(LOG_ID_MAIN, WARN, tag, "", tr);
- }
-
- /**
- * Send an {@link #ERROR} log message.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- */
- public static int e(String tag, String msg) {
- return println_native(LOG_ID_MAIN, ERROR, tag, msg);
- }
-
- /**
- * Send a {@link #ERROR} log message and log the exception.
- * @param tag Used to identify the source of a log message. It usually identifies
- * the class or activity where the log call occurs.
- * @param msg The message you would like logged.
- * @param tr An exception to log
- */
- public static int e(String tag, String msg, Throwable tr) {
- return printlns(LOG_ID_MAIN, ERROR, tag, msg, tr);
- }
-
- /**
- * What a Terrible Failure: Report a condition that should never happen.
- * The error will always be logged at level ASSERT with the call stack.
- * Depending on system configuration, a report may be added to the
- * {@link android.os.DropBoxManager} and/or the process may be terminated
- * immediately with an error dialog.
- * @param tag Used to identify the source of a log message.
- * @param msg The message you would like logged.
- */
- public static int wtf(String tag, String msg) {
- return wtf(LOG_ID_MAIN, tag, msg, null, false, false);
- }
-
- /**
- * Like {@link #wtf(String, String)}, but also writes to the log the full
- * call stack.
- * @hide
- */
- public static int wtfStack(String tag, String msg) {
- return wtf(LOG_ID_MAIN, tag, msg, null, true, false);
- }
-
- /**
- * What a Terrible Failure: Report an exception that should never happen.
- * Similar to {@link #wtf(String, String)}, with an exception to log.
- * @param tag Used to identify the source of a log message.
- * @param tr An exception to log.
- */
- public static int wtf(String tag, Throwable tr) {
- return wtf(LOG_ID_MAIN, tag, tr.getMessage(), tr, false, false);
- }
-
- /**
- * What a Terrible Failure: Report an exception that should never happen.
- * Similar to {@link #wtf(String, Throwable)}, with a message as well.
- * @param tag Used to identify the source of a log message.
- * @param msg The message you would like logged.
- * @param tr An exception to log. May be null.
- */
- public static int wtf(String tag, String msg, Throwable tr) {
- return wtf(LOG_ID_MAIN, tag, msg, tr, false, false);
- }
-
- /**
- * Priority Constant for wtf.
- * Added for this custom Log implementation, not in android sources.
- */
- private static final int WTF = 8;
-
- static int wtf(int logId, String tag, String msg, Throwable tr, boolean localStack,
- boolean system) {
- return printlns(LOG_ID_MAIN, WTF, tag, msg, tr);
- }
-
- private static final int LOG_ID_MAIN = 0;
-
- private static final String[] PRIORITY_ABBREV = { "0", "1", "V", "D", "I", "W", "E", "A", "WTF" };
-
- private static int println_native(int bufID, int priority, String tag, String msg) {
- String res = PRIORITY_ABBREV[priority] + "/" + tag + " " + msg + System.lineSeparator();
- System.err.print(res);
- return res.length();
- }
-
- private static int printlns(int bufID, int priority, String tag, String msg,
- Throwable tr) {
- StringWriter trSW = new StringWriter();
- if (tr != null) {
- trSW.append(" , Exception: ");
- PrintWriter trPW = new PrintWriter(trSW);
- tr.printStackTrace(trPW);
- trPW.flush();
- }
- return println_native(bufID, priority, tag, msg + trSW.toString());
- }
-
-}
diff --git a/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java b/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java
index c9790d18a..28cbc234c 100644
--- a/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java
+++ b/event/src/main/java/de/danoeh/antennapod/event/EpisodeDownloadEvent.java
@@ -1,7 +1,9 @@
package de.danoeh.antennapod.event;
import de.danoeh.antennapod.model.download.DownloadStatus;
+import de.danoeh.antennapod.model.feed.FeedItem;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -15,4 +17,14 @@ public class EpisodeDownloadEvent {
public Set<String> getUrls() {
return map.keySet();
}
+
+ public static int indexOfItemWithDownloadUrl(List<FeedItem> items, String downloadUrl) {
+ for (int i = 0; i < items.size(); i++) {
+ FeedItem item = items.get(i);
+ if (item != null && item.getMedia() != null && item.getMedia().getDownloadUrl().equals(downloadUrl)) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
diff --git a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java
index 125d113d6..e21764971 100644
--- a/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java
+++ b/event/src/main/java/de/danoeh/antennapod/event/FeedItemEvent.java
@@ -22,4 +22,14 @@ public class FeedItemEvent {
public static FeedItemEvent updated(FeedItem... items) {
return new FeedItemEvent(Arrays.asList(items));
}
+
+ public static int indexOfItemWithId(List<FeedItem> items, long id) {
+ for (int i = 0; i < items.size(); i++) {
+ FeedItem item = items.get(i);
+ if (item != null && item.getId() == id) {
+ return i;
+ }
+ }
+ return -1;
+ }
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java b/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
index 3f4116f9c..3683a2a44 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/Chapter.java
@@ -1,5 +1,7 @@
package de.danoeh.antennapod.model.feed;
+import java.util.List;
+
public class Chapter {
private long id;
/** Defines starting point in milliseconds. */
@@ -74,4 +76,16 @@ public class Chapter {
public void setId(long id) {
this.id = id;
}
+
+ public static int getAfterPosition(List<Chapter> chapters, int playbackPosition) {
+ if (chapters == null || chapters.isEmpty()) {
+ return -1;
+ }
+ for (int i = 0; i < chapters.size(); i++) {
+ if (chapters.get(i).getStart() > playbackPosition) {
+ return i - 1;
+ }
+ }
+ return chapters.size() - 1;
+ }
}
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
index 9cc71eb1d..df4cc8f9c 100644
--- a/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
+++ b/model/src/main/java/de/danoeh/antennapod/model/feed/FeedItem.java
@@ -3,6 +3,7 @@ package de.danoeh.antennapod.model.feed;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -205,6 +206,19 @@ public class FeedItem implements Serializable {
return link;
}
+ /**
+ * Get the link for the feed item for the purpose of Share.
+ * It falls backs to the feed's link if the item has no link.
+ */
+ public String getLinkWithFallback() {
+ if (StringUtils.isNotBlank(link)) {
+ return link;
+ } else if (StringUtils.isNotBlank(getFeed().getLink())) {
+ return getFeed().getLink();
+ }
+ return null;
+ }
+
public void setLink(String link) {
this.link = link;
}
diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemFallbackLinkTest.java
index df9617ab4..c0ea222e4 100644
--- a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java
+++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemFallbackLinkTest.java
@@ -1,23 +1,18 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.model.feed;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.List;
-
-import de.danoeh.antennapod.model.feed.Feed;
-import de.danoeh.antennapod.model.feed.FeedItem;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
-public class FeedItemUtilTest {
+public class FeedItemFallbackLinkTest {
private static final String FEED_LINK = "http://example.com";
private static final String ITEM_LINK = "http://example.com/feedItem1";
@@ -39,57 +34,16 @@ public class FeedItemUtilTest {
});
}
- public FeedItemUtilTest(String msg, String feedLink, String itemLink, String expected) {
+ public FeedItemFallbackLinkTest(String msg, String feedLink, String itemLink, String expected) {
this.msg = msg;
this.feedLink = feedLink;
this.itemLink = itemLink;
this.expected = expected;
}
-
- // Test the getIds() method
- @Test
- public void testGetIds() {
- List<FeedItem> feedItemsList = new ArrayList<FeedItem>(5);
- List<Integer> idList = new ArrayList<Integer>();
-
- idList.add(980);
- idList.add(324);
- idList.add(226);
- idList.add(164);
- idList.add(854);
-
- for (int i = 0; i < 5; i++) {
- FeedItem item = createFeedItem(feedLink, itemLink);
- item.setId(idList.get(i));
- feedItemsList.add(item);
- }
-
- long[] actual = FeedItemUtil.getIds(feedItemsList);
-
- // covers edge case for getIds() method
- List<FeedItem> emptyList = new ArrayList<FeedItem>();
- long[] testEmptyList = FeedItemUtil.getIds(emptyList);
- assertEquals(msg, 0, testEmptyList.length);
- assertEquals(msg, 980, actual[0]);
- assertEquals(msg, 324, actual[1]);
- assertEquals(msg, 226, actual[2]);
- assertEquals(msg, 164, actual[3]);
- assertEquals(msg, 854, actual[4]);
-
- }
-
- // Tests the Null value for getLinkWithFallback() method
- @Test
- public void testLinkWithFallbackNullValue() {
- String actual = FeedItemUtil.getLinkWithFallback(null);
- assertEquals(msg, null, actual);
- }
-
-
@Test
public void testLinkWithFallback() {
- String actual = FeedItemUtil.getLinkWithFallback(createFeedItem(feedLink, itemLink));
+ String actual = createFeedItem(feedLink, itemLink).getLinkWithFallback();
assertEquals(msg, expected, actual);
}
diff --git a/net/download/service/build.gradle b/net/download/service/build.gradle
index 789fb3aef..f74550c05 100644
--- a/net/download/service/build.gradle
+++ b/net/download/service/build.gradle
@@ -10,7 +10,6 @@ android {
}
dependencies {
- implementation project(":core")
implementation project(':event')
implementation project(':model')
implementation project(':net:common')
@@ -23,6 +22,7 @@ dependencies {
implementation project(':ui:notifications')
implementation project(':storage:preferences')
implementation project(':ui:app-start-intent')
+ implementation project(':ui:chapters')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.core:core:$coreVersion"
diff --git a/net/download/service/src/main/AndroidManifest.xml b/net/download/service/src/main/AndroidManifest.xml
index 89b6823e5..0a1400010 100644
--- a/net/download/service/src/main/AndroidManifest.xml
+++ b/net/download/service/src/main/AndroidManifest.xml
@@ -7,7 +7,6 @@
<application
android:allowBackup="true"
- android:icon="@mipmap/ic_launcher"
android:supportsRtl="true">
<receiver android:name=".feed.FeedUpdateReceiver"
diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java
index dd930c62f..6ed16aa80 100644
--- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java
+++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/MediaDownloadedHandler.java
@@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import de.danoeh.antennapod.model.MediaMetadataRetrieverCompat;
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
+import de.danoeh.antennapod.ui.chapters.ChapterUtils;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
@@ -19,7 +20,6 @@ import de.danoeh.antennapod.model.download.DownloadRequest;
import de.danoeh.antennapod.model.download.DownloadResult;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
-import de.danoeh.antennapod.core.util.ChapterUtils;
import de.danoeh.antennapod.model.download.DownloadError;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia;
diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java
index ae9b25564..2ce5f7006 100644
--- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java
+++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/FeedUpdateManagerImpl.java
@@ -14,10 +14,10 @@ import androidx.work.OutOfQuotaPolicy;
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-import de.danoeh.antennapod.core.R;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.model.feed.Feed;
+import de.danoeh.antennapod.net.download.service.R;
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
import org.greenrobot.eventbus.EventBus;
diff --git a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java
index f3c3e657c..2e983d88e 100644
--- a/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java
+++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/feed/remote/HttpDownloader.java
@@ -1,5 +1,6 @@
package de.danoeh.antennapod.net.download.service.feed.remote;
+import android.os.StatFs;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
@@ -9,6 +10,7 @@ import de.danoeh.antennapod.model.download.DownloadResult;
import de.danoeh.antennapod.model.download.DownloadRequest;
import de.danoeh.antennapod.net.common.AntennapodHttpClient;
import de.danoeh.antennapod.net.download.service.R;
+import de.danoeh.antennapod.storage.preferences.UserPreferences;
import okhttp3.CacheControl;
import okhttp3.internal.http.StatusLine;
import org.apache.commons.io.IOUtils;
@@ -30,7 +32,6 @@ import java.util.Locale;
import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.parser.feed.util.DateUtils;
import de.danoeh.antennapod.model.download.DownloadError;
-import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.net.common.UriUtil;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
@@ -148,7 +149,7 @@ public class HttpDownloader extends Downloader {
request.setSize(DownloadResult.SIZE_UNKNOWN);
}
- long freeSpace = StorageUtils.getFreeSpaceAvailable();
+ long freeSpace = getFreeSpaceAvailable();
Log.d(TAG, "Free space is " + freeSpace);
if (request.getSize() != DownloadResult.SIZE_UNKNOWN && request.getSize() > freeSpace) {
onFail(DownloadError.ERROR_NOT_ENOUGH_SPACE, null);
@@ -297,6 +298,18 @@ public class HttpDownloader extends Downloader {
}
}
+ private static long getFreeSpaceAvailable() {
+ File dataFolder = UserPreferences.getDataFolder(null);
+ if (dataFolder != null) {
+ StatFs stat = new StatFs(dataFolder.getAbsolutePath());
+ long availableBlocks = stat.getAvailableBlocksLong();
+ long blockSize = stat.getBlockSizeLong();
+ return availableBlocks * blockSize;
+ } else {
+ return 0;
+ }
+ }
+
private void onSuccess() {
Log.d(TAG, "Download was successful");
result.setSuccessful();
diff --git a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java
index 38d3e5dd0..ccb822a91 100644
--- a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java
+++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java
@@ -36,7 +36,6 @@ import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedMedia;
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -610,17 +609,12 @@ public class DbWriterTest {
Cursor cursor = adapter.getQueueIDCursor();
assertTrue(cursor.moveToFirst());
assertEquals(numItems, cursor.getCount());
- List<Long> expectedIds;
- expectedIds = FeedItemUtil.getIdList(feed.getItems());
- List<Long> actualIds = new ArrayList<>();
for (int i = 0; i < numItems; i++) {
assertTrue(cursor.moveToPosition(i));
- actualIds.add(cursor.getLong(0));
+ assertEquals(feed.getItems().get(i).getId(), cursor.getLong(0));
}
cursor.close();
adapter.close();
- assertEquals("Bulk add to queue: result order should be the same as the order given",
- expectedIds, actualIds);
}
@Test
diff --git a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
index 4d9f68905..dbddb44b0 100644
--- a/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
+++ b/parser/feed/src/main/java/de/danoeh/antennapod/parser/feed/util/DateUtils.java
@@ -1,7 +1,5 @@
package de.danoeh.antennapod.parser.feed.util;
-import android.util.Log;
-
import androidx.annotation.Nullable;
import org.apache.commons.lang3.StringUtils;
@@ -16,7 +14,6 @@ import java.util.TimeZone;
* Parses several date formats.
*/
public abstract class DateUtils {
- private static final String TAG = "DateUtils";
private static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
private static final ThreadLocal<SimpleDateFormat> RFC822_DATE_FORMAT = new ThreadLocal<>() {
@Override
@@ -117,8 +114,8 @@ public abstract class DateUtils {
if (result != null && pos.getIndex() == date.length()) {
return result;
}
- } catch (Exception e) {
- Log.e(TAG, Log.getStackTraceString(e));
+ } catch (Exception ignored) {
+ // Ignore
}
}
@@ -127,7 +124,7 @@ public abstract class DateUtils {
return parse(date.substring(date.indexOf(',') + 1));
}
- Log.d(TAG, "Could not parse date string \"" + input + "\" [" + date + "]");
+ System.out.println("Could not parse date string \"" + input + "\" [" + date + "]");
return null;
}
diff --git a/playback/service/build.gradle b/playback/service/build.gradle
index b8c47df8e..219565696 100644
--- a/playback/service/build.gradle
+++ b/playback/service/build.gradle
@@ -9,7 +9,6 @@ android {
}
dependencies {
- implementation project(':core')
implementation project(':event')
implementation project(':model')
implementation project(':net:common')
@@ -24,6 +23,7 @@ dependencies {
implementation project(':ui:i18n')
implementation project(':ui:notifications')
implementation project(':ui:widget')
+ implementation project(':ui:chapters')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.core:core:$coreVersion"
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
index dfcb67e51..8932a36d2 100644
--- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
+++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/PlaybackService.java
@@ -77,9 +77,7 @@ import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.playback.service.internal.PlaybackServiceTaskManager.SleepTimer;
-import de.danoeh.antennapod.core.util.ChapterUtils;
-import de.danoeh.antennapod.core.util.FeedUtil;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.event.PlayerErrorEvent;
@@ -1147,9 +1145,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
// Delete episode if enabled
FeedPreferences.AutoDeleteAction action =
item.getFeed().getPreferences().getCurrentAutoDelete();
+ boolean autoDeleteEnabledGlobally = UserPreferences.isAutoDelete()
+ && (!item.getFeed().isLocalFeed() || UserPreferences.isAutoDeleteLocal());
boolean shouldAutoDelete = action == FeedPreferences.AutoDeleteAction.ALWAYS
- || (action == FeedPreferences.AutoDeleteAction.GLOBAL
- && FeedUtil.shouldAutoDeleteItemsOnThatFeed(item.getFeed()));
+ || (action == FeedPreferences.AutoDeleteAction.GLOBAL && autoDeleteEnabledGlobally);
if (shouldAutoDelete && (!item.isTagged(FeedItem.TAG_FAVORITE)
|| !UserPreferences.shouldFavoriteKeepEpisode())) {
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media);
@@ -1889,8 +1888,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
return;
}
- int nextChapter = ChapterUtils.getCurrentChapterIndex(
- mediaPlayer.getPlayable(), mediaPlayer.getPosition()) + 1;
+ int nextChapter = Chapter.getAfterPosition(chapters, mediaPlayer.getPosition()) + 1;
if (chapters.size() < nextChapter + 1) {
// We are on the last chapter, just fallback to the next episode
diff --git a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/PlaybackServiceTaskManager.java b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/PlaybackServiceTaskManager.java
index 71e68c873..e21499bba 100644
--- a/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/PlaybackServiceTaskManager.java
+++ b/playback/service/src/main/java/de/danoeh/antennapod/playback/service/internal/PlaybackServiceTaskManager.java
@@ -9,7 +9,7 @@ import android.util.Log;
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
-import de.danoeh.antennapod.core.util.ChapterUtils;
+import de.danoeh.antennapod.ui.chapters.ChapterUtils;
import de.danoeh.antennapod.ui.widget.WidgetUpdater;
import io.reactivex.disposables.Disposable;
import org.greenrobot.eventbus.EventBus;
diff --git a/scripts/makeRelease.sh b/scripts/makeRelease.sh
index 34c79f319..7cf6286e9 100644
--- a/scripts/makeRelease.sh
+++ b/scripts/makeRelease.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-curl -s https://raw.githubusercontent.com/AntennaPod/antennapod.github.io/master/_config.yml | yq -r ".languages[]" > ./app/src/main/assets/website-languages.txt
+curl -s https://raw.githubusercontent.com/AntennaPod/antennapod.github.io/master/_config.yml | yq -r ".languages[]" > ./ui/common/src/main/assets/website-languages.txt
python ./createContributors.py
diff --git a/settings.gradle b/settings.gradle
index 111eb3e88..184df07f2 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,7 +16,6 @@ dependencyResolutionManagement {
}
include ':app'
-include ':core'
include ':event'
include ':model'
@@ -42,6 +41,7 @@ include ':storage:importexport'
include ':storage:preferences'
include ':ui:app-start-intent'
+include ':ui:chapters'
include ':ui:common'
include ':ui:discovery'
include ':ui:echo'
diff --git a/storage/database/build.gradle b/storage/database/build.gradle
index a78afbf79..60b57828a 100644
--- a/storage/database/build.gradle
+++ b/storage/database/build.gradle
@@ -30,6 +30,7 @@ dependencies {
implementation "com.google.guava:guava:31.0.1-android"
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
+ testImplementation project(':parser:feed')
testImplementation "junit:junit:$junitVersion"
testImplementation "androidx.test:core:$testCoreVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesser.java b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesser.java
index 580cf4164..3ee4e5b1d 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesser.java
+++ b/storage/database/src/main/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesser.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.storage.database;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserRealWorldTest.java b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserRealWorldTest.java
index dd3cd763b..3bcdb21aa 100644
--- a/core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserRealWorldTest.java
+++ b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserRealWorldTest.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.storage.database;
import de.danoeh.antennapod.parser.feed.util.DateUtils;
import org.apache.commons.io.IOUtils;
@@ -73,9 +73,12 @@ public class ReleaseScheduleGuesserRealWorldTest {
final boolean is3hoursClose = Math.abs(dateActual.getTime() - guess.nextExpectedDate.getTime())
< 3 * ReleaseScheduleGuesser.ONE_HOUR;
- System.out.println(lineNr + " guessed: " + DATE_FORMAT.format(guess.nextExpectedDate)
- + ", actual: " + DATE_FORMAT.format(dateActual)
- + " " + guess.schedule.name() + (is3hoursClose ? " ✔" : ""));
+ //noinspection ConstantValue
+ if (false) {
+ System.out.println(lineNr + " guessed: " + DATE_FORMAT.format(guess.nextExpectedDate)
+ + ", actual: " + DATE_FORMAT.format(dateActual)
+ + " " + guess.schedule.name() + (is3hoursClose ? " ✔" : ""));
+ }
long deltaTime = dateActual.getTime() - guess.nextExpectedDate.getTime();
int histogramClass = (int) Math.max(0, Math.min(100, deltaTime / ReleaseScheduleGuesser.ONE_HOUR + 50));
histogram[histogramClass]++;
diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserTest.java b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserTest.java
index aaad125c9..92fcbbea0 100644
--- a/core/src/test/java/de/danoeh/antennapod/core/util/ReleaseScheduleGuesserTest.java
+++ b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ReleaseScheduleGuesserTest.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.storage.database;
import org.junit.Test;
@@ -8,10 +8,10 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
-import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_DAY;
-import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_HOUR;
-import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_MINUTE;
-import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.performGuess;
+import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_DAY;
+import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_HOUR;
+import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_MINUTE;
+import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.performGuess;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
diff --git a/core/src/test/resources/release_dates.csv b/storage/database/src/test/resources/release_dates.csv
index 946b5dcab..946b5dcab 100644
--- a/core/src/test/resources/release_dates.csv
+++ b/storage/database/src/test/resources/release_dates.csv
diff --git a/core/src/test/resources/release_dates.sh b/storage/database/src/test/resources/release_dates.sh
index e09373a42..e09373a42 100755..100644
--- a/core/src/test/resources/release_dates.sh
+++ b/storage/database/src/test/resources/release_dates.sh
diff --git a/ui/chapters/README.md b/ui/chapters/README.md
new file mode 100644
index 000000000..68136b436
--- /dev/null
+++ b/ui/chapters/README.md
@@ -0,0 +1,3 @@
+# :ui:chapters
+
+This module provides chapter loading and merging for display, but not the actual UI to display them.
diff --git a/ui/chapters/build.gradle b/ui/chapters/build.gradle
new file mode 100644
index 000000000..a3cb1b677
--- /dev/null
+++ b/ui/chapters/build.gradle
@@ -0,0 +1,21 @@
+plugins {
+ id("com.android.library")
+}
+apply from: "../../common.gradle"
+apply from: "../../playFlavor.gradle"
+
+android {
+ namespace "de.danoeh.antennapod.ui.chapters"
+}
+
+dependencies {
+ implementation project(':model')
+ implementation project(':net:common')
+ implementation project(':parser:media')
+ implementation project(':parser:feed')
+ implementation project(':storage:database')
+
+ annotationProcessor "androidx.annotation:annotation:$annotationVersion"
+ implementation "commons-io:commons-io:$commonsioVersion"
+ implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
+}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterMerger.java b/ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterMerger.java
index 794b2322d..7ec11b566 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterMerger.java
+++ b/ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterMerger.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.ui.chapters;
import android.text.TextUtils;
import android.util.Log;
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java b/ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterUtils.java
index b32b05236..5554890ed 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/ChapterUtils.java
+++ b/ui/chapters/src/main/java/de/danoeh/antennapod/ui/chapters/ChapterUtils.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.ui.chapters;
import android.content.ContentResolver;
import android.content.Context;
@@ -41,19 +41,6 @@ public class ChapterUtils {
private ChapterUtils() {
}
- public static int getCurrentChapterIndex(Playable media, int position) {
- if (media == null || media.getChapters() == null || media.getChapters().size() == 0) {
- return -1;
- }
- List<Chapter> chapters = media.getChapters();
- for (int i = 0; i < chapters.size(); i++) {
- if (chapters.get(i).getStart() > position) {
- return i - 1;
- }
- }
- return chapters.size() - 1;
- }
-
public static void loadChapters(Playable playable, Context context, boolean forceRefresh) {
if (playable.getChapters() != null && !forceRefresh) {
// Already loaded
diff --git a/ui/common/build.gradle b/ui/common/build.gradle
index 1325761d3..f2916593a 100644
--- a/ui/common/build.gradle
+++ b/ui/common/build.gradle
@@ -16,6 +16,8 @@ dependencies {
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
implementation "com.google.android.material:material:$googleMaterialVersion"
implementation "androidx.core:core-splashscreen:1.0.0"
+ implementation "org.apache.commons:commons-lang3:$commonslangVersion"
+ implementation "commons-io:commons-io:$commonsioVersion"
testImplementation "junit:junit:$junitVersion"
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ConfirmationDialog.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/ConfirmationDialog.java
index ff5e56f5d..8acedc7d3 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/ConfirmationDialog.java
+++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/ConfirmationDialog.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.ui.common;
import android.content.Context;
import android.content.DialogInterface;
@@ -6,8 +6,6 @@ import androidx.appcompat.app.AlertDialog;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import android.util.Log;
-import de.danoeh.antennapod.core.R;
-
/**
* Creates an AlertDialog which asks the user to confirm something. Other
* classes can handle events like confirmation or cancellation.
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java
index 8b30b4eac..26c703e7b 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java
+++ b/ui/common/src/main/java/de/danoeh/antennapod/ui/common/IntentUtils.java
@@ -1,4 +1,4 @@
-package de.danoeh.antennapod.core.util;
+package de.danoeh.antennapod.ui.common;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -8,7 +8,6 @@ import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
-import de.danoeh.antennapod.core.R;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
@@ -52,7 +51,6 @@ public class IntentUtils {
}
}
-
public static String getLocalizedWebsiteLink(Context context) {
try (InputStream is = context.getAssets().open("website-languages.txt")) {
String[] languages = IOUtils.toString(is, StandardCharsets.UTF_8.name()).split("\n");
diff --git a/core/src/main/res/drawable/bg_blue_gradient.xml b/ui/common/src/main/res/drawable/bg_blue_gradient.xml
index 8ae045b6d..8ae045b6d 100644
--- a/core/src/main/res/drawable/bg_blue_gradient.xml
+++ b/ui/common/src/main/res/drawable/bg_blue_gradient.xml
diff --git a/core/src/main/res/drawable/bg_circle.xml b/ui/common/src/main/res/drawable/bg_circle.xml
index 0957db5e4..0957db5e4 100644
--- a/core/src/main/res/drawable/bg_circle.xml
+++ b/ui/common/src/main/res/drawable/bg_circle.xml
diff --git a/core/src/main/res/drawable/bg_drawer_item.xml b/ui/common/src/main/res/drawable/bg_drawer_item.xml
index 40727bf50..40727bf50 100644
--- a/core/src/main/res/drawable/bg_drawer_item.xml
+++ b/ui/common/src/main/res/drawable/bg_drawer_item.xml
diff --git a/core/src/main/res/drawable/bg_gradient.xml b/ui/common/src/main/res/drawable/bg_gradient.xml
index 5022240b3..5022240b3 100644
--- a/core/src/main/res/drawable/bg_gradient.xml
+++ b/ui/common/src/main/res/drawable/bg_gradient.xml
diff --git a/core/src/main/res/drawable/bg_pill.xml b/ui/common/src/main/res/drawable/bg_pill.xml
index f5865ccff..f5865ccff 100644
--- a/core/src/main/res/drawable/bg_pill.xml
+++ b/ui/common/src/main/res/drawable/bg_pill.xml
diff --git a/core/src/main/res/drawable/bg_rounded_corners.xml b/ui/common/src/main/res/drawable/bg_rounded_corners.xml
index 11b7710c4..11b7710c4 100644
--- a/core/src/main/res/drawable/bg_rounded_corners.xml
+++ b/ui/common/src/main/res/drawable/bg_rounded_corners.xml
diff --git a/ui/preferences/src/main/assets/website-languages.txt b/ui/common/website-languages.txt
index 64361314b..64361314b 100644
--- a/ui/preferences/src/main/assets/website-languages.txt
+++ b/ui/common/website-languages.txt
diff --git a/ui/preferences/build.gradle b/ui/preferences/build.gradle
index a777b4332..eb595da58 100644
--- a/ui/preferences/build.gradle
+++ b/ui/preferences/build.gradle
@@ -23,7 +23,6 @@ android {
}
dependencies {
- implementation project(":core")
implementation project(":event")
implementation project(":net:common")
implementation project(":net:sync:model")
diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java
index ad956ed71..3e30b44dd 100644
--- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java
+++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/AboutFragment.java
@@ -10,7 +10,7 @@ import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
import com.google.android.material.snackbar.Snackbar;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.preferences.BuildConfig;
import de.danoeh.antennapod.ui.preferences.R;
diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/LicensesFragment.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/LicensesFragment.java
index 85badcefc..1a60d03ce 100644
--- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/LicensesFragment.java
+++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/about/LicensesFragment.java
@@ -9,7 +9,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import androidx.fragment.app.ListFragment;
-import de.danoeh.antennapod.core.util.IntentUtils;
+import de.danoeh.antennapod.ui.common.IntentUtils;
import de.danoeh.antennapod.ui.preferences.R;
import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe;
diff --git a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/downloads/DataFolderAdapter.java b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/downloads/DataFolderAdapter.java
index bd6a75503..99f63156c 100644
--- a/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/downloads/DataFolderAdapter.java
+++ b/ui/preferences/src/main/java/de/danoeh/antennapod/ui/preferences/screen/downloads/DataFolderAdapter.java
@@ -1,6 +1,7 @@
package de.danoeh.antennapod.ui.preferences.screen.downloads;
import android.content.Context;
+import android.os.StatFs;
import android.text.format.Formatter;
import android.view.LayoutInflater;
import android.view.View;
@@ -12,7 +13,6 @@ import androidx.annotation.NonNull;
import androidx.core.util.Consumer;
import androidx.recyclerview.widget.RecyclerView;
import de.danoeh.antennapod.storage.preferences.UserPreferences;
-import de.danoeh.antennapod.core.util.StorageUtils;
import de.danoeh.antennapod.ui.preferences.R;
import java.io.File;
@@ -125,11 +125,17 @@ public class DataFolderAdapter extends RecyclerView.Adapter<DataFolderAdapter.Vi
}
long getAvailableSpace() {
- return StorageUtils.getFreeSpaceAvailable(path);
+ StatFs stat = new StatFs(path);
+ long availableBlocks = stat.getAvailableBlocksLong();
+ long blockSize = stat.getBlockSizeLong();
+ return availableBlocks * blockSize;
}
long getTotalSpace() {
- return StorageUtils.getTotalSpaceAvailable(path);
+ StatFs stat = new StatFs(path);
+ long blockCount = stat.getBlockCountLong();
+ long blockSize = stat.getBlockSizeLong();
+ return blockCount * blockSize;
}
int getUsagePercentage() {
diff --git a/core/src/main/res/values/arrays.xml b/ui/preferences/src/main/res/values/arrays.xml
index a4f5d7f38..a4f5d7f38 100644
--- a/core/src/main/res/values/arrays.xml
+++ b/ui/preferences/src/main/res/values/arrays.xml
diff --git a/core/src/main/res/values/keycodes.xml b/ui/preferences/src/main/res/values/keycodes.xml
index e0d44ce04..e0d44ce04 100644
--- a/core/src/main/res/values/keycodes.xml
+++ b/ui/preferences/src/main/res/values/keycodes.xml
diff --git a/ui/statistics/build.gradle b/ui/statistics/build.gradle
index 1e33a0f0a..be86665a7 100644
--- a/ui/statistics/build.gradle
+++ b/ui/statistics/build.gradle
@@ -9,7 +9,6 @@ android {
}
dependencies {
- implementation project(":core")
implementation project(":event")
implementation project(":model")
implementation project(':storage:database')
diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java
index a2f9e8146..74a0eaa5f 100644
--- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java
+++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/StatisticsFragment.java
@@ -18,7 +18,7 @@ import androidx.viewpager2.widget.ViewPager2;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
-import de.danoeh.antennapod.core.util.ConfirmationDialog;
+import de.danoeh.antennapod.ui.common.ConfirmationDialog;
import de.danoeh.antennapod.storage.database.DBWriter;
import de.danoeh.antennapod.event.StatisticsEvent;
import de.danoeh.antennapod.ui.common.PagedToolbarFragment;
diff --git a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsFragment.java b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsFragment.java
index 6a9e80740..aacd1294d 100644
--- a/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsFragment.java
+++ b/ui/statistics/src/main/java/de/danoeh/antennapod/ui/statistics/feed/FeedStatisticsFragment.java
@@ -13,7 +13,7 @@ import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.storage.database.StatisticsItem;
import de.danoeh.antennapod.ui.common.Converter;
import de.danoeh.antennapod.ui.common.DateFormatter;
-import de.danoeh.antennapod.core.util.ReleaseScheduleGuesser;
+import de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedItemFilter;
import de.danoeh.antennapod.model.feed.SortOrder;