From ff369010074b058bb734ce24c66508300e6e9ac6 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 1 Apr 2021 12:18:54 -0400 Subject: [PATCH] Don't repeatedly vibrate/make sounds on download progress --- .../java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt | 2 +- .../eu/kanade/tachiyomi/data/download/DownloadNotifier.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt index c67c02b28..95f2ede19 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupNotifier.kt @@ -24,6 +24,7 @@ class BackupNotifier(private val context: Context) { setSmallIcon(R.drawable.ic_tachi) setAutoCancel(false) setOngoing(true) + setOnlyAlertOnce(true) } private val completeNotificationBuilder = context.notificationBuilder(Notifications.CHANNEL_BACKUP_RESTORE_COMPLETE) { @@ -41,7 +42,6 @@ class BackupNotifier(private val context: Context) { setContentTitle(context.getString(R.string.creating_backup)) setProgress(0, 0, true) - setOnlyAlertOnce(true) } builder.show(Notifications.ID_BACKUP_PROGRESS) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index c2887a2e0..f7a43362d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt @@ -27,6 +27,9 @@ internal class DownloadNotifier(private val context: Context) { private val progressNotificationBuilder by lazy { context.notificationBuilder(Notifications.CHANNEL_DOWNLOADER_PROGRESS) { setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher)) + setAutoCancel(false) + setOngoing(true) + setOnlyAlertOnce(true) } } @@ -84,7 +87,6 @@ internal class DownloadNotifier(private val context: Context) { // Check if first call. if (!isDownloading) { setSmallIcon(android.R.drawable.stat_sys_download) - setAutoCancel(false) clearActions() // Open download manager when clicked setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) @@ -127,7 +129,6 @@ internal class DownloadNotifier(private val context: Context) { setContentTitle(context.getString(R.string.chapter_paused)) setContentText(context.getString(R.string.download_notifier_download_paused)) setSmallIcon(R.drawable.ic_pause_24dp) - setAutoCancel(false) setProgress(0, 0, false) clearActions() // Open download manager when clicked @@ -217,7 +218,6 @@ internal class DownloadNotifier(private val context: Context) { setContentText(error ?: context.getString(R.string.download_notifier_unknown_error)) setSmallIcon(android.R.drawable.stat_sys_warning) clearActions() - setAutoCancel(false) setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) setProgress(0, 0, false)