diff options
Diffstat (limited to 'core')
6 files changed, 56 insertions, 109 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 4f871e83b..9db5eb212 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -805,14 +805,6 @@ public class UserPreferences { prefs.edit().putString(PREF_MEDIA_PLAYER, "sonic").apply(); } - public static void enableExoplayer() { - prefs.edit().putString(PREF_MEDIA_PLAYER, PREF_MEDIA_PLAYER_EXOPLAYER).apply(); - } - - public static void enableBuiltin() { - prefs.edit().putString(PREF_MEDIA_PLAYER, "builtin").apply(); - } - public static boolean stereoToMono() { return prefs.getBoolean(PREF_STEREO_TO_MONO, false); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index edcaacefc..e01d1fdf2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -151,7 +151,6 @@ public class PlaybackService extends MediaBrowserServiceCompat { public static final int EXTRA_CODE_CAST = 3; public static final int NOTIFICATION_TYPE_ERROR = 0; - public static final int NOTIFICATION_TYPE_INFO = 1; public static final int NOTIFICATION_TYPE_BUFFER_UPDATE = 2; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index e6d21794c..e2da40ec3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -866,17 +866,15 @@ public final class DBReader { } /** - * Searches the DB for statistics + * Searches the DB for statistics. * - * @return The StatisticsInfo object + * @return The list of statistics objects */ @NonNull - public static StatisticsData getStatistics() { + public static List<StatisticsItem> getStatistics() { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); - long totalTimeCountAll = 0; - long totalTime = 0; List<StatisticsItem> feedTime = new ArrayList<>(); List<Feed> feeds = getFeedList(); @@ -922,72 +920,10 @@ public final class DBReader { feedTime.add(new StatisticsItem( feed, feedTotalTime, feedPlayedTime, feedPlayedTimeCountAll, episodes, episodesStarted, episodesStartedIncludingMarked, totalDownloadSize)); - totalTime += feedPlayedTime; - totalTimeCountAll += feedPlayedTimeCountAll; } adapter.close(); - return new StatisticsData(totalTime, totalTimeCountAll, feedTime); - } - - public static class StatisticsData { - /** - * Simply sums up time of podcasts that are marked as played - */ - public final long totalTimeCountAll; - - /** - * Respects speed, listening twice, ... - */ - public final long totalTime; - - public final List<StatisticsItem> feeds; - - public StatisticsData(long totalTime, long totalTimeCountAll, List<StatisticsItem> feeds) { - this.totalTime = totalTime; - this.totalTimeCountAll = totalTimeCountAll; - this.feeds = feeds; - } - } - - public static class StatisticsItem { - public final Feed feed; - public final long time; - - /** - * Respects speed, listening twice, ... - */ - public final long timePlayed; - /** - * Simply sums up time of podcasts that are marked as played - */ - public final long timePlayedCountAll; - public final long episodes; - /** - * Episodes that are actually played - */ - public final long episodesStarted; - /** - * All episodes that are marked as played (or have position != 0) - */ - public final long episodesStartedIncludingMarked; - /** - * Simply sums up the size of download podcasts - */ - public final long totalDownloadSize; - - public StatisticsItem(Feed feed, long time, long timePlayed, long timePlayedCountAll, - long episodes, long episodesStarted, long episodesStartedIncludingMarked, - long totalDownloadSize) { - this.feed = feed; - this.time = time; - this.timePlayed = timePlayed; - this.timePlayedCountAll = timePlayedCountAll; - this.episodes = episodes; - this.episodesStarted = episodesStarted; - this.episodesStartedIncludingMarked = episodesStartedIncludingMarked; - this.totalDownloadSize = totalDownloadSize; - } + return feedTime; } /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java new file mode 100644 index 000000000..f96af185b --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/StatisticsItem.java @@ -0,0 +1,51 @@ +package de.danoeh.antennapod.core.storage; + +import de.danoeh.antennapod.core.feed.Feed; + +public class StatisticsItem { + public final Feed feed; + public final long time; + + /** + * Respects speed, listening twice, ... + */ + public final long timePlayed; + + /** + * Simply sums up time of podcasts that are marked as played. + */ + public final long timePlayedCountAll; + + /** + * Number of episodes. + */ + public final long episodes; + + /** + * Episodes that are actually played. + */ + public final long episodesStarted; + + /** + * All episodes that are marked as played (or have position != 0). + */ + public final long episodesStartedIncludingMarked; + + /** + * Simply sums up the size of download podcasts. + */ + public final long totalDownloadSize; + + public StatisticsItem(Feed feed, long time, long timePlayed, long timePlayedCountAll, + long episodes, long episodesStarted, long episodesStartedIncludingMarked, + long totalDownloadSize) { + this.feed = feed; + this.time = time; + this.timePlayed = timePlayed; + this.timePlayedCountAll = timePlayedCountAll; + this.episodes = episodes; + this.episodesStarted = episodesStarted; + this.episodesStartedIncludingMarked = episodesStartedIncludingMarked; + this.totalDownloadSize = totalDownloadSize; + } +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java index 656b518bf..959a3e574 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java @@ -38,6 +38,7 @@ public class IntentUtils { public static void openInBrowser(Context context, String url) { try { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(myIntent); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.pref_no_browser_found, Toast.LENGTH_LONG).show(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java b/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java index 9408be348..ec8b8a430 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/QueueAccess.java @@ -26,36 +26,4 @@ public abstract class QueueAccess { private QueueAccess() { } - - public static QueueAccess ItemListAccess(final List<FeedItem> items) { - return new QueueAccess() { - @Override - public boolean contains(long id) { - if (items == null) { - return false; - } - for (FeedItem item : items) { - if (item.getId() == id) { - return true; - } - } - return false; - } - - @Override - public boolean remove(long id) { - Iterator<FeedItem> it = items.iterator(); - FeedItem item; - while (it.hasNext()) { - item = it.next(); - if (item.getId() == id) { - it.remove(); - return true; - } - } - return false; - } - }; - } - } |