Keep subtitle preview visible under a compact top-right adjust card

The adjust card stacked its slider blocks two lines tall, making the
content roughly the full height of a landscape phone screen, so even
top-anchored it buried the sample cue. Slider items collapse to single
rows (title, slider, percent) and the card anchors top-right instead of
top-center, clearing the bottom-center subtitle zone both vertically
and horizontally.
This commit is contained in:
KhooLy 2026-07-17 17:42:59 +03:00
parent 01b85c0f1b
commit f9d4e664fe
2 changed files with 38 additions and 37 deletions

View file

@ -44,6 +44,7 @@ import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
@ -137,7 +138,7 @@ fun UniversalSettingsSidebar(
}
val subtitleAdjust: @Composable () -> Unit = {
Column(
verticalArrangement = Arrangement.spacedBy(12.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
modifier = Modifier.fillMaxWidth().verticalScroll(rememberScrollState())
) {
TrackItem(
@ -493,43 +494,43 @@ private fun OpacityAdjustmentItem(
val dragged by sliderInteraction.collectIsDraggedAsState()
val pressed by sliderInteraction.collectIsPressedAsState()
LaunchedEffect(dragged, pressed) { onDragActiveChange(dragged || pressed) }
Box(
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(14.dp))
.clip(RoundedCornerShape(12.dp))
.background(Color.White.copy(alpha = 0.05f))
.padding(horizontal = 14.dp, vertical = 12.dp)
.padding(horizontal = 12.dp, vertical = 2.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
) {
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = title,
color = Color.White.copy(alpha = 0.82f),
fontSize = if (deviceType == DeviceType.TV) 16.sp else 14.sp,
fontWeight = FontWeight.Medium,
modifier = Modifier.weight(1f)
)
Text(
text = "${(value.coerceIn(0f, 1f) * 100).toInt()}%",
color = Color.White,
fontSize = if (deviceType == DeviceType.TV) 15.sp else 13.sp,
fontWeight = FontWeight.SemiBold
)
}
Slider(
value = value.coerceIn(0f, 1f),
onValueChange = { onChange(it.coerceIn(0f, 1f)) },
valueRange = 0f..1f,
interactionSource = sliderInteraction,
colors = SliderDefaults.colors(
thumbColor = Color.White,
activeTrackColor = Color.White,
inactiveTrackColor = Color.White.copy(alpha = 0.18f)
)
)
}
Text(
text = title,
color = Color.White.copy(alpha = 0.82f),
fontSize = if (deviceType == DeviceType.TV) 14.sp else 13.sp,
fontWeight = FontWeight.Medium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(0.42f)
)
Slider(
value = value.coerceIn(0f, 1f),
onValueChange = { onChange(it.coerceIn(0f, 1f)) },
valueRange = 0f..1f,
interactionSource = sliderInteraction,
colors = SliderDefaults.colors(
thumbColor = Color.White,
activeTrackColor = Color.White,
inactiveTrackColor = Color.White.copy(alpha = 0.18f)
),
modifier = Modifier.weight(0.58f)
)
Text(
text = "${(value.coerceIn(0f, 1f) * 100).toInt()}%",
color = Color.White,
fontSize = 12.sp,
fontWeight = FontWeight.SemiBold,
textAlign = TextAlign.End,
modifier = Modifier.width(36.dp)
)
}
}

View file

@ -138,7 +138,7 @@ fun PlayerSidebarShell(
}
val panelSizeModifier = if (isCard) {
Modifier
.padding(top = if (anchorTop) 16.dp else 0.dp)
.padding(top = if (anchorTop) 16.dp else 0.dp, end = if (anchorTop) 16.dp else 0.dp)
.width(minOf(cardWidth ?: if (isMobile) 340.dp else 360.dp, maxWidth - 48.dp))
.wrapContentHeight()
.heightIn(max = maxHeight - 48.dp)
@ -158,7 +158,7 @@ fun PlayerSidebarShell(
modifier = Modifier
.align(
when {
anchorTop -> Alignment.TopCenter
anchorTop -> Alignment.TopEnd
isCard -> Alignment.Center
else -> Alignment.BottomCenter
}