diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt index 57b781c7b..5f504c1f6 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoHeaderAdapter.kt @@ -376,14 +376,7 @@ class MangaInfoHeaderAdapter( showMangaInfo(hasInfoContent) if (hasInfoContent) { // Update description TextView. - binding.mangaSummaryText.text = if (manga.description.isNullOrBlank()) { - view.context.getString(R.string.unknown) - } else { - // Max lines of 3 with a blank line looks whack so we remove - // any line breaks that is 2 or more and replace it with 1 - manga.description!! - .replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n") - } + binding.mangaSummaryText.text = updateDescription(manga.description, (fromSource || isTablet).not()) // SY --> if (manga.description == "meta") { @@ -465,6 +458,8 @@ class MangaInfoHeaderAdapter( binding.mangaSummarySection.transitionToEnd() } + binding.mangaSummaryText.text = updateDescription(manga.description, isCurrentlyExpanded) + binding.mangaSummaryText.maxLines = if (isCurrentlyExpanded) { maxLines } else { @@ -472,6 +467,22 @@ class MangaInfoHeaderAdapter( } } + private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence? { + return if (description.isNullOrBlank()) { + view.context.getString(R.string.unknown) + } else { + // Max lines of 3 with a blank line looks whack so we remove + // any line breaks that is 2 or more and replace it with 1 + // however, don't do this if already expanded because we need those blank lines + if (!isCurrentlyExpanded) { + description + } else { + description + .replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n") + } + } + } + private fun setChipsWithNamespace(genre: String?, meta: RaisedSearchMetadata?) { val namespaceTags = when { meta != null -> {