cards: privacy badge in the meta row, views as icon
The privacy tag sat next to the channel name — long names crowded it — and its light-on-light colors became illegible the moment a card got focus (white background). It moves to the last row (age · views) and keeps a dark chip in both states. Views render as the channel card's play icon + count instead of "1 view" text. Closes #15
This commit is contained in:
parent
f0031d25c8
commit
6d1cc8986a
1 changed files with 39 additions and 18 deletions
|
|
@ -1,4 +1,7 @@
|
||||||
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
|
||||||
|
|
@ -176,34 +179,52 @@ 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 ->
|
}
|
||||||
if (showPrivacy) {
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
|
// Last row: age, then views as icon + count (the channel card's
|
||||||
|
// stat style), then the privacy tag. The tag keeps a dark chip —
|
||||||
|
// its light text was illegible on the white focused card (issue #15).
|
||||||
|
Text(
|
||||||
|
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(
|
||||||
text = privacy.label ?: "non-public",
|
text = privacy.label ?: "non-public",
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = Color(0xFFC6E27C),
|
color = Color(0xFFC6E27C),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.background(Color(0x33C6E27C), RoundedCornerShape(4.dp))
|
.background(Color(0xFF222222), RoundedCornerShape(4.dp))
|
||||||
.padding(horizontal = 6.dp, vertical = 2.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),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue