fix(ui): подпись играющего трека на карточке станции даже без обложки трека
Раньше now-track (трек/исполнитель + обложка) показывался ТОЛЬКО при наличии обложки трека — поэтому DFM-станции без обогащённой обложки оставались пустой плиткой. Теперь: если трек известен — всегда показываем подпись, а фоном берём обложку трека → лого станции → плитку. DFM работает как Record. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -61,51 +61,17 @@ fun StationCard(
|
|||||||
.clip(RoundedCornerShape(16.dp))
|
.clip(RoundedCornerShape(16.dp))
|
||||||
.background(colors.surface2)
|
.background(colors.surface2)
|
||||||
) {
|
) {
|
||||||
|
val trackCover = nowTrack?.coverUrl?.takeIf { it.isNotBlank() }
|
||||||
|
// Фон карточки: обложка трека → логотип станции → фирменная плитка.
|
||||||
when {
|
when {
|
||||||
// Приоритет 1: обложка текущего трека с градиентом и подписью.
|
trackCover != null -> {
|
||||||
!nowTrack?.coverUrl.isNullOrBlank() -> {
|
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = crossfadeModel(nowTrack!!.coverUrl),
|
model = crossfadeModel(trackCover),
|
||||||
contentDescription = nowTrack.song,
|
contentDescription = nowTrack.song,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentScale = ContentScale.Crop
|
contentScale = ContentScale.Crop
|
||||||
)
|
)
|
||||||
// Тёмный скрим снизу для читаемости текста.
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(
|
|
||||||
Brush.verticalGradient(
|
|
||||||
0f to Color.Transparent,
|
|
||||||
0.5f to Color.Transparent,
|
|
||||||
1f to Color.Black.copy(alpha = 0.8f)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
// Название трека и исполнитель в нижнем-левом углу.
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.align(Alignment.BottomStart)
|
|
||||||
.padding(10.dp)
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = nowTrack.song,
|
|
||||||
color = Color.White,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
style = androidx.compose.material3.MaterialTheme.typography.bodyMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
Text(
|
|
||||||
text = nowTrack.artist,
|
|
||||||
color = Color.White.copy(alpha = 0.8f),
|
|
||||||
style = androidx.compose.material3.MaterialTheme.typography.labelMedium,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Приоритет 2: логотип самой станции.
|
|
||||||
!station.coverUrl.isNullOrBlank() -> {
|
!station.coverUrl.isNullOrBlank() -> {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
model = crossfadeModel(station.coverUrl),
|
model = crossfadeModel(station.coverUrl),
|
||||||
@@ -114,7 +80,6 @@ fun StationCard(
|
|||||||
contentScale = ContentScale.Crop
|
contentScale = ContentScale.Crop
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Приоритет 3: фирменная плитка (цвет из названия + инициалы).
|
|
||||||
else -> {
|
else -> {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -131,6 +96,41 @@ fun StationCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Подпись играющего трека — поверх любого фона, если трек известен.
|
||||||
|
if (nowTrack != null) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(
|
||||||
|
Brush.verticalGradient(
|
||||||
|
0f to Color.Transparent,
|
||||||
|
0.5f to Color.Transparent,
|
||||||
|
1f to Color.Black.copy(alpha = 0.8f)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomStart)
|
||||||
|
.padding(10.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = nowTrack.song,
|
||||||
|
color = Color.White,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
style = androidx.compose.material3.MaterialTheme.typography.bodyMedium,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = nowTrack.artist,
|
||||||
|
color = Color.White.copy(alpha = 0.8f),
|
||||||
|
style = androidx.compose.material3.MaterialTheme.typography.labelMedium,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
// Кнопка сердечка — поверх всего, top-end.
|
// Кнопка сердечка — поверх всего, top-end.
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user