From d37eb07301b96790aad0d9d5cb7cd725fc2c7032 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Sat, 16 Apr 2022 09:19:10 +0300 Subject: [PATCH] Fix startForeground for DownloadService --- .../ui/service/ForegroundNotificationSwitcher.kt | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/download/ui/service/ForegroundNotificationSwitcher.kt b/app/src/main/java/org/koitharu/kotatsu/download/ui/service/ForegroundNotificationSwitcher.kt index c7d0b0191..679405295 100644 --- a/app/src/main/java/org/koitharu/kotatsu/download/ui/service/ForegroundNotificationSwitcher.kt +++ b/app/src/main/java/org/koitharu/kotatsu/download/ui/service/ForegroundNotificationSwitcher.kt @@ -24,7 +24,7 @@ class ForegroundNotificationSwitcher( @Synchronized fun notify(startId: Int, notification: Notification) { if (notifications.isEmpty()) { - StartForegroundRunnable(startId, notification) + service.startForeground(startId, notification) } else { notificationManager.notify(startId, notification) } @@ -46,16 +46,6 @@ class ForegroundNotificationSwitcher( 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 val startId: Int, private val notification: Notification?,