refactor(download): Move .show() inside with block

This commit is contained in:
Ahmad Ansori Palembani 2024-12-19 07:56:41 +07:00
parent 17eec5f6aa
commit 985ac6d7a8
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -155,9 +155,10 @@ internal class DownloadNotifier(private val context: Context) {
} }
setStyle(null) setStyle(null)
setProgress(download.pages!!.size, download.downloadedImages, false) setProgress(download.pages!!.size, download.downloadedImages, false)
// Displays the progress bar on notification
show()
} }
// Displays the progress bar on notification
notification.show()
} }
/** /**
@ -212,8 +213,9 @@ internal class DownloadNotifier(private val context: Context) {
clearActions() clearActions()
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context)) setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
setProgress(0, 0, false) setProgress(0, 0, false)
show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
} }
notification.show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
// Reset download information // Reset download information
isDownloading = false isDownloading = false
@ -291,8 +293,9 @@ internal class DownloadNotifier(private val context: Context) {
} }
color = ContextCompat.getColor(context, R.color.secondaryTachiyomi) color = ContextCompat.getColor(context, R.color.secondaryTachiyomi)
setProgress(0, 0, false) setProgress(0, 0, false)
show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
} }
notification.show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
// Reset download information // Reset download information
errorThrown = true errorThrown = true