diff --git a/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt b/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt index 365d15d7..5b7a93e2 100644 --- a/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt +++ b/feature/channel/src/main/java/com/m3u/feature/channel/components/ProgrammeGuide.kt @@ -8,12 +8,11 @@ import androidx.compose.foundation.gestures.detectTapGestures import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxWithConstraints -import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.requiredHeight -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.AbsoluteRoundedCornerShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.rounded.KeyboardDoubleArrowUp @@ -47,7 +46,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex import androidx.constraintlayout.compose.ConstraintLayout import androidx.paging.compose.LazyPagingItems -import coil.compose.AsyncImage import com.m3u.core.architecture.preferences.hiltPreferences import com.m3u.data.database.model.Programme import com.m3u.data.database.model.ProgrammeRange @@ -286,20 +284,19 @@ private fun TimelineCell( @Composable private fun ProgrammeCell( programme: Programme, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, + onRing: () -> Unit = {} ) { val spacing = LocalSpacing.current val preferences = hiltPreferences() val leanback = leanback() val clockMode = preferences.twelveHourClock val content = @Composable { - FlowRow( + Column( modifier = Modifier .fillMaxSize() .padding(4.dp), - horizontalArrangement = Arrangement.spacedBy(spacing.small), verticalArrangement = Arrangement.spacedBy(spacing.small), - maxItemsInEachRow = 2 ) { val start = Instant.fromEpochMilliseconds(programme.start) .toLocalDateTime(TimeZone.currentSystemDefault()) @@ -315,30 +312,13 @@ private fun ProgrammeCell( color = LocalContentColor.current.copy(0.65f), fontFamily = FontFamilies.LexendExa ) - ConstraintLayout { - val (icon, title) = createRefs() - AsyncImage( - model = programme.icon, - contentDescription = null, - modifier = Modifier - .size(48.dp) - .constrainAs(icon) { - this.end.linkTo(title.start, 4.dp) - this.top.linkTo(title.top) - this.bottom.linkTo(title.bottom) - } - ) - Text( - text = programme.title, - maxLines = 1, - overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.titleMedium, - fontFamily = FontFamilies.LexendExa, - modifier = Modifier.constrainAs(title) { - this.end.linkTo(parent.end) - } - ) - } + Text( + text = programme.title, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + style = MaterialTheme.typography.titleMedium, + fontFamily = FontFamilies.LexendExa + ) Text( text = programme.description, overflow = TextOverflow.Ellipsis, diff --git a/material/src/main/java/com/m3u/material/components/VerticalDraggableScrollbar.kt b/material/src/main/java/com/m3u/material/components/VerticalDraggableScrollbar.kt index c26b1aca..6a5fae13 100644 --- a/material/src/main/java/com/m3u/material/components/VerticalDraggableScrollbar.kt +++ b/material/src/main/java/com/m3u/material/components/VerticalDraggableScrollbar.kt @@ -280,21 +280,17 @@ fun VerticalDraggableScrollbar( } var isDragging: Boolean by remember { mutableStateOf(false) } var isScrolling: Boolean by remember { mutableStateOf(false) } - val fadedIsDragging: Boolean by produceState(isDragging) { - snapshotFlow { isDragging } - .onEach { - if (!it) delay(800.milliseconds) - value = it - } - .launchIn(this) + val debouncedIsDragging: Boolean by produceState(isDragging) { + snapshotFlow { isDragging }.collectLatest { + if (!it) delay(800.milliseconds) + value = it + } } - val fadedIsScrolling: Boolean by produceState(isScrolling) { - snapshotFlow { isScrolling } - .onEach { - if (!it) delay(400.milliseconds) - value = it - } - .launchIn(this) + val debouncedIsScrolling: Boolean by produceState(isScrolling) { + snapshotFlow { isScrolling }.collectLatest { + if (!it) delay(400.milliseconds) + value = it + } } LaunchedEffect(Unit) { snapshotFlow { lazyStaggeredGridState.firstVisibleItemScrollOffset }.collectLatest { @@ -317,7 +313,7 @@ fun VerticalDraggableScrollbar( } } val currentAlpha by animateFloatAsState( - targetValue = if (fadedIsDragging || fadedIsScrolling) 1f else 0.65f, + targetValue = if (debouncedIsDragging || debouncedIsScrolling) 1f else 0.65f, label = "current-alpha" ) val currentPosition by animateFloatAsState(