Compare commits

..

No commits in common. "44a39b83e9ac57903f6784d1611b04ab8cc49937" and "f0031d25c81053da0f6c0b3999e58813d309c970" have entirely different histories.

2 changed files with 20 additions and 43 deletions

View file

@ -382,8 +382,6 @@ private fun MenuDrawer(
onDismiss: () -> Unit, onDismiss: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
// Focus the destination we are on (issue #16); its item carries the red
// selected background. The first drawer item (Home) was the wrong target.
val drawerFocus = remember { FocusRequester() } val drawerFocus = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { drawerFocus.requestFocus() } } LaunchedEffect(Unit) { runCatching { drawerFocus.requestFocus() } }
val signOutContext = androidx.compose.ui.platform.LocalContext.current val signOutContext = androidx.compose.ui.platform.LocalContext.current
@ -407,13 +405,13 @@ private fun MenuDrawer(
} else false } else false
}, },
) { ) {
Destination.entries.forEach { dest -> Destination.entries.forEachIndexed { index, dest ->
MenuDrawerItem( MenuDrawerItem(
icon = dest.icon(), icon = dest.icon(),
label = dest.title, label = dest.title,
selected = dest == selected, selected = dest == selected,
onClick = { onSelect(dest) }, onClick = { onSelect(dest) },
modifier = if (dest == selected) Modifier.focusRequester(drawerFocus) else Modifier, modifier = if (index == 0) Modifier.focusRequester(drawerFocus) else Modifier,
) )
} }
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))

View file

@ -1,7 +1,4 @@
package net.jeena.jtubetv.ui.screens.list package net.jeena.jtubetv.ui.screens.list
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
@ -179,52 +176,34 @@ fun VideoCard(
color = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFFB8B8B8), color = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFFB8B8B8),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f, fill = false),
) )
} video.privacy?.takeIf { it.id != 1 }?.let { privacy ->
Row( if (showPrivacy) {
horizontalArrangement = Arrangement.spacedBy(6.dp), Text(
verticalAlignment = Alignment.CenterVertically, text = privacy.label ?: "non-public",
) { style = MaterialTheme.typography.labelSmall,
// Last row: age, then views as icon + count (the channel card's color = Color(0xFFC6E27C),
// stat style), then the privacy tag. The tag keeps a dark chip — modifier = Modifier
// its light text was illegible on the white focused card (issue #15). .background(Color(0x33C6E27C), RoundedCornerShape(4.dp))
Text( .padding(horizontal = 6.dp, vertical = 2.dp),
text = formatAge(video.publishedAt), )
style = MaterialTheme.typography.bodySmall, }
color = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFF8A8A8A),
)
androidx.compose.material3.Icon(
imageVector = androidx.compose.material.icons.Icons.Filled.PlayArrow,
contentDescription = null,
tint = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFF8A8A8A),
modifier = Modifier.size(12.dp),
)
Text(
text = video.views.toString(),
style = MaterialTheme.typography.bodySmall,
color = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFF8A8A8A),
)
video.privacy?.takeIf { showPrivacy && it.id != 1 }?.let { privacy ->
Text(
text = privacy.label ?: "non-public",
style = MaterialTheme.typography.labelSmall,
color = Color(0xFFC6E27C),
modifier = Modifier
.background(Color(0xFF222222), RoundedCornerShape(4.dp))
.padding(horizontal = 6.dp, vertical = 2.dp),
)
} }
if (video.nsfw) { if (video.nsfw) {
Text( Text(
text = "NSFW", text = "NSFW",
style = MaterialTheme.typography.labelSmall, style = MaterialTheme.typography.labelSmall,
color = Color(0xFFE2A57C), color = Color(0xFFE2A57C),
modifier = Modifier
.background(Color(0xFF222222), RoundedCornerShape(4.dp))
.padding(horizontal = 6.dp, vertical = 2.dp),
) )
} }
} }
Text(
text = formatAge(video.publishedAt) +
if (video.views > 0) " · " + formatViews(video.views) else "",
style = MaterialTheme.typography.bodySmall,
color = if (cardFocused) Color(0xFF6A6A6A) else Color(0xFF8A8A8A),
)
} }
} }
} }