From 1eaecf8358b3c5a9b946fa5283f6f60051dbc7b5 Mon Sep 17 00:00:00 2001 From: Nathan Mascitelli Date: Fri, 7 Feb 2020 10:55:13 -0500 Subject: Add preferences --- .../java/de/danoeh/antennapod/core/preferences/UserPreferences.java | 5 +++++ .../de/danoeh/antennapod/core/service/download/DownloadService.java | 5 +++-- .../core/service/download/DownloadServiceNotification.java | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'core/src/main/java/de/danoeh') 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 b2ea1fa62..f7b6ccb2a 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 @@ -60,6 +60,7 @@ public class UserPreferences { public static final String PREF_COMPACT_NOTIFICATION_BUTTONS = "prefCompactNotificationButtons"; public static final String PREF_LOCKSCREEN_BACKGROUND = "prefLockscreenBackground"; private static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport"; + private static final String PREF_SHOW_AUTO_DOWNLOAD_REPORT = "prefShowAutoDownloadReport"; public static final String PREF_BACK_BUTTON_BEHAVIOR = "prefBackButtonBehavior"; private static final String PREF_BACK_BUTTON_GO_TO_PAGE = "prefBackButtonGoToPage"; @@ -292,6 +293,10 @@ public class UserPreferences { return prefs.getBoolean(PREF_SHOW_DOWNLOAD_REPORT, true); } + public static boolean showAutoDownloadReport() { + return prefs.getBoolean(PREF_SHOW_AUTO_DOWNLOAD_REPORT, false); + } + public static boolean enqueueDownloadedEpisodes() { return prefs.getBoolean(PREF_ENQUEUE_DOWNLOADED, true); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index d4177df46..ee34746fc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -205,9 +205,10 @@ public class DownloadService extends Service { Log.d(TAG, "Service shutting down"); isRunning = false; + boolean showAutoDownloadReport = UserPreferences.showAutoDownloadReport(); if (ClientConfig.downloadServiceCallbacks.shouldCreateReport() - && UserPreferences.showDownloadReport()) { - notificationManager.updateReport(reportQueue); + && (UserPreferences.showDownloadReport() || showAutoDownloadReport)) { + notificationManager.updateReport(reportQueue, showAutoDownloadReport); reportQueue.clear(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java index cf7bd6e35..f83d30db0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java @@ -96,7 +96,7 @@ public class DownloadServiceNotification { * user about the number of completed downloads. A report will only be * created if there is at least one failed download excluding images */ - public void updateReport(List reportQueue) { + public void updateReport(List reportQueue, boolean showAutoDownloadReport) { // check if report should be created boolean createReport = false; int successfulDownloads = 0; @@ -110,7 +110,7 @@ public class DownloadServiceNotification { } else if (!status.isCancelled()) { failedDownloads++; } - if (failedDownloads > 0 || status.isGeneratedBySystem() && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { + if (failedDownloads > 0 || showAutoDownloadReport && status.isGeneratedBySystem() && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) { createReport = true; } } -- cgit v1.2.3