Set download notifications non-dismissable
This commit is contained in:
@@ -338,7 +338,9 @@ class DownloadWorker private constructor(context: Context) : ContextWrapper(cont
|
|||||||
if (isCompleted(galleryID))
|
if (isCompleted(galleryID))
|
||||||
notification[galleryID]
|
notification[galleryID]
|
||||||
?.setContentText(getString(R.string.reader_notification_complete))
|
?.setContentText(getString(R.string.reader_notification_complete))
|
||||||
|
?.setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||||
?.setProgress(0, 0, false)
|
?.setProgress(0, 0, false)
|
||||||
|
?.setOngoing(false)
|
||||||
else
|
else
|
||||||
notification[galleryID]
|
notification[galleryID]
|
||||||
?.setProgress(max, progress, false)
|
?.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
|
setSmallIcon(android.R.drawable.stat_sys_download) // had to use this because old android doesn't support VectorDrawable on Notification :P
|
||||||
setContentIntent(pendingIntent)
|
setContentIntent(pendingIntent)
|
||||||
setProgress(0, 0, true)
|
setProgress(0, 0, true)
|
||||||
|
setOngoing(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
|
|||||||
setContentTitle(context.getString(R.string.update_notification_description))
|
setContentTitle(context.getString(R.string.update_notification_description))
|
||||||
setSmallIcon(android.R.drawable.stat_sys_download)
|
setSmallIcon(android.R.drawable.stat_sys_download)
|
||||||
priority = NotificationCompat.PRIORITY_LOW
|
priority = NotificationCompat.PRIORITY_LOW
|
||||||
|
setOngoing(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch io@{
|
CoroutineScope(Dispatchers.IO).launch io@{
|
||||||
@@ -160,6 +161,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
|
|||||||
setContentText(context.getString(R.string.update_failed))
|
setContentText(context.getString(R.string.update_failed))
|
||||||
setMessage(context.getString(R.string.update_failed_message))
|
setMessage(context.getString(R.string.update_failed_message))
|
||||||
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||||
|
setOngoing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationManager.cancel(UPDATE_NOTIFICATION_ID)
|
notificationManager.cancel(UPDATE_NOTIFICATION_ID)
|
||||||
@@ -179,6 +181,7 @@ fun checkUpdate(context: AppCompatActivity, force: Boolean = false) {
|
|||||||
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||||
setContentTitle(context.getString(R.string.update_download_completed))
|
setContentTitle(context.getString(R.string.update_download_completed))
|
||||||
setContentText(context.getString(R.string.update_download_completed_description))
|
setContentText(context.getString(R.string.update_download_completed_description))
|
||||||
|
setOngoing(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
notificationManager.cancel(UPDATE_NOTIFICATION_ID)
|
notificationManager.cancel(UPDATE_NOTIFICATION_ID)
|
||||||
|
|||||||
Reference in New Issue
Block a user