Fix startForeground for DownloadService

pull/153/head
Koitharu 4 years ago
parent 5e82c75893
commit d37eb07301
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -24,7 +24,7 @@ class ForegroundNotificationSwitcher(
@Synchronized @Synchronized
fun notify(startId: Int, notification: Notification) { fun notify(startId: Int, notification: Notification) {
if (notifications.isEmpty()) { if (notifications.isEmpty()) {
StartForegroundRunnable(startId, notification) service.startForeground(startId, notification)
} else { } else {
notificationManager.notify(startId, notification) notificationManager.notify(startId, notification)
} }
@ -46,16 +46,6 @@ class ForegroundNotificationSwitcher(
handler.postDelayed(NotifyRunnable(startId, notification), DEFAULT_DELAY) handler.postDelayed(NotifyRunnable(startId, notification), DEFAULT_DELAY)
} }
private inner class StartForegroundRunnable(
private val startId: Int,
private val notification: Notification,
) : Runnable {
override fun run() {
service.startForeground(startId, notification)
}
}
private inner class NotifyRunnable( private inner class NotifyRunnable(
private val startId: Int, private val startId: Int,
private val notification: Notification?, private val notification: Notification?,

Loading…
Cancel
Save