Don't show completed notification if download error notification was shown
This commit is contained in:
parent
9e396e1624
commit
2ef277bcef
@ -119,7 +119,7 @@ internal class DownloadNotifier(private val context: Context) {
|
|||||||
/**
|
/**
|
||||||
* Show notification when download is paused.
|
* Show notification when download is paused.
|
||||||
*/
|
*/
|
||||||
fun onDownloadPaused() {
|
fun onPaused() {
|
||||||
with(progressNotificationBuilder) {
|
with(progressNotificationBuilder) {
|
||||||
setContentTitle(context.getString(R.string.chapter_paused))
|
setContentTitle(context.getString(R.string.chapter_paused))
|
||||||
setContentText(context.getString(R.string.download_notifier_download_paused))
|
setContentText(context.getString(R.string.download_notifier_download_paused))
|
||||||
@ -151,18 +151,20 @@ internal class DownloadNotifier(private val context: Context) {
|
|||||||
/**
|
/**
|
||||||
* This function shows a notification to inform download tasks are done.
|
* This function shows a notification to inform download tasks are done.
|
||||||
*/
|
*/
|
||||||
fun downloadFinished() {
|
fun onComplete() {
|
||||||
// Create notification
|
if (!errorThrown) {
|
||||||
with(completeNotificationBuilder) {
|
// Create notification
|
||||||
setContentTitle(context.getString(R.string.download_notifier_downloader_title))
|
with(completeNotificationBuilder) {
|
||||||
setContentText(context.getString(R.string.download_notifier_download_finish))
|
setContentTitle(context.getString(R.string.download_notifier_downloader_title))
|
||||||
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
setContentText(context.getString(R.string.download_notifier_download_finish))
|
||||||
clearActions()
|
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||||
setAutoCancel(true)
|
clearActions()
|
||||||
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
|
setAutoCancel(true)
|
||||||
setProgress(0, 0, false)
|
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
|
||||||
|
setProgress(0, 0, false)
|
||||||
|
}
|
||||||
|
completeNotificationBuilder.show(Notifications.ID_DOWNLOAD_CHAPTER_COMPLETE)
|
||||||
}
|
}
|
||||||
completeNotificationBuilder.show(Notifications.ID_DOWNLOAD_CHAPTER_COMPLETE)
|
|
||||||
|
|
||||||
// Reset states to default
|
// Reset states to default
|
||||||
errorThrown = false
|
errorThrown = false
|
||||||
|
@ -137,9 +137,9 @@ class Downloader(
|
|||||||
} else {
|
} else {
|
||||||
if (notifier.paused) {
|
if (notifier.paused) {
|
||||||
notifier.paused = false
|
notifier.paused = false
|
||||||
notifier.onDownloadPaused()
|
notifier.onPaused()
|
||||||
} else {
|
} else {
|
||||||
notifier.downloadFinished()
|
notifier.onComplete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
R.id.action_settings -> ReaderSettingsSheet(this).show()
|
R.id.action_settings -> ReaderSettingsSheet(this).show()
|
||||||
R.id.action_custom_filter -> {
|
R.id.action_custom_filter -> {
|
||||||
val sheet = ReaderColorFilterSheet(this)
|
val sheet = ReaderColorFilterSheet(this)
|
||||||
// Remove dimmed backdrop so changes can be previewd
|
// Remove dimmed backdrop so changes can be previewed
|
||||||
.apply { window?.setDimAmount(0f) }
|
.apply { window?.setDimAmount(0f) }
|
||||||
|
|
||||||
// Hide toolbars while sheet is open for better preview
|
// Hide toolbars while sheet is open for better preview
|
||||||
|
Loading…
Reference in New Issue
Block a user