summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java5
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java15
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/PlaybackStatus.java22
3 files changed, 25 insertions, 17 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java
index c410376c2..5e1e1127a 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java
@@ -10,10 +10,10 @@ import java.util.List;
import de.danoeh.antennapod.core.service.download.DownloadRequest;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
import de.danoeh.antennapod.core.service.download.DownloadService;
+import de.danoeh.antennapod.core.util.PlaybackStatus;
import de.danoeh.antennapod.model.feed.FeedItem;
import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.core.preferences.UserPreferences;
-import de.danoeh.antennapod.core.util.FeedItemUtil;
import de.danoeh.antennapod.core.util.NetworkUtils;
import de.danoeh.antennapod.core.util.PowerUtils;
@@ -68,7 +68,8 @@ public class AutomaticDownloadAlgorithm {
Iterator<FeedItem> it = candidates.iterator();
while (it.hasNext()) {
FeedItem item = it.next();
- if (!item.isAutoDownloadable(System.currentTimeMillis()) || FeedItemUtil.isPlaying(item.getMedia())
+ if (!item.isAutoDownloadable(System.currentTimeMillis())
+ || PlaybackStatus.isPlaying(item.getMedia())
|| item.getFeed().isLocalFeed()) {
it.remove();
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java
index 82c132dc1..e6f6654ca 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java
@@ -75,19 +75,4 @@ public class FeedItemUtil {
int smartMarkAsPlayedSecs = UserPreferences.getSmartMarkAsPlayedSecs();
return media.getDuration() > 0 && media.getPosition() >= media.getDuration() - smartMarkAsPlayedSecs * 1000;
}
-
- /**
- * Reads playback preferences to determine whether this FeedMedia object is
- * currently being played and the current player status is playing.
- */
- public static boolean isCurrentlyPlaying(FeedMedia media) {
- return isPlaying(media) && PlaybackService.isRunning
- && ((PlaybackPreferences.getCurrentPlayerStatus() == PlaybackPreferences.PLAYER_STATUS_PLAYING));
- }
-
- public static boolean isPlaying(FeedMedia media) {
- return PlaybackPreferences.getCurrentlyPlayingMediaType() == FeedMedia.PLAYABLE_TYPE_FEEDMEDIA
- && media != null
- && PlaybackPreferences.getCurrentlyPlayingFeedMediaId() == media.getId();
- }
}
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/PlaybackStatus.java b/core/src/main/java/de/danoeh/antennapod/core/util/PlaybackStatus.java
new file mode 100644
index 000000000..3c07d325b
--- /dev/null
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/PlaybackStatus.java
@@ -0,0 +1,22 @@
+package de.danoeh.antennapod.core.util;
+
+import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
+import de.danoeh.antennapod.core.service.playback.PlaybackService;
+import de.danoeh.antennapod.model.feed.FeedMedia;
+
+public abstract class PlaybackStatus {
+ /**
+ * Reads playback preferences to determine whether this FeedMedia object is
+ * currently being played and the current player status is playing.
+ */
+ public static boolean isCurrentlyPlaying(FeedMedia media) {
+ return isPlaying(media) && PlaybackService.isRunning
+ && ((PlaybackPreferences.getCurrentPlayerStatus() == PlaybackPreferences.PLAYER_STATUS_PLAYING));
+ }
+
+ public static boolean isPlaying(FeedMedia media) {
+ return PlaybackPreferences.getCurrentlyPlayingMediaType() == FeedMedia.PLAYABLE_TYPE_FEEDMEDIA
+ && media != null
+ && PlaybackPreferences.getCurrentlyPlayingFeedMediaId() == media.getId();
+ }
+}