Refactor notification builder extension

This commit is contained in:
arkon
2020-01-16 08:53:55 -05:00
parent a5fadcda15
commit 8aa48effaa
6 changed files with 66 additions and 51 deletions

View File

@@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.data.glide.GlideApp
import eu.kanade.tachiyomi.data.notification.NotificationHandler
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager
import java.io.File
@@ -20,7 +21,7 @@ class SaveImageNotifier(private val context: Context) {
/**
* Notification builder.
*/
private val notificationBuilder = NotificationCompat.Builder(context, Notifications.CHANNEL_COMMON)
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_COMMON)
/**
* Id of the notification.
@@ -59,8 +60,9 @@ class SaveImageNotifier(private val context: Context) {
setAutoCancel(true)
// Clear old actions if they exist
if (mActions.isNotEmpty())
if (mActions.isNotEmpty()) {
mActions.clear()
}
setContentIntent(NotificationHandler.openImagePendingActivity(context, file))
// Share action