made conditional for auto-download easier to read, moved log message output to a better spot

This commit is contained in:
Tom Hennen 2015-01-06 21:42:04 -05:00
parent abc1c8a8dc
commit fe5d1debc2
2 changed files with 14 additions and 7 deletions

View File

@ -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);

View File

@ -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));
}