From eba07485e01b87a844ab2d943426fc834cdcb8c6 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 14 Nov 2019 19:32:12 -0800 Subject: [PATCH] Chopping off longer chapter updates in notifcations if theres more than 5 new chapters Fix to french strings --- .../kanade/tachiyomi/data/library/LibraryUpdateService.kt | 6 +++++- .../eu/kanade/tachiyomi/ui/library/LibraryController.kt | 3 +-- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values/strings.xml | 1 + 4 files changed, 8 insertions(+), 4 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 e0b472e292..f1036e30df 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 @@ -467,7 +467,11 @@ class LibraryUpdateService( setContentTitle(manga.title.chop(45)) color = ContextCompat.getColor(this@LibraryUpdateService, R.color.colorAccentLight) setContentText(chapterNames.first()) - setStyle(NotificationCompat.BigTextStyle().bigText(chapterNames.joinToString("\n"))) + setStyle(NotificationCompat.BigTextStyle().bigText( + if (chapterNames.size > 5) { + "${chapterNames.take(4).joinToString(", ")}, " + + getString(R.string.notification_and_n_more, (chapterNames.size - 4)) + } else chapterNames.joinToString(", "))) priority = NotificationCompat.PRIORITY_HIGH setGroup(Notifications.GROUP_NEW_CHAPTERS) setContentIntent( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index cf77f861ca..8552581c8e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -466,8 +466,7 @@ class LibraryController( } private fun startMangaMigration() { - migratingMangas.clear() - migratingMangas.addAll(selectedMangas) + migratingMangas = selectedMangas.distinctBy { it.id }.toMutableSet() destroyActionModeIfNeeded() val manga = migratingMangas.firstOrNull() ?: return val searchController = SearchController(manga) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 201357d972..676d4705b9 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -363,7 +363,7 @@ Que voulez-vous sauvegarder ? Le défaut ne peut pas être selectionné avec des autres catégories Supprimer les chapitres téléchargés ? - Pour %1$s chapitres + Pour %1$d chapitres Suivi Nombre de chapitres Actualisations diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index facf84feac..c8a8e986f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -474,6 +474,7 @@ Update progress: %1$d/%2$d New chapters found For %1$d titles + and %1$d more. Failed to update cover Please add the manga to your library before doing this Sync canceled