Add short description to library update notification

This commit is contained in:
len 2017-03-30 20:02:48 +02:00
parent 8ef3ab0d49
commit f9fec74ffd
2 changed files with 5 additions and 1 deletions

View File

@ -380,7 +380,6 @@ class LibraryUpdateService(
* @param updates a list of manga with new updates. * @param updates a list of manga with new updates.
*/ */
private fun showResultNotification(updates: List<Manga>) { private fun showResultNotification(updates: List<Manga>) {
val title = getString(R.string.notification_new_chapters)
val newUpdates = updates.map { it.title.chop(45) }.toMutableSet() val newUpdates = updates.map { it.title.chop(45) }.toMutableSet()
// Append new chapters from a previous, existing notification // Append new chapters from a previous, existing notification
@ -398,10 +397,14 @@ 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 { notificationManager.notify(Constants.NOTIFICATION_LIBRARY_RESULT_ID, notification {
setSmallIcon(R.drawable.ic_book_white_24dp) setSmallIcon(R.drawable.ic_book_white_24dp)
setLargeIcon(notificationBitmap) setLargeIcon(notificationBitmap)
setContentTitle(title) setContentTitle(title)
setContentText(text)
setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n"))) setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n")))
setContentIntent(getNotificationIntent()) setContentIntent(getNotificationIntent())
setAutoCancel(true) setAutoCancel(true)

View File

@ -340,6 +340,7 @@
<!-- Library update service notifications --> <!-- Library update service notifications -->
<string name="notification_update_progress">Update progress: %1$d/%2$d</string> <string name="notification_update_progress">Update progress: %1$d/%2$d</string>
<string name="notification_new_chapters">New chapters found</string> <string name="notification_new_chapters">New chapters found</string>
<string name="notification_new_chapters_text">For %1$d titles</string>
<string name="notification_cover_update_failed">Failed to update cover</string> <string name="notification_cover_update_failed">Failed to update cover</string>
<string name="notification_first_add_to_library">Please add the manga to your library before doing this</string> <string name="notification_first_add_to_library">Please add the manga to your library before doing this</string>
<string name="notification_not_connected_to_ac_title">Sync canceled</string> <string name="notification_not_connected_to_ac_title">Sync canceled</string>