remove debug isTv hardcode, update ui
This commit is contained in:
+8
-23
@@ -150,18 +150,14 @@ fun VideosInfo(
|
||||
val requester = remember { FocusRequester() }
|
||||
val blur = LocalBlurState.current
|
||||
val gridState = rememberLazyGridState()
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
Box(modifier = Modifier.fillMaxSize().padding(4.dp)) {
|
||||
if (items.isNotEmpty()) {
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Adaptive(minSize = 130.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(8.dp)
|
||||
.applyBlurSource(blur),
|
||||
modifier = Modifier.fillMaxSize().applyBlurSource(blur),
|
||||
contentPadding = paddingValues,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||
state = gridState
|
||||
) {
|
||||
itemsIndexed(
|
||||
@@ -181,8 +177,6 @@ fun VideosInfo(
|
||||
VideosNotFound(emptyResource)
|
||||
}
|
||||
}
|
||||
|
||||
// Мягкий фокус без withFrameNanos, реагирующий на появление данных
|
||||
LaunchedEffect(items.isNotEmpty()) {
|
||||
if (items.isNotEmpty()) {
|
||||
requester.requestFocus()
|
||||
@@ -199,21 +193,18 @@ fun Poster(
|
||||
) {
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
|
||||
// Анимируем увеличение карточки при фокусе (эффект для ТВ)
|
||||
val scale by animateFloatAsState(
|
||||
targetValue = if (isFocused) 1.08f else 1.0f,
|
||||
targetValue = if (isFocused) 1.0f else 0.92f,
|
||||
animationSpec = spring(stiffness = Spring.StiffnessMediumLow),
|
||||
label = "scale"
|
||||
)
|
||||
|
||||
// Плавная анимация цвета обводки
|
||||
val borderColor by animateColorAsState(
|
||||
targetValue = if (isFocused) MaterialTheme.colorScheme.primary else Color.Transparent,
|
||||
animationSpec = tween(200),
|
||||
label = "borderColor"
|
||||
)
|
||||
|
||||
// Плавная анимация толщины обводки
|
||||
val borderWidth by animateDpAsState(
|
||||
targetValue = if (isFocused) 3.dp else 0.dp,
|
||||
animationSpec = tween(200),
|
||||
@@ -222,9 +213,8 @@ fun Poster(
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.aspectRatio(0.7f) // Стандартное кинематографическое соотношение для постеров
|
||||
.aspectRatio(0.7f)
|
||||
.graphicsLayer {
|
||||
// Применяем масштаб и скругление на уровне слоя (работает максимально быстро)
|
||||
scaleX = scale
|
||||
scaleY = scale
|
||||
clip = true
|
||||
@@ -238,27 +228,22 @@ fun Poster(
|
||||
)
|
||||
.clickable(onClick = onClick)
|
||||
) {
|
||||
// Картинка постера
|
||||
Image(
|
||||
painter = rememberImagePainter(imageUrl),
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
|
||||
// Оптимизированный затемняющий градиент (снизу вверх)
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(
|
||||
Brush.verticalGradient(
|
||||
0.4f to Color.Transparent, // До 40% высоты прозрачно
|
||||
1.0f to Color.Black.copy(alpha = 0.85f) // К низу плотное затемнение
|
||||
0.4f to Color.Transparent,
|
||||
1.0f to Color.Black.copy(alpha = 0.85f)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
// Текст названия фильма/сериала
|
||||
Text(
|
||||
text = label,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
|
||||
Reference in New Issue
Block a user