From 7c99687aadd174f3387ee5ff9befd3c7265e101a Mon Sep 17 00:00:00 2001 From: Ismael Ares Date: Mon, 16 Nov 2026 13:44:44 +0100 Subject: [PATCH] fix(queue): keep the "Next up" title on one line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The queue header title used headlineLarge in a weighted column next to the source badge (up to 190dp). Longer translations such as Spanish "A continuación" did not fit and were broken mid-word across lines. Keep the title on a single line and let it shrink to fit (auto-size down to 20sp), cap it at 60% of the header width, and give the remaining space to the source badge, which already ellipsizes its label. --- .../components/QueueBottomSheet.kt | 99 +++++++++++-------- 1 file changed, 59 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/com/theveloper/pixelplay/presentation/components/QueueBottomSheet.kt b/app/src/main/java/com/theveloper/pixelplay/presentation/components/QueueBottomSheet.kt index a3f564732a..f89ad1e9d9 100644 --- a/app/src/main/java/com/theveloper/pixelplay/presentation/components/QueueBottomSheet.kt +++ b/app/src/main/java/com/theveloper/pixelplay/presentation/components/QueueBottomSheet.kt @@ -135,6 +135,8 @@ import androidx.activity.compose.BackHandler import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.compose.foundation.text.TextAutoSize import androidx.core.view.HapticFeedbackConstantsCompat import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.media3.common.Player @@ -1318,51 +1320,68 @@ private fun QueueHeader( val view = LocalView.current val appHapticsConfig = LocalAppHapticsConfig.current - Row( - modifier = modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(16.dp), - verticalAlignment = Alignment.Top - ) { - Column( - modifier = Modifier.weight(1f), - verticalArrangement = Arrangement.spacedBy(4.dp) + // Keep the title on a single line: it shrinks to fit instead of breaking mid-word (e.g. + // "A continuación"), and the source badge takes the remaining width, ellipsizing if needed. + BoxWithConstraints(modifier = modifier.fillMaxWidth()) { + val titleMaxWidth = maxWidth * 0.6f + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(16.dp), + verticalAlignment = Alignment.Top ) { - Text( - modifier = Modifier.clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - performAppCompatHapticFeedback( - view, - appHapticsConfig, - HapticFeedbackConstantsCompat.GESTURE_START - ) - onLocateCurrentSong() - }, - text = stringResource(R.string.queue_next_up_label), - style = MaterialTheme.typography.headlineLarge.copy( + Column( + modifier = Modifier.widthIn(max = titleMaxWidth), + verticalArrangement = Arrangement.spacedBy(4.dp) + ) { + val titleStyle = MaterialTheme.typography.headlineLarge.copy( fontFamily = GoogleSansRounded, fontWeight = FontWeight.SemiBold - ), - color = MaterialTheme.colorScheme.onSurface - ) - Text( - text = when { - queueCount <= 0 -> stringResource(R.string.queue_tracks_empty) - else -> pluralStringResource( - R.plurals.queue_tracks_lined_up, - queueCount, - queueCount + ) + Text( + modifier = Modifier.clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { + performAppCompatHapticFeedback( + view, + appHapticsConfig, + HapticFeedbackConstantsCompat.GESTURE_START + ) + onLocateCurrentSong() + }, + text = stringResource(R.string.queue_next_up_label), + style = titleStyle, + color = MaterialTheme.colorScheme.onSurface, + maxLines = 1, + softWrap = false, + overflow = TextOverflow.Ellipsis, + autoSize = TextAutoSize.StepBased( + minFontSize = 20.sp, + maxFontSize = titleStyle.fontSize ) - }, - style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant - ) + ) + Text( + text = when { + queueCount <= 0 -> stringResource(R.string.queue_tracks_empty) + else -> pluralStringResource( + R.plurals.queue_tracks_lined_up, + queueCount, + queueCount + ) + }, + style = MaterialTheme.typography.bodyMedium, + color = MaterialTheme.colorScheme.onSurfaceVariant + ) + } + Box( + modifier = Modifier + .weight(1f) + .padding(top = 6.dp), + contentAlignment = Alignment.TopEnd + ) { + QueueSourceBadge(queueSourceName = queueSourceName) + } } - QueueSourceBadge( - queueSourceName = queueSourceName, - modifier = Modifier.padding(top = 6.dp) - ) } }