diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java | 18 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java | 3 |
2 files changed, 14 insertions, 7 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index b02e621ae..96baeeb96 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -463,12 +463,20 @@ public final class DBTasks { return autodownloadExec.submit(new Runnable() { @Override public void run() { - if (BuildConfig.DEBUG) + + // true if we should auto download based on network status + boolean networkShouldAutoDl = NetworkUtils.autodownloadNetworkAvailable(context) + && UserPreferences.isEnableAutodownload(); + + // true if we should auto download based on power status + boolean powerShouldAutoDl = PowerUtils.deviceCharging(context) + || UserPreferences.isEnableAutodownloadOnBattery(); + + // we should only auto download if both network AND power are happy + if (networkShouldAutoDl && powerShouldAutoDl) { + Log.d(TAG, "Performing auto-dl of undownloaded episodes"); - if ((NetworkUtils.autodownloadNetworkAvailable(context) - && UserPreferences.isEnableAutodownload()) - && (PowerUtils.deviceCharging(context) - || UserPreferences.isEnableAutodownloadOnBattery())) { + final List<FeedItem> queue = DBReader.getQueue(context); final List<FeedItem> unreadItems = DBReader .getUnreadItemsList(context); diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java index a94bf43d7..d0cdad649 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java @@ -255,8 +255,7 @@ public class DownloadRequester { * Cancels all running downloads */ public synchronized void cancelAllDownloads(Context context) { - if (BuildConfig.DEBUG) - Log.d(TAG, "Cancelling all running downloads"); + Log.d(TAG, "Cancelling all running downloads"); context.sendBroadcast(new Intent( DownloadService.ACTION_CANCEL_ALL_DOWNLOADS)); } |