Skip to content

Commit

Permalink
Remove icon in programme item.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jul 19, 2024
1 parent 2995ceb commit c1b8e9d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(
Expand Down

0 comments on commit c1b8e9d

Please sign in to comment.