diff options
author | Nathan Mascitelli <mascitelli.nathan@gmail.com> | 2020-02-07 10:55:13 -0500 |
---|---|---|
committer | Nathan Mascitelli <mascitelli.nathan@gmail.com> | 2020-03-22 16:19:31 -0400 |
commit | 1eaecf8358b3c5a9b946fa5283f6f60051dbc7b5 (patch) | |
tree | a3e18be00e1f67839a5cf1005d4cb51a1c49c3c1 /core | |
parent | 39e0d20ae7db2bf263ba02ebd9cfaccd5988a96f (diff) | |
download | AntennaPod-1eaecf8358b3c5a9b946fa5283f6f60051dbc7b5.zip |
Add preferences
Diffstat (limited to 'core')
4 files changed, 12 insertions, 4 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 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<DownloadStatus> reportQueue) { + public void updateReport(List<DownloadStatus> 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; } } diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index c65aed322..54b6a9f4d 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -470,6 +470,8 @@ <string name="pref_lockscreen_background_sum">Set the lockscreen background to the current episode\'s image. As a side effect, this will also show the image in third party apps.</string> <string name="pref_showDownloadReport_title">Show Download Report</string> <string name="pref_showDownloadReport_sum">If downloads fail, generate a report that shows the details of the failure.</string> + <string name="pref_showAutoDownloadReport_title">Show Auto Download Report</string> + <string name="pref_showAutoDownloadReport_sum">Generate a report that shows the details of auto downloaded episodes.</string> <string name="pref_expand_notify_unsupport_toast">Android versions before 4.1 do not support expanded notifications.</string> <string name="pref_enqueue_location_title">Enqueue Location</string> <string name="pref_enqueue_location_sum">Add episodes to: %1$s</string> |