Set download notifications non-dismissable

This commit is contained in:
Pupil
2020-02-13 20:29:45 +09:00
parent 04c500f3d8
commit 49d87a08d2
2 changed files with 6 additions and 0 deletions

View File

@@ -338,7 +338,9 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
if (isCompleted(galleryID))
notification[galleryID]
?.setContentText(getString(R.string.reader_notification_complete))
?.setSmallIcon(android.R.drawable.stat_sys_download_done)
?.setProgress(0, 0, false)
?.setOngoing(false)
else
notification[galleryID]
?.setProgress(max, progress, false)
@@ -365,6 +367,7 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
setSmallIcon(android.R.drawable.stat_sys_download) // had to use this because old android doesn't support VectorDrawable on Notification :P
setContentIntent(pendingIntent)
setProgress(0, 0, true)
setOngoing(true)
})
}

View File

@@ -145,6 +145,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
setContentTitle(context.getString(R.string.update_notification_description))
setSmallIcon(android.R.drawable.stat_sys_download)
priority = NotificationCompat.PRIORITY_LOW
setOngoing(true)
}
CoroutineScope(Dispatchers.IO).launch io@{
@@ -160,6 +161,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
setContentText(context.getString(R.string.update_failed))
setMessage(context.getString(R.string.update_failed_message))
setSmallIcon(android.R.drawable.stat_sys_download_done)
setOngoing(false)
}
notificationManager.cancel(UPDATE_NOTIFICATION_ID)
@@ -179,6 +181,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
setSmallIcon(android.R.drawable.stat_sys_download_done)
setContentTitle(context.getString(R.string.update_download_completed))
setContentText(context.getString(R.string.update_download_completed_description))
setOngoing(false)
}
notificationManager.cancel(UPDATE_NOTIFICATION_ID)