From 3094d084d6ece4edd2304fcc9500fc73231a82ab Mon Sep 17 00:00:00 2001 From: len Date: Sat, 1 Apr 2017 12:05:09 +0200 Subject: [PATCH] Library notification: handle only one update as a special case --- .../tachiyomi/data/library/LibraryUpdateService.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 6ccc28098..e2eda3b72 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -397,15 +397,17 @@ class LibraryUpdateService( } } - val title = getString(R.string.notification_new_chapters) - val text = getString(R.string.notification_new_chapters_text, newUpdates.size) - notificationManager.notify(Constants.NOTIFICATION_LIBRARY_RESULT_ID, notification { setSmallIcon(R.drawable.ic_book_white_24dp) setLargeIcon(notificationBitmap) - setContentTitle(title) - setContentText(text) - setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n"))) + setContentTitle(getString(R.string.notification_new_chapters)) + if (newUpdates.size > 1) { + setContentText(getString(R.string.notification_new_chapters_text, newUpdates.size)) + setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n"))) + } else { + setContentText(newUpdates.first()) + } + priority = NotificationCompat.PRIORITY_HIGH setContentIntent(getNotificationIntent()) setAutoCancel(true) })