From 252d7def15cc26bf472af0d51047a9009791f1e5 Mon Sep 17 00:00:00 2001 From: Jonas Mayer Date: Tue, 9 Jan 2024 18:02:19 +0100 Subject: [PATCH] Improve Notifications Signed-off-by: Jonas Mayer --- .../files/downloader/DownloadNotificationManager.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt b/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt index 88c50e5fb3e9..f3c7cb0d5bc5 100644 --- a/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt +++ b/app/src/main/java/com/nextcloud/client/files/downloader/DownloadNotificationManager.kt @@ -102,14 +102,16 @@ class DownloadNotificationManager( val fileName: String = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR) + 1) val text = String.format(context.getString(R.string.downloader_download_in_progress_content), percent, fileName) - updateNotificationText(text, false) + val title = + context.getString(R.string.downloader_download_in_progress_ticker) + updateNotificationText(title, text, false) } } @Suppress("MagicNumber") fun showCompleteNotification(text: String) { Handler(Looper.getMainLooper()).postDelayed({ - updateNotificationText(text, true) + updateNotificationText(null,text, true) dismissNotification() }, 3000) } @@ -126,17 +128,19 @@ class DownloadNotificationManager( notificationBuilder.run { setProgress(0, 0, false) + setContentTitle(null) setContentText(text) + setOngoing(false) notificationManager.notify(notifyId, this.build()) } } - private fun updateNotificationText(text: String, cancelProgressBar: Boolean) { + private fun updateNotificationText(title: String?, text: String, cancelProgressBar: Boolean) { notificationBuilder.run { if (cancelProgressBar) { setProgress(0, 0, false) } - + setContentTitle(title) setContentText(text) notificationManager.notify(id, this.build()) }