diff options
author | ByteHamster <info@bytehamster.com> | 2021-03-04 11:23:08 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2021-03-04 11:23:08 +0100 |
commit | 4872ea76f49321e35f740602783f655da428a4a1 (patch) | |
tree | 8184cf124f53145cced289e1df8370d5ef2c676f /core/src/main/java/de | |
parent | d4141d19a06abf92d78fe28a41a5fb7f885cacac (diff) | |
download | AntennaPod-4872ea76f49321e35f740602783f655da428a4a1.zip |
Show the name of failing downloads in the notification
Diffstat (limited to 'core/src/main/java/de')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadServiceNotification.java | 23 |
1 files changed, 18 insertions, 5 deletions
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 7c8fe9452..7b7879409 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 @@ -109,6 +109,23 @@ public class DownloadServiceNotification { return sb.toString(); } + private String createFailedDownloadNotificationContent(List<DownloadStatus> statuses) { + StringBuilder sb = new StringBuilder(); + + for (int i = 0; i < statuses.size(); i++) { + if (statuses.get(i).isSuccessful()) { + continue; + } + sb.append("• ").append(statuses.get(i).getTitle()); + sb.append(": ").append(statuses.get(i).getReason().getErrorString(context)); + if (i != statuses.size() - 1) { + sb.append("\n"); + } + } + + return sb.toString(); + } + /** * Creates a notification at the end of the service lifecycle to notify the * user about the number of completed downloads. A report will only be @@ -156,11 +173,7 @@ public class DownloadServiceNotification { iconId = R.drawable.ic_notification_sync_error; intent = ClientConfig.downloadServiceCallbacks.getReportNotificationContentIntent(context); id = R.id.notification_download_report; - content = context.getResources() - .getQuantityString(R.plurals.download_report_content, - successfulDownloads, - successfulDownloads, - failedDownloads); + content = createFailedDownloadNotificationContent(reportQueue); } NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId); |