From c6a96b3970f0ba4643f438155653790973fa00f6 Mon Sep 17 00:00:00 2001 From: Secozzi <49240133+Secozzi@users.noreply.github.com> Date: Sat, 9 Aug 2025 20:21:25 +0200 Subject: [PATCH] Fix height of description not being calculated correctly if images are present (#2382) --- CHANGELOG.md | 2 ++ .../manga/components/MangaInfoHeader.kt | 34 ++++++------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e261dbc..8f710f116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co - `Other` - for technical stuff. ## [Unreleased] +### Fixes +- Fix height of description not being calculated correctly if images are present ([@Secozzi](https://github.com/Secozzi)) ([#2382](https://github.com/mihonapp/mihon/pull/2382)) ## [v0.19.1] - 2025-08-07 ### Changed diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index 1fb41c7e9..0ecb966ac 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -53,6 +53,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -68,6 +69,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.Layout +import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.LinkAnnotation import androidx.compose.ui.text.SpanStyle @@ -618,6 +620,7 @@ private fun MangaSummary( targetValue = if (expanded) 1f else 0f, label = "summary", ) + var infoHeight by remember { mutableIntStateOf(0) } Layout( modifier = modifier.clipToBounds(), contents = listOf( @@ -630,25 +633,11 @@ private fun MangaSummary( ) }, { - Column { - MangaNotesSection( - content = notes, - expanded = true, - onEditNotes = onEditNotesClicked, - ) - MarkdownRender( - content = description, - modifier = Modifier.secondaryItemAlpha(), - annotator = descriptionAnnotator( - loadImages = loadImages, - linkStyle = getMarkdownLinkStyle().toSpanStyle(), - ), - loadImages = loadImages, - ) - } - }, - { - Column { + Column( + modifier = Modifier.onSizeChanged { size -> + infoHeight = size.height + }, + ) { MangaNotesSection( content = notes, expanded = expanded, @@ -685,14 +674,11 @@ private fun MangaSummary( } }, ), - ) { (shrunk, expanded, actual, scrim), constraints -> + ) { (shrunk, actual, scrim), constraints -> val shrunkHeight = shrunk.single() .measure(constraints) .height - val expandedHeight = expanded.single() - .measure(constraints) - .height - val heightDelta = expandedHeight - shrunkHeight + val heightDelta = infoHeight - shrunkHeight val scrimHeight = 24.dp.roundToPx() val actualPlaceable = actual.single()