Delete core module (#7060)
This commit is contained in:
parent
2143ab1351
commit
92ab575b15
|
@ -62,7 +62,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":core")
|
|
||||||
implementation project(":event")
|
implementation project(":event")
|
||||||
implementation project(':model')
|
implementation project(':model')
|
||||||
implementation project(':net:common')
|
implementation project(':net:common')
|
||||||
|
@ -91,6 +90,7 @@ dependencies {
|
||||||
implementation project(':ui:statistics')
|
implementation project(':ui:statistics')
|
||||||
implementation project(':net:sync:service-interface')
|
implementation project(':net:sync:service-interface')
|
||||||
implementation project(':playback:service')
|
implementation project(':playback:service')
|
||||||
|
implementation project(':ui:chapters')
|
||||||
|
|
||||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||||
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
implementation "androidx.appcompat:appcompat:$appcompatVersion"
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage" />
|
||||||
tools:ignore="ScopedStorage" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
<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
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
|
|
|
@ -6,7 +6,7 @@ import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
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 {
|
public class VisitWebsiteActionButton extends ItemActionButton {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
import de.danoeh.antennapod.ui.common.Converter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import de.danoeh.antennapod.ui.SelectableAdapter;
|
import de.danoeh.antennapod.ui.SelectableAdapter;
|
||||||
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
import de.danoeh.antennapod.ui.common.ThemeUtils;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -25,7 +24,6 @@ import java.util.List;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
|
||||||
import de.danoeh.antennapod.ui.screen.episode.ItemPagerFragment;
|
import de.danoeh.antennapod.ui.screen.episode.ItemPagerFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,9 +88,7 @@ public class EpisodeItemListAdapter extends SelectableAdapter<EpisodeItemViewHol
|
||||||
holder.itemView.setOnClickListener(v -> {
|
holder.itemView.setOnClickListener(v -> {
|
||||||
MainActivity activity = mainActivityRef.get();
|
MainActivity activity = mainActivityRef.get();
|
||||||
if (activity != null && !inActionMode()) {
|
if (activity != null && !inActionMode()) {
|
||||||
long[] ids = FeedItemUtil.getIds(episodes);
|
activity.loadChildFragment(ItemPagerFragment.newInstance(episodes, item));
|
||||||
int position = ArrayUtils.indexOf(ids, item.getId());
|
|
||||||
activity.loadChildFragment(ItemPagerFragment.newInstance(ids, position));
|
|
||||||
} else {
|
} else {
|
||||||
toggleSelection(holder.getBindingAdapterPosition());
|
toggleSelection(holder.getBindingAdapterPosition());
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,8 @@ import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
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.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
|
||||||
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||||
|
@ -334,7 +333,7 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
public void onEventMainThread(FeedItemEvent event) {
|
public void onEventMainThread(FeedItemEvent event) {
|
||||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||||
for (FeedItem item : event.items) {
|
for (FeedItem item : event.items) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(episodes, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
episodes.remove(pos);
|
episodes.remove(pos);
|
||||||
if (getFilter().matches(item)) {
|
if (getFilter().matches(item)) {
|
||||||
|
@ -378,7 +377,7 @@ public abstract class EpisodesListFragment extends Fragment
|
||||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(EpisodeDownloadEvent event) {
|
public void onEventMainThread(EpisodeDownloadEvent event) {
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(episodes, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(episodes, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
listAdapter.notifyItemChangedCompat(pos);
|
listAdapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,12 +18,10 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
|
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
|
||||||
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
|
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.playback.service.PlaybackServiceInterface;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.storage.preferences.SynchronizationSettings;
|
import de.danoeh.antennapod.storage.preferences.SynchronizationSettings;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
import de.danoeh.antennapod.ui.common.IntentUtils;
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
|
||||||
import de.danoeh.antennapod.playback.service.PlaybackStatus;
|
import de.danoeh.antennapod.playback.service.PlaybackStatus;
|
||||||
import de.danoeh.antennapod.ui.share.ShareUtils;
|
import de.danoeh.antennapod.ui.share.ShareUtils;
|
||||||
import de.danoeh.antennapod.ui.share.ShareDialog;
|
import de.danoeh.antennapod.ui.share.ShareDialog;
|
||||||
|
@ -198,7 +196,7 @@ public class FeedItemMenuHandler {
|
||||||
}
|
}
|
||||||
DBWriter.markItemPlayed(selectedItem, FeedItem.UNPLAYED, true);
|
DBWriter.markItemPlayed(selectedItem, FeedItem.UNPLAYED, true);
|
||||||
} else if (menuItemId == R.id.visit_website_item) {
|
} 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) {
|
} else if (menuItemId == R.id.share_item) {
|
||||||
ShareDialog shareDialog = ShareDialog.newInstance(selectedItem);
|
ShareDialog shareDialog = ShareDialog.newInstance(selectedItem);
|
||||||
shareDialog.show((fragment.getActivity().getSupportFragmentManager()), "ShareEpisodeDialog");
|
shareDialog.show((fragment.getActivity().getSupportFragmentManager()), "ShareEpisodeDialog");
|
||||||
|
@ -234,7 +232,8 @@ public class FeedItemMenuHandler {
|
||||||
if (media == null) {
|
if (media == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean shouldAutoDelete = FeedUtil.shouldAutoDeleteItemsOnThatFeed(item.getFeed());
|
boolean shouldAutoDelete = UserPreferences.isAutoDelete()
|
||||||
|
&& (!item.getFeed().isLocalFeed() || UserPreferences.isAutoDeleteLocal());
|
||||||
int smartMarkAsPlayedSecs = UserPreferences.getSmartMarkAsPlayedSecs();
|
int smartMarkAsPlayedSecs = UserPreferences.getSmartMarkAsPlayedSecs();
|
||||||
boolean almostEnded = media.getDuration() > 0
|
boolean almostEnded = media.getDuration() > 0
|
||||||
&& media.getPosition() >= media.getDuration() - smartMarkAsPlayedSecs * 1000;
|
&& media.getPosition() >= media.getDuration() - smartMarkAsPlayedSecs * 1000;
|
||||||
|
|
|
@ -9,10 +9,8 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
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.ui.screen.episode.ItemPagerFragment;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -68,9 +66,7 @@ public class HorizontalItemListAdapter extends RecyclerView.Adapter<HorizontalIt
|
||||||
holder.card.setOnClickListener(v -> {
|
holder.card.setOnClickListener(v -> {
|
||||||
MainActivity activity = mainActivityRef.get();
|
MainActivity activity = mainActivityRef.get();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
long[] ids = FeedItemUtil.getIds(data);
|
activity.loadChildFragment(ItemPagerFragment.newInstance(data, item));
|
||||||
int clickPosition = ArrayUtils.indexOf(ids, item.getId());
|
|
||||||
activity.loadChildFragment(ItemPagerFragment.newInstance(ids, clickPosition));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,7 @@ package de.danoeh.antennapod.ui.episodeslist;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for the more_content_list_footer layout.
|
* Utility methods for the more_content_list_footer layout.
|
||||||
|
|
|
@ -8,7 +8,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import de.danoeh.antennapod.R;
|
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.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent;
|
import de.danoeh.antennapod.event.playback.PlaybackHistoryEvent;
|
||||||
|
|
|
@ -40,7 +40,6 @@ import de.danoeh.antennapod.event.UnreadItemsUpdateEvent;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.EpisodeMultiSelectActionHandler;
|
import de.danoeh.antennapod.ui.episodeslist.EpisodeMultiSelectActionHandler;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
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.ui.episodeslist.FeedItemMenuHandler;
|
||||||
import de.danoeh.antennapod.net.discovery.CombinedSearcher;
|
import de.danoeh.antennapod.net.discovery.CombinedSearcher;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
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++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(i);
|
FeedItem item = event.items.get(i);
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(results, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(results, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
results.remove(pos);
|
results.remove(pos);
|
||||||
results.add(pos, item);
|
results.add(pos, item);
|
||||||
|
@ -342,7 +341,7 @@ public class SearchFragment extends Fragment implements EpisodeItemListAdapter.O
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(results, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(results, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
adapter.notifyItemChangedCompat(pos);
|
adapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.util.ChapterUtils;
|
|
||||||
import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
|
import de.danoeh.antennapod.event.playback.PlaybackPositionEvent;
|
||||||
import de.danoeh.antennapod.model.feed.Chapter;
|
import de.danoeh.antennapod.model.feed.Chapter;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.model.playback.Playable;
|
import de.danoeh.antennapod.model.playback.Playable;
|
||||||
import de.danoeh.antennapod.playback.base.PlayerStatus;
|
import de.danoeh.antennapod.playback.base.PlayerStatus;
|
||||||
import de.danoeh.antennapod.playback.service.PlaybackController;
|
import de.danoeh.antennapod.playback.service.PlaybackController;
|
||||||
|
import de.danoeh.antennapod.ui.chapters.ChapterUtils;
|
||||||
import io.reactivex.Maybe;
|
import io.reactivex.Maybe;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
@ -130,7 +130,7 @@ public class ChaptersFragment extends AppCompatDialogFragment {
|
||||||
if (controller == null) {
|
if (controller == null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return ChapterUtils.getCurrentChapterIndex(media, controller.getPosition());
|
return Chapter.getAfterPosition(media.getChapters(), controller.getPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMediaInfo(boolean forceRefresh) {
|
private void loadMediaInfo(boolean forceRefresh) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.model.feed.Chapter;
|
import de.danoeh.antennapod.model.feed.Chapter;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
import de.danoeh.antennapod.ui.common.Converter;
|
||||||
import de.danoeh.antennapod.model.feed.EmbeddedChapterImage;
|
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.model.playback.Playable;
|
||||||
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
import de.danoeh.antennapod.ui.common.CircularProgressBar;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.ui.screen.SearchFragment;
|
import de.danoeh.antennapod.ui.screen.SearchFragment;
|
||||||
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
|
import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
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.ui.screen.feed.ItemSortDialog;
|
||||||
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
|
@ -209,7 +208,7 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
return; // Refreshed anyway
|
return; // Refreshed anyway
|
||||||
}
|
}
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(items, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(items, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
adapter.notifyItemChangedCompat(pos);
|
adapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +248,7 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
}
|
}
|
||||||
for (int i = 0, size = event.items.size(); i < size; i++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(i);
|
FeedItem item = event.items.get(i);
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(items, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(items, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
items.remove(pos);
|
items.remove(pos);
|
||||||
if (item.getMedia().isDownloaded()) {
|
if (item.getMedia().isDownloaded()) {
|
||||||
|
@ -305,7 +304,7 @@ public class CompletedDownloadsFragment extends Fragment
|
||||||
return downloadedItems;
|
return downloadedItems;
|
||||||
}
|
}
|
||||||
for (String url : runningDownloads) {
|
for (String url : runningDownloads) {
|
||||||
if (FeedItemUtil.indexOfItemWithDownloadUrl(downloadedItems, url) != -1) {
|
if (EpisodeDownloadEvent.indexOfItemWithDownloadUrl(downloadedItems, url) != -1) {
|
||||||
continue; // Already in list
|
continue; // Already in list
|
||||||
}
|
}
|
||||||
mediaUrls.add(url);
|
mediaUrls.add(url);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package de.danoeh.antennapod.ui.screen.download;
|
package de.danoeh.antennapod.ui.screen.download;
|
||||||
|
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import de.danoeh.antennapod.core.BuildConfig;
|
import de.danoeh.antennapod.BuildConfig;
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.model.download.DownloadError;
|
import de.danoeh.antennapod.model.download.DownloadError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,7 +55,7 @@ import java.util.Set;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.screen.preferences.PreferenceActivity;
|
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.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
|
|
|
@ -29,6 +29,8 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays information about a list of FeedItems.
|
* 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.
|
* 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
|
* @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();
|
ItemPagerFragment fragment = new ItemPagerFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putLongArray(ARG_FEEDITEMS, feeditems);
|
args.putLongArray(ARG_FEEDITEMS, ids);
|
||||||
args.putInt(ARG_FEEDITEM_POS, Math.max(0, feedItemPos));
|
args.putInt(ARG_FEEDITEM_POS, position);
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.TransitionEffect;
|
import de.danoeh.antennapod.ui.TransitionEffect;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.FeedDatabaseWriter;
|
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.share.ShareUtils;
|
||||||
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
|
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
import de.danoeh.antennapod.model.feed.Feed;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package de.danoeh.antennapod.ui.screen.feed;
|
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;
|
import de.danoeh.antennapod.model.feed.FeedItemFilter;
|
||||||
|
|
||||||
public enum FeedItemFilterGroup {
|
public enum FeedItemFilterGroup {
|
||||||
|
|
|
@ -50,8 +50,7 @@ import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.storage.database.FeedItemPermutors;
|
import de.danoeh.antennapod.storage.database.FeedItemPermutors;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
import de.danoeh.antennapod.ui.common.IntentUtils;
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
|
||||||
import de.danoeh.antennapod.ui.share.ShareUtils;
|
import de.danoeh.antennapod.ui.share.ShareUtils;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.MoreContentListFooterUtil;
|
import de.danoeh.antennapod.ui.episodeslist.MoreContentListFooterUtil;
|
||||||
import de.danoeh.antennapod.databinding.FeedItemListFragmentBinding;
|
import de.danoeh.antennapod.databinding.FeedItemListFragmentBinding;
|
||||||
|
@ -321,8 +320,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
MainActivity activity = (MainActivity) getActivity();
|
MainActivity activity = (MainActivity) getActivity();
|
||||||
long[] ids = FeedItemUtil.getIds(feed.getItems());
|
activity.loadChildFragment(ItemPagerFragment.newInstance(feed.getItems(), feed.getItems().get(position)));
|
||||||
activity.loadChildFragment(ItemPagerFragment.newInstance(ids, position));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@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++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(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) {
|
if (pos >= 0) {
|
||||||
feed.getItems().remove(pos);
|
feed.getItems().remove(pos);
|
||||||
feed.getItems().add(pos, item);
|
feed.getItems().add(pos, item);
|
||||||
|
@ -356,7 +354,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(feed.getItems(), downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(feed.getItems(), downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
adapter.notifyItemChangedCompat(pos);
|
adapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
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.model.feed.Feed;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class RenameFeedDialog {
|
||||||
renameTag(newTitle);
|
renameTag(newTitle);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNeutralButton(de.danoeh.antennapod.core.R.string.reset, null)
|
.setNeutralButton(R.string.reset, null)
|
||||||
.setNegativeButton(de.danoeh.antennapod.core.R.string.cancel_label, null)
|
.setNegativeButton(R.string.cancel_label, null)
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
// To prevent cancelling the dialog on button click
|
// To prevent cancelling the dialog on button click
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
|
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
|
||||||
import de.danoeh.antennapod.ui.MenuItemUtils;
|
import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
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.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
||||||
|
@ -105,7 +104,7 @@ public class EpisodesSurpriseSection extends HomeSection {
|
||||||
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||||
for (int i = 0, size = event.items.size(); i < size; i++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(i);
|
FeedItem item = event.items.get(i);
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(episodes, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(episodes, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
episodes.remove(pos);
|
episodes.remove(pos);
|
||||||
episodes.add(pos, item);
|
episodes.add(pos, item);
|
||||||
|
@ -117,7 +116,7 @@ public class EpisodesSurpriseSection extends HomeSection {
|
||||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(EpisodeDownloadEvent event) {
|
public void onEventMainThread(EpisodeDownloadEvent event) {
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(episodes, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(episodes, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
listAdapter.notifyItemChangedCompat(pos);
|
listAdapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
|
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
|
||||||
import de.danoeh.antennapod.ui.MenuItemUtils;
|
import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
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.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
import de.danoeh.antennapod.event.FeedListUpdateEvent;
|
||||||
|
@ -99,7 +98,7 @@ public class InboxSection extends HomeSection {
|
||||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(EpisodeDownloadEvent event) {
|
public void onEventMainThread(EpisodeDownloadEvent event) {
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(items, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(items, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
adapter.notifyItemChangedCompat(pos);
|
adapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
|
import de.danoeh.antennapod.ui.episodeslist.HorizontalItemListAdapter;
|
||||||
import de.danoeh.antennapod.ui.MenuItemUtils;
|
import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
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.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
import de.danoeh.antennapod.event.PlayerStatusEvent;
|
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++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(i);
|
FeedItem item = event.items.get(i);
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(queue, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(queue, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
queue.remove(pos);
|
queue.remove(pos);
|
||||||
queue.add(pos, item);
|
queue.add(pos, item);
|
||||||
|
@ -104,7 +103,7 @@ public class QueueSection extends HomeSection {
|
||||||
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(EpisodeDownloadEvent event) {
|
public void onEventMainThread(EpisodeDownloadEvent event) {
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(queue, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(queue, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
listAdapter.notifyItemChangedCompat(pos);
|
listAdapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ import de.danoeh.antennapod.net.discovery.PodcastSearcherRegistry;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
import de.danoeh.antennapod.parser.feed.FeedHandler;
|
||||||
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
|
||||||
import de.danoeh.antennapod.model.download.DownloadError;
|
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.net.common.UrlChecker;
|
||||||
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
|
import de.danoeh.antennapod.ui.cleaner.HtmlToPlainText;
|
||||||
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
|
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.google.android.material.elevation.SurfaceColors;
|
||||||
|
|
||||||
import de.danoeh.antennapod.playback.service.PlaybackController;
|
import de.danoeh.antennapod.playback.service.PlaybackController;
|
||||||
import de.danoeh.antennapod.ui.appstartintent.MediaButtonStarter;
|
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.PlaybackSpeedUtils;
|
||||||
import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter;
|
import de.danoeh.antennapod.ui.episodes.TimeSpeedConverter;
|
||||||
import de.danoeh.antennapod.ui.screen.playback.MediaPlayerErrorDialog;
|
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.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
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.common.Converter;
|
||||||
import de.danoeh.antennapod.ui.screen.feed.preferences.SkipPreferenceDialog;
|
import de.danoeh.antennapod.ui.screen.feed.preferences.SkipPreferenceDialog;
|
||||||
import de.danoeh.antennapod.event.FavoritesEvent;
|
import de.danoeh.antennapod.event.FavoritesEvent;
|
||||||
|
@ -360,7 +360,7 @@ public class AudioPlayerFragment extends Fragment implements
|
||||||
int currentPosition = converter.convert(event.getPosition());
|
int currentPosition = converter.convert(event.getPosition());
|
||||||
int duration = converter.convert(event.getDuration());
|
int duration = converter.convert(event.getDuration());
|
||||||
int remainingTime = converter.convert(Math.max(event.getDuration() - event.getPosition(), 0));
|
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));
|
Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition));
|
||||||
if (currentPosition == Playable.INVALID_TIME || duration == Playable.INVALID_TIME) {
|
if (currentPosition == Playable.INVALID_TIME || duration == Playable.INVALID_TIME) {
|
||||||
Log.w(TAG, "Could not react to position observer update because of 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());
|
float prog = progress / ((float) seekBar.getMax());
|
||||||
TimeSpeedConverter converter = new TimeSpeedConverter(controller.getCurrentPlaybackSpeedMultiplier());
|
TimeSpeedConverter converter = new TimeSpeedConverter(controller.getCurrentPlaybackSpeedMultiplier());
|
||||||
int position = converter.convert((int) (prog * controller.getDuration()));
|
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 (newChapterIndex > -1) {
|
||||||
if (!sbPosition.isPressed() && currentChapterIndex != newChapterIndex) {
|
if (!sbPosition.isPressed() && currentChapterIndex != newChapterIndex) {
|
||||||
currentChapterIndex = newChapterIndex;
|
currentChapterIndex = newChapterIndex;
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
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.ui.screen.chapter.ChaptersFragment;
|
||||||
import de.danoeh.antennapod.playback.service.PlaybackController;
|
import de.danoeh.antennapod.playback.service.PlaybackController;
|
||||||
import de.danoeh.antennapod.ui.common.DateFormatter;
|
import de.danoeh.antennapod.ui.common.DateFormatter;
|
||||||
|
@ -160,7 +160,7 @@ public class CoverFragment extends Fragment {
|
||||||
});
|
});
|
||||||
|
|
||||||
displayedChapterIndex = -1;
|
displayedChapterIndex = -1;
|
||||||
refreshChapterData(ChapterUtils.getCurrentChapterIndex(media, media.getPosition())); //calls displayCoverImage
|
refreshChapterData(Chapter.getAfterPosition(media.getChapters(), media.getPosition()));
|
||||||
updateChapterControlVisibility();
|
updateChapterControlVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ public class CoverFragment extends Fragment {
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onEventMainThread(PlaybackPositionEvent event) {
|
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) {
|
if (newChapterIndex > -1 && newChapterIndex != displayedChapterIndex) {
|
||||||
refreshChapterData(newChapterIndex);
|
refreshChapterData(newChapterIndex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,7 @@ import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
import de.danoeh.antennapod.ui.common.Converter;
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
import de.danoeh.antennapod.ui.common.IntentUtils;
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
|
||||||
import de.danoeh.antennapod.ui.share.ShareUtils;
|
import de.danoeh.antennapod.ui.share.ShareUtils;
|
||||||
import de.danoeh.antennapod.databinding.VideoplayerActivityBinding;
|
import de.danoeh.antennapod.databinding.VideoplayerActivityBinding;
|
||||||
import de.danoeh.antennapod.ui.share.ShareDialog;
|
import de.danoeh.antennapod.ui.share.ShareDialog;
|
||||||
|
@ -636,7 +635,7 @@ public class VideoplayerActivity extends CastEnabledActivity implements SeekBar.
|
||||||
} else if (StringUtils.isNotBlank(media.getWebsiteLink())) {
|
} else if (StringUtils.isNotBlank(media.getWebsiteLink())) {
|
||||||
return media.getWebsiteLink();
|
return media.getWebsiteLink();
|
||||||
} else if (media instanceof FeedMedia) {
|
} else if (media instanceof FeedMedia) {
|
||||||
return FeedItemUtil.getLinkWithFallback(((FeedMedia) media).getItem());
|
return (((FeedMedia) media).getItem()).getLinkWithFallback();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import de.danoeh.antennapod.ui.common.ThemeSwitcher;
|
||||||
import de.danoeh.antennapod.CrashReportWriter;
|
import de.danoeh.antennapod.CrashReportWriter;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
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 org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import com.bytehamster.lib.preferencesearch.SearchConfiguration;
|
||||||
import com.bytehamster.lib.preferencesearch.SearchPreference;
|
import com.bytehamster.lib.preferencesearch.SearchPreference;
|
||||||
|
|
||||||
import de.danoeh.antennapod.R;
|
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;
|
import de.danoeh.antennapod.ui.preferences.screen.about.AboutFragment;
|
||||||
|
|
||||||
public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||||
|
|
|
@ -40,12 +40,11 @@ import java.util.List;
|
||||||
import de.danoeh.antennapod.R;
|
import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.episodeslist.EpisodeItemListAdapter;
|
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.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
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.ui.screen.feed.ItemSortDialog;
|
||||||
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
import de.danoeh.antennapod.event.EpisodeDownloadEvent;
|
||||||
import de.danoeh.antennapod.event.FeedItemEvent;
|
import de.danoeh.antennapod.event.FeedItemEvent;
|
||||||
|
@ -150,7 +149,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
break;
|
break;
|
||||||
case REMOVED:
|
case REMOVED:
|
||||||
case IRREVERSIBLE_REMOVED:
|
case IRREVERSIBLE_REMOVED:
|
||||||
int position = FeedItemUtil.indexOfItemWithId(queue, event.item.getId());
|
int position = FeedItemEvent.indexOfItemWithId(queue, event.item.getId());
|
||||||
queue.remove(position);
|
queue.remove(position);
|
||||||
recyclerAdapter.notifyItemRemoved(position);
|
recyclerAdapter.notifyItemRemoved(position);
|
||||||
break;
|
break;
|
||||||
|
@ -178,7 +177,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
}
|
}
|
||||||
for (int i = 0, size = event.items.size(); i < size; i++) {
|
for (int i = 0, size = event.items.size(); i < size; i++) {
|
||||||
FeedItem item = event.items.get(i);
|
FeedItem item = event.items.get(i);
|
||||||
int pos = FeedItemUtil.indexOfItemWithId(queue, item.getId());
|
int pos = FeedItemEvent.indexOfItemWithId(queue, item.getId());
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
queue.remove(pos);
|
queue.remove(pos);
|
||||||
queue.add(pos, item);
|
queue.add(pos, item);
|
||||||
|
@ -194,7 +193,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (String downloadUrl : event.getUrls()) {
|
for (String downloadUrl : event.getUrls()) {
|
||||||
int pos = FeedItemUtil.indexOfItemWithDownloadUrl(queue, downloadUrl);
|
int pos = EpisodeDownloadEvent.indexOfItemWithDownloadUrl(queue, downloadUrl);
|
||||||
if (pos >= 0) {
|
if (pos >= 0) {
|
||||||
recyclerAdapter.notifyItemChangedCompat(pos);
|
recyclerAdapter.notifyItemChangedCompat(pos);
|
||||||
}
|
}
|
||||||
|
@ -357,7 +356,7 @@ public class QueueFragment extends Fragment implements MaterialToolbar.OnMenuIte
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
int position = FeedItemUtil.indexOfItemWithId(queue, selectedItem.getId());
|
int position = FeedItemEvent.indexOfItemWithId(queue, selectedItem.getId());
|
||||||
if (position < 0) {
|
if (position < 0) {
|
||||||
Log.i(TAG, "Selected item no longer exist, ignoring selection");
|
Log.i(TAG, "Selected item no longer exist, ignoring selection");
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import androidx.core.text.HtmlCompat;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import de.danoeh.antennapod.R;
|
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.databinding.RatingDialogBinding;
|
||||||
import de.danoeh.antennapod.ui.common.DateFormatter;
|
import de.danoeh.antennapod.ui.common.DateFormatter;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
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.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.StatisticsItem;
|
import de.danoeh.antennapod.storage.database.StatisticsItem;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.util.Log;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import de.danoeh.antennapod.R;
|
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.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.ui.screen.feed.RemoveFeedDialog;
|
import de.danoeh.antennapod.ui.screen.feed.RemoveFeedDialog;
|
||||||
import de.danoeh.antennapod.ui.screen.feed.RenameFeedDialog;
|
import de.danoeh.antennapod.ui.screen.feed.RenameFeedDialog;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package de.danoeh.antennapod.ui.screen.subscriptions;
|
package de.danoeh.antennapod.ui.screen.subscriptions;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.R;
|
||||||
|
|
||||||
public enum SubscriptionsFilterGroup {
|
public enum SubscriptionsFilterGroup {
|
||||||
COUNTER_GREATER_ZERO(new ItemProperties(R.string.subscriptions_counter_greater_zero, "counter_greater_zero")),
|
COUNTER_GREATER_ZERO(new ItemProperties(R.string.subscriptions_counter_greater_zero, "counter_greater_zero")),
|
||||||
|
|
|
@ -9,12 +9,11 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.ShareCompat;
|
import androidx.core.app.ShareCompat;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.util.FeedItemUtil;
|
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
import de.danoeh.antennapod.ui.common.Converter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URLEncoder;
|
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.Feed;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
|
@ -46,7 +45,7 @@ public class ShareUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasLinkToShare(FeedItem item) {
|
public static boolean hasLinkToShare(FeedItem item) {
|
||||||
return FeedItemUtil.getLinkWithFallback(item) != null;
|
return item.getLinkWithFallback() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shareMediaDownloadLink(Context context, FeedMedia media) {
|
public static void shareMediaDownloadLink(Context context, FeedMedia media) {
|
||||||
|
@ -64,7 +63,7 @@ public class ShareUtils {
|
||||||
|
|
||||||
if (hasLinkToShare(item)) {
|
if (hasLinkToShare(item)) {
|
||||||
text += "\n\n" + context.getResources().getString(R.string.share_dialog_episode_website_label) + ": ";
|
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) {
|
if (item.getMedia() != null && item.getMedia().getDownloadUrl() != null) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
import de.danoeh.antennapod.ui.MenuItemUtils;
|
import de.danoeh.antennapod.ui.MenuItemUtils;
|
||||||
import de.danoeh.antennapod.ui.common.Converter;
|
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.net.common.NetworkUtils;
|
||||||
import de.danoeh.antennapod.ui.share.ShareUtils;
|
import de.danoeh.antennapod.ui.share.ShareUtils;
|
||||||
import de.danoeh.antennapod.ui.cleaner.ShownotesCleaner;
|
import de.danoeh.antennapod.ui.cleaner.ShownotesCleaner;
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/build
|
|
|
@ -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"
|
|
||||||
}
|
|
|
@ -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>
|
|
|
@ -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>
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +1,9 @@
|
||||||
package de.danoeh.antennapod.event;
|
package de.danoeh.antennapod.event;
|
||||||
|
|
||||||
import de.danoeh.antennapod.model.download.DownloadStatus;
|
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.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -15,4 +17,14 @@ public class EpisodeDownloadEvent {
|
||||||
public Set<String> getUrls() {
|
public Set<String> getUrls() {
|
||||||
return map.keySet();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,14 @@ public class FeedItemEvent {
|
||||||
public static FeedItemEvent updated(FeedItem... items) {
|
public static FeedItemEvent updated(FeedItem... items) {
|
||||||
return new FeedItemEvent(Arrays.asList(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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package de.danoeh.antennapod.model.feed;
|
package de.danoeh.antennapod.model.feed;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Chapter {
|
public class Chapter {
|
||||||
private long id;
|
private long id;
|
||||||
/** Defines starting point in milliseconds. */
|
/** Defines starting point in milliseconds. */
|
||||||
|
@ -74,4 +76,16 @@ public class Chapter {
|
||||||
public void setId(long id) {
|
public void setId(long id) {
|
||||||
this.id = 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package de.danoeh.antennapod.model.feed;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
@ -205,6 +206,19 @@ public class FeedItem implements Serializable {
|
||||||
return link;
|
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) {
|
public void setLink(String link) {
|
||||||
this.link = link;
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.model.feed;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
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;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class FeedItemUtilTest {
|
public class FeedItemFallbackLinkTest {
|
||||||
private static final String FEED_LINK = "http://example.com";
|
private static final String FEED_LINK = "http://example.com";
|
||||||
private static final String ITEM_LINK = "http://example.com/feedItem1";
|
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.msg = msg;
|
||||||
this.feedLink = feedLink;
|
this.feedLink = feedLink;
|
||||||
this.itemLink = itemLink;
|
this.itemLink = itemLink;
|
||||||
this.expected = expected;
|
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
|
@Test
|
||||||
public void testLinkWithFallback() {
|
public void testLinkWithFallback() {
|
||||||
String actual = FeedItemUtil.getLinkWithFallback(createFeedItem(feedLink, itemLink));
|
String actual = createFeedItem(feedLink, itemLink).getLinkWithFallback();
|
||||||
assertEquals(msg, expected, actual);
|
assertEquals(msg, expected, actual);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":core")
|
|
||||||
implementation project(':event')
|
implementation project(':event')
|
||||||
implementation project(':model')
|
implementation project(':model')
|
||||||
implementation project(':net:common')
|
implementation project(':net:common')
|
||||||
|
@ -23,6 +22,7 @@ dependencies {
|
||||||
implementation project(':ui:notifications')
|
implementation project(':ui:notifications')
|
||||||
implementation project(':storage:preferences')
|
implementation project(':storage:preferences')
|
||||||
implementation project(':ui:app-start-intent')
|
implementation project(':ui:app-start-intent')
|
||||||
|
implementation project(':ui:chapters')
|
||||||
|
|
||||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||||
implementation "androidx.core:core:$coreVersion"
|
implementation "androidx.core:core:$coreVersion"
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
|
||||||
android:supportsRtl="true">
|
android:supportsRtl="true">
|
||||||
|
|
||||||
<receiver android:name=".feed.FeedUpdateReceiver"
|
<receiver android:name=".feed.FeedUpdateReceiver"
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import de.danoeh.antennapod.model.MediaMetadataRetrieverCompat;
|
import de.danoeh.antennapod.model.MediaMetadataRetrieverCompat;
|
||||||
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
|
import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueSink;
|
||||||
|
import de.danoeh.antennapod.ui.chapters.ChapterUtils;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.io.File;
|
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.model.download.DownloadResult;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
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.download.DownloadError;
|
||||||
import de.danoeh.antennapod.model.feed.FeedItem;
|
import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
|
|
|
@ -14,10 +14,10 @@ import androidx.work.OutOfQuotaPolicy;
|
||||||
import androidx.work.PeriodicWorkRequest;
|
import androidx.work.PeriodicWorkRequest;
|
||||||
import androidx.work.WorkManager;
|
import androidx.work.WorkManager;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import de.danoeh.antennapod.core.R;
|
|
||||||
import de.danoeh.antennapod.net.common.NetworkUtils;
|
import de.danoeh.antennapod.net.common.NetworkUtils;
|
||||||
import de.danoeh.antennapod.event.MessageEvent;
|
import de.danoeh.antennapod.event.MessageEvent;
|
||||||
import de.danoeh.antennapod.model.feed.Feed;
|
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.net.download.serviceinterface.FeedUpdateManager;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.danoeh.antennapod.net.download.service.feed.remote;
|
package de.danoeh.antennapod.net.download.service.feed.remote;
|
||||||
|
|
||||||
|
import android.os.StatFs;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
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.model.download.DownloadRequest;
|
||||||
import de.danoeh.antennapod.net.common.AntennapodHttpClient;
|
import de.danoeh.antennapod.net.common.AntennapodHttpClient;
|
||||||
import de.danoeh.antennapod.net.download.service.R;
|
import de.danoeh.antennapod.net.download.service.R;
|
||||||
|
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
import okhttp3.CacheControl;
|
import okhttp3.CacheControl;
|
||||||
import okhttp3.internal.http.StatusLine;
|
import okhttp3.internal.http.StatusLine;
|
||||||
import org.apache.commons.io.IOUtils;
|
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.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.parser.feed.util.DateUtils;
|
import de.danoeh.antennapod.parser.feed.util.DateUtils;
|
||||||
import de.danoeh.antennapod.model.download.DownloadError;
|
import de.danoeh.antennapod.model.download.DownloadError;
|
||||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
|
||||||
import de.danoeh.antennapod.net.common.UriUtil;
|
import de.danoeh.antennapod.net.common.UriUtil;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Protocol;
|
import okhttp3.Protocol;
|
||||||
|
@ -148,7 +149,7 @@ public class HttpDownloader extends Downloader {
|
||||||
request.setSize(DownloadResult.SIZE_UNKNOWN);
|
request.setSize(DownloadResult.SIZE_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
long freeSpace = StorageUtils.getFreeSpaceAvailable();
|
long freeSpace = getFreeSpaceAvailable();
|
||||||
Log.d(TAG, "Free space is " + freeSpace);
|
Log.d(TAG, "Free space is " + freeSpace);
|
||||||
if (request.getSize() != DownloadResult.SIZE_UNKNOWN && request.getSize() > freeSpace) {
|
if (request.getSize() != DownloadResult.SIZE_UNKNOWN && request.getSize() > freeSpace) {
|
||||||
onFail(DownloadError.ERROR_NOT_ENOUGH_SPACE, null);
|
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() {
|
private void onSuccess() {
|
||||||
Log.d(TAG, "Download was successful");
|
Log.d(TAG, "Download was successful");
|
||||||
result.setSuccessful();
|
result.setSuccessful();
|
||||||
|
|
|
@ -36,7 +36,6 @@ import de.danoeh.antennapod.model.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.model.feed.FeedMedia;
|
import de.danoeh.antennapod.model.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
|
import de.danoeh.antennapod.storage.preferences.PlaybackPreferences;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
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.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
@ -610,17 +609,12 @@ public class DbWriterTest {
|
||||||
Cursor cursor = adapter.getQueueIDCursor();
|
Cursor cursor = adapter.getQueueIDCursor();
|
||||||
assertTrue(cursor.moveToFirst());
|
assertTrue(cursor.moveToFirst());
|
||||||
assertEquals(numItems, cursor.getCount());
|
assertEquals(numItems, cursor.getCount());
|
||||||
List<Long> expectedIds;
|
|
||||||
expectedIds = FeedItemUtil.getIdList(feed.getItems());
|
|
||||||
List<Long> actualIds = new ArrayList<>();
|
|
||||||
for (int i = 0; i < numItems; i++) {
|
for (int i = 0; i < numItems; i++) {
|
||||||
assertTrue(cursor.moveToPosition(i));
|
assertTrue(cursor.moveToPosition(i));
|
||||||
actualIds.add(cursor.getLong(0));
|
assertEquals(feed.getItems().get(i).getId(), cursor.getLong(0));
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
adapter.close();
|
adapter.close();
|
||||||
assertEquals("Bulk add to queue: result order should be the same as the order given",
|
|
||||||
expectedIds, actualIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package de.danoeh.antennapod.parser.feed.util;
|
package de.danoeh.antennapod.parser.feed.util;
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
@ -16,7 +14,6 @@ import java.util.TimeZone;
|
||||||
* Parses several date formats.
|
* Parses several date formats.
|
||||||
*/
|
*/
|
||||||
public abstract class DateUtils {
|
public abstract class DateUtils {
|
||||||
private static final String TAG = "DateUtils";
|
|
||||||
private static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
|
private static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
|
||||||
private static final ThreadLocal<SimpleDateFormat> RFC822_DATE_FORMAT = new ThreadLocal<>() {
|
private static final ThreadLocal<SimpleDateFormat> RFC822_DATE_FORMAT = new ThreadLocal<>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,8 +114,8 @@ public abstract class DateUtils {
|
||||||
if (result != null && pos.getIndex() == date.length()) {
|
if (result != null && pos.getIndex() == date.length()) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +124,7 @@ public abstract class DateUtils {
|
||||||
return parse(date.substring(date.indexOf(',') + 1));
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(':core')
|
|
||||||
implementation project(':event')
|
implementation project(':event')
|
||||||
implementation project(':model')
|
implementation project(':model')
|
||||||
implementation project(':net:common')
|
implementation project(':net:common')
|
||||||
|
@ -24,6 +23,7 @@ dependencies {
|
||||||
implementation project(':ui:i18n')
|
implementation project(':ui:i18n')
|
||||||
implementation project(':ui:notifications')
|
implementation project(':ui:notifications')
|
||||||
implementation project(':ui:widget')
|
implementation project(':ui:widget')
|
||||||
|
implementation project(':ui:chapters')
|
||||||
|
|
||||||
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
|
||||||
implementation "androidx.core:core:$coreVersion"
|
implementation "androidx.core:core:$coreVersion"
|
||||||
|
|
|
@ -77,9 +77,7 @@ import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
|
||||||
import de.danoeh.antennapod.storage.database.DBReader;
|
import de.danoeh.antennapod.storage.database.DBReader;
|
||||||
import de.danoeh.antennapod.storage.database.DBWriter;
|
import de.danoeh.antennapod.storage.database.DBWriter;
|
||||||
import de.danoeh.antennapod.playback.service.internal.PlaybackServiceTaskManager.SleepTimer;
|
import de.danoeh.antennapod.playback.service.internal.PlaybackServiceTaskManager.SleepTimer;
|
||||||
import de.danoeh.antennapod.core.util.ChapterUtils;
|
import de.danoeh.antennapod.ui.common.IntentUtils;
|
||||||
import de.danoeh.antennapod.core.util.FeedUtil;
|
|
||||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
|
||||||
import de.danoeh.antennapod.net.common.NetworkUtils;
|
import de.danoeh.antennapod.net.common.NetworkUtils;
|
||||||
import de.danoeh.antennapod.event.MessageEvent;
|
import de.danoeh.antennapod.event.MessageEvent;
|
||||||
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
import de.danoeh.antennapod.event.PlayerErrorEvent;
|
||||||
|
@ -1147,9 +1145,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
// Delete episode if enabled
|
// Delete episode if enabled
|
||||||
FeedPreferences.AutoDeleteAction action =
|
FeedPreferences.AutoDeleteAction action =
|
||||||
item.getFeed().getPreferences().getCurrentAutoDelete();
|
item.getFeed().getPreferences().getCurrentAutoDelete();
|
||||||
|
boolean autoDeleteEnabledGlobally = UserPreferences.isAutoDelete()
|
||||||
|
&& (!item.getFeed().isLocalFeed() || UserPreferences.isAutoDeleteLocal());
|
||||||
boolean shouldAutoDelete = action == FeedPreferences.AutoDeleteAction.ALWAYS
|
boolean shouldAutoDelete = action == FeedPreferences.AutoDeleteAction.ALWAYS
|
||||||
|| (action == FeedPreferences.AutoDeleteAction.GLOBAL
|
|| (action == FeedPreferences.AutoDeleteAction.GLOBAL && autoDeleteEnabledGlobally);
|
||||||
&& FeedUtil.shouldAutoDeleteItemsOnThatFeed(item.getFeed()));
|
|
||||||
if (shouldAutoDelete && (!item.isTagged(FeedItem.TAG_FAVORITE)
|
if (shouldAutoDelete && (!item.isTagged(FeedItem.TAG_FAVORITE)
|
||||||
|| !UserPreferences.shouldFavoriteKeepEpisode())) {
|
|| !UserPreferences.shouldFavoriteKeepEpisode())) {
|
||||||
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media);
|
DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media);
|
||||||
|
@ -1889,8 +1888,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextChapter = ChapterUtils.getCurrentChapterIndex(
|
int nextChapter = Chapter.getAfterPosition(chapters, mediaPlayer.getPosition()) + 1;
|
||||||
mediaPlayer.getPlayable(), mediaPlayer.getPosition()) + 1;
|
|
||||||
|
|
||||||
if (chapters.size() < nextChapter + 1) {
|
if (chapters.size() < nextChapter + 1) {
|
||||||
// We are on the last chapter, just fallback to the next episode
|
// We are on the last chapter, just fallback to the next episode
|
||||||
|
|
|
@ -9,7 +9,7 @@ import android.util.Log;
|
||||||
|
|
||||||
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
|
import de.danoeh.antennapod.event.playback.SleepTimerUpdatedEvent;
|
||||||
import de.danoeh.antennapod.storage.preferences.SleepTimerPreferences;
|
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 de.danoeh.antennapod.ui.widget.WidgetUpdater;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/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
|
python ./createContributors.py
|
||||||
|
|
|
@ -16,7 +16,6 @@ dependencyResolutionManagement {
|
||||||
}
|
}
|
||||||
|
|
||||||
include ':app'
|
include ':app'
|
||||||
include ':core'
|
|
||||||
include ':event'
|
include ':event'
|
||||||
include ':model'
|
include ':model'
|
||||||
|
|
||||||
|
@ -42,6 +41,7 @@ include ':storage:importexport'
|
||||||
include ':storage:preferences'
|
include ':storage:preferences'
|
||||||
|
|
||||||
include ':ui:app-start-intent'
|
include ':ui:app-start-intent'
|
||||||
|
include ':ui:chapters'
|
||||||
include ':ui:common'
|
include ':ui:common'
|
||||||
include ':ui:discovery'
|
include ':ui:discovery'
|
||||||
include ':ui:echo'
|
include ':ui:echo'
|
||||||
|
|
|
@ -30,6 +30,7 @@ dependencies {
|
||||||
implementation "com.google.guava:guava:31.0.1-android"
|
implementation "com.google.guava:guava:31.0.1-android"
|
||||||
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
|
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
|
||||||
|
|
||||||
|
testImplementation project(':parser:feed')
|
||||||
testImplementation "junit:junit:$junitVersion"
|
testImplementation "junit:junit:$junitVersion"
|
||||||
testImplementation "androidx.test:core:$testCoreVersion"
|
testImplementation "androidx.test:core:$testCoreVersion"
|
||||||
testImplementation "org.robolectric:robolectric:$robolectricVersion"
|
testImplementation "org.robolectric:robolectric:$robolectricVersion"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.storage.database;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
|
@ -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 de.danoeh.antennapod.parser.feed.util.DateUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
@ -73,9 +73,12 @@ public class ReleaseScheduleGuesserRealWorldTest {
|
||||||
|
|
||||||
final boolean is3hoursClose = Math.abs(dateActual.getTime() - guess.nextExpectedDate.getTime())
|
final boolean is3hoursClose = Math.abs(dateActual.getTime() - guess.nextExpectedDate.getTime())
|
||||||
< 3 * ReleaseScheduleGuesser.ONE_HOUR;
|
< 3 * ReleaseScheduleGuesser.ONE_HOUR;
|
||||||
System.out.println(lineNr + " guessed: " + DATE_FORMAT.format(guess.nextExpectedDate)
|
//noinspection ConstantValue
|
||||||
+ ", actual: " + DATE_FORMAT.format(dateActual)
|
if (false) {
|
||||||
+ " " + guess.schedule.name() + (is3hoursClose ? " ✔" : ""));
|
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();
|
long deltaTime = dateActual.getTime() - guess.nextExpectedDate.getTime();
|
||||||
int histogramClass = (int) Math.max(0, Math.min(100, deltaTime / ReleaseScheduleGuesser.ONE_HOUR + 50));
|
int histogramClass = (int) Math.max(0, Math.min(100, deltaTime / ReleaseScheduleGuesser.ONE_HOUR + 50));
|
||||||
histogram[histogramClass]++;
|
histogram[histogramClass]++;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.storage.database;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_DAY;
|
import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_DAY;
|
||||||
import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_HOUR;
|
import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_HOUR;
|
||||||
import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.ONE_MINUTE;
|
import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.ONE_MINUTE;
|
||||||
import static de.danoeh.antennapod.core.util.ReleaseScheduleGuesser.performGuess;
|
import static de.danoeh.antennapod.storage.database.ReleaseScheduleGuesser.performGuess;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
Can't render this file because it has a wrong number of fields in line 10.
|
0
core/src/test/resources/release_dates.sh → storage/database/src/test/resources/release_dates.sh
Executable file → Normal file
0
core/src/test/resources/release_dates.sh → storage/database/src/test/resources/release_dates.sh
Executable file → Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# :ui:chapters
|
||||||
|
|
||||||
|
This module provides chapter loading and merging for display, but not the actual UI to display them.
|
|
@ -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"
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.ui.chapters;
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.ui.chapters;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -41,19 +41,6 @@ public class ChapterUtils {
|
||||||
private 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) {
|
public static void loadChapters(Playable playable, Context context, boolean forceRefresh) {
|
||||||
if (playable.getChapters() != null && !forceRefresh) {
|
if (playable.getChapters() != null && !forceRefresh) {
|
||||||
// Already loaded
|
// Already loaded
|
|
@ -16,6 +16,8 @@ dependencies {
|
||||||
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
|
implementation "androidx.viewpager2:viewpager2:$viewPager2Version"
|
||||||
implementation "com.google.android.material:material:$googleMaterialVersion"
|
implementation "com.google.android.material:material:$googleMaterialVersion"
|
||||||
implementation "androidx.core:core-splashscreen:1.0.0"
|
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"
|
testImplementation "junit:junit:$junitVersion"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.ui.common;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
@ -6,8 +6,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an AlertDialog which asks the user to confirm something. Other
|
* Creates an AlertDialog which asks the user to confirm something. Other
|
||||||
* classes can handle events like confirmation or cancellation.
|
* classes can handle events like confirmation or cancellation.
|
|
@ -1,4 +1,4 @@
|
||||||
package de.danoeh.antennapod.core.util;
|
package de.danoeh.antennapod.ui.common;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -8,7 +8,6 @@ import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import de.danoeh.antennapod.core.R;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
|
@ -52,7 +51,6 @@ public class IntentUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getLocalizedWebsiteLink(Context context) {
|
public static String getLocalizedWebsiteLink(Context context) {
|
||||||
try (InputStream is = context.getAssets().open("website-languages.txt")) {
|
try (InputStream is = context.getAssets().open("website-languages.txt")) {
|
||||||
String[] languages = IOUtils.toString(is, StandardCharsets.UTF_8.name()).split("\n");
|
String[] languages = IOUtils.toString(is, StandardCharsets.UTF_8.name()).split("\n");
|
|
@ -23,7 +23,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":core")
|
|
||||||
implementation project(":event")
|
implementation project(":event")
|
||||||
implementation project(":net:common")
|
implementation project(":net:common")
|
||||||
implementation project(":net:sync:model")
|
implementation project(":net:sync:model")
|
||||||
|
|
|
@ -10,7 +10,7 @@ import android.os.Bundle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
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.BuildConfig;
|
||||||
import de.danoeh.antennapod.ui.preferences.R;
|
import de.danoeh.antennapod.ui.preferences.R;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
import androidx.fragment.app.ListFragment;
|
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 de.danoeh.antennapod.ui.preferences.R;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.SingleOnSubscribe;
|
import io.reactivex.SingleOnSubscribe;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package de.danoeh.antennapod.ui.preferences.screen.downloads;
|
package de.danoeh.antennapod.ui.preferences.screen.downloads;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.StatFs;
|
||||||
import android.text.format.Formatter;
|
import android.text.format.Formatter;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -12,7 +13,6 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.core.util.Consumer;
|
import androidx.core.util.Consumer;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
import de.danoeh.antennapod.storage.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
|
||||||
import de.danoeh.antennapod.ui.preferences.R;
|
import de.danoeh.antennapod.ui.preferences.R;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -125,11 +125,17 @@ public class DataFolderAdapter extends RecyclerView.Adapter<DataFolderAdapter.Vi
|
||||||
}
|
}
|
||||||
|
|
||||||
long getAvailableSpace() {
|
long getAvailableSpace() {
|
||||||
return StorageUtils.getFreeSpaceAvailable(path);
|
StatFs stat = new StatFs(path);
|
||||||
|
long availableBlocks = stat.getAvailableBlocksLong();
|
||||||
|
long blockSize = stat.getBlockSizeLong();
|
||||||
|
return availableBlocks * blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
long getTotalSpace() {
|
long getTotalSpace() {
|
||||||
return StorageUtils.getTotalSpaceAvailable(path);
|
StatFs stat = new StatFs(path);
|
||||||
|
long blockCount = stat.getBlockCountLong();
|
||||||
|
long blockSize = stat.getBlockSizeLong();
|
||||||
|
return blockCount * blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getUsagePercentage() {
|
int getUsagePercentage() {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue