Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

refactor: Update settings UI components for consistency with new design system

David Nashasha60749390da6
diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt
index c4af9fc4..a05c92d9 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt
@@ -1,44 +1,50 @@
package com.streamvault.app.ui.components.dialogs
-import com.streamvault.core.ui.design.contentOnColor
-import androidx.compose.foundation.layout.*
-import androidx.compose.foundation.border
+import android.view.KeyEvent as AndroidKeyEvent
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Close
-import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Lock
+import androidx.compose.material.icons.filled.Star
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
+import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.input.key.KeyEvent
+import androidx.compose.ui.input.key.onPreviewKeyEvent
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
-import com.streamvault.domain.model.Channel
-import com.streamvault.domain.model.Category
-import androidx.compose.ui.res.stringResource
+import androidx.tv.material3.*
import com.streamvault.app.R
+import com.streamvault.app.device.rememberIsTelevisionDevice
import com.streamvault.core.ui.design.BrowseColors as AppColors
-import androidx.compose.ui.input.key.*
-import androidx.compose.ui.focus.onFocusChanged
-import androidx.compose.foundation.shape.CircleShape
+import com.streamvault.core.ui.interaction.TvClickableSurface
+import com.streamvault.domain.model.Category
+import com.streamvault.domain.model.Channel
import kotlinx.coroutines.delay
-import androidx.tv.material3.*
-import com.streamvault.app.device.rememberIsTelevisionDevice
-import com.streamvault.core.ui.interaction.mouseClickable
-import android.view.KeyEvent as AndroidKeyEvent
+
+private val menuShape = RoundedCornerShape(20.dp)
+private val actionShape = RoundedCornerShape(12.dp)
@Composable
fun AddToGroupDialog(
contentTitle: String,
- channel: Channel? = null, // the channel being managed (for split screen)
+ channel: Channel? = null,
groups: List<Category>,
isFavorite: Boolean,
memberOfGroups: List<Long>,
@@ -56,421 +62,237 @@ fun AddToGroupDialog(
onMoveBackToLive: (() -> Unit)? = null
) {
var showCreateGroup by remember { mutableStateOf(false) }
+ var canInteract by remember { mutableStateOf(false) }
+ val firstActionFocus = remember { FocusRequester() }
val isTelevisionDevice = rememberIsTelevisionDevice()
- val contentFocusRequester = remember { FocusRequester() } // focuses first interactive item, not close button
- // Ghost-click debounce
- var canInteract by remember { mutableStateOf(false) }
- LaunchedEffect(Unit) {
- runCatching { contentFocusRequester.requestFocus() }
- delay(500)
- canInteract = true
+ LaunchedEffect(showCreateGroup) {
+ if (!showCreateGroup) {
+ canInteract = false
+ runCatching { firstActionFocus.requestFocus() }
+ delay(500)
+ canInteract = true
+ }
}
-
val blockOpenGesture: (KeyEvent) -> Boolean = { event ->
- !canInteract &&
- event.nativeKeyEvent.action == AndroidKeyEvent.ACTION_UP &&
- when (event.nativeKeyEvent.keyCode) {
- AndroidKeyEvent.KEYCODE_DPAD_CENTER,
- AndroidKeyEvent.KEYCODE_ENTER,
- AndroidKeyEvent.KEYCODE_NUMPAD_ENTER,
- AndroidKeyEvent.KEYCODE_BUTTON_A -> true
- else -> false
- }
+ !canInteract && event.nativeKeyEvent.action == AndroidKeyEvent.ACTION_UP &&
+ event.nativeKeyEvent.keyCode in listOf(
+ AndroidKeyEvent.KEYCODE_DPAD_CENTER, AndroidKeyEvent.KEYCODE_ENTER,
+ AndroidKeyEvent.KEYCODE_NUMPAD_ENTER, AndroidKeyEvent.KEYCODE_BUTTON_A
+ )
}
- val safeDismiss = { if (canInteract) onDismiss() }
- val safeToggleFavorite = { if (canInteract) onToggleFavorite() }
- val safeOpenSplitScreenPlanner = { if (canInteract) onOpenSplitScreenPlanner?.invoke() }
- val safeRemoveFromRecent = { if (canInteract) onRemoveFromRecent?.invoke() }
- val safeHideChannel = { if (canInteract) onHideChannel?.invoke() }
- val safeMoveToMovies = { if (canInteract) onMoveToMovies?.invoke() }
- val safeMoveToSeries = { if (canInteract) onMoveToSeries?.invoke() }
- val safeMoveBackToLive = { if (canInteract) onMoveBackToLive?.invoke() }
- val safeCreateGroup = { if (canInteract && onCreateGroup != null) showCreateGroup = true }
- val safeAddToGroup: (Category) -> Unit = { group -> if (canInteract) onAddToGroup(group) }
- val safeRemoveFromGroup: (Category) -> Unit = { group -> if (canInteract) onRemoveFromGroup(group) }
-
if (showCreateGroup && onCreateGroup != null) {
CreateGroupDialog(
onDismissRequest = { showCreateGroup = false },
onConfirm = { name ->
- onCreateGroup.invoke(name)
+ onCreateGroup(name)
showCreateGroup = false
}
)
- }
-
- if (!showCreateGroup) {
+ } else {
Dialog(
- onDismissRequest = safeDismiss,
+ onDismissRequest = { if (canInteract) onDismiss() },
properties = DialogProperties(usePlatformDefaultWidth = false)
) {
- val dialogModifier = if (isTelevisionDevice) {
- Modifier.width(400.dp)
- } else {
- Modifier
- }
-
- val dialogContent: @Composable (Modifier) -> Unit = { resolvedModifier ->
+ BoxWithConstraints(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
+ val width = when {
+ isTelevisionDevice -> Modifier.width(420.dp)
+ maxWidth < 700.dp -> Modifier.fillMaxWidth(0.92f)
+ maxWidth < 1280.dp -> Modifier.fillMaxWidth(0.58f)
+ else -> Modifier.width(420.dp)
+ }
+ val maxListHeight = maxHeight * 0.68f
Surface(
- shape = RoundedCornerShape(16.dp),
+ shape = menuShape,
colors = SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated),
- modifier = resolvedModifier
- .padding(16.dp)
+ modifier = width.padding(12.dp)
+ .border(1.dp, AppColors.Outline, menuShape)
.onPreviewKeyEvent(blockOpenGesture)
) {
- Column(modifier = Modifier.padding(24.dp)) {
- // Header
+ Column(
+ Modifier.background(
+ Brush.verticalGradient(
+ listOf(AppColors.BrandMuted.copy(alpha = 0.16f),
+ AppColors.SurfaceElevated, AppColors.Surface)
+ )
+ ).padding(22.dp),
+ verticalArrangement = Arrangement.spacedBy(16.dp)
+ ) {
Row(
- modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
+ Modifier.fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
- text = stringResource(R.string.add_group_manage_title, contentTitle),
+ stringResource(R.string.add_group_manage_title, contentTitle),
style = MaterialTheme.typography.titleLarge,
+ fontWeight = FontWeight.SemiBold,
color = AppColors.TextPrimary,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
- IconButton(
- onClick = safeDismiss,
- modifier = Modifier.mouseClickable(onClick = safeDismiss)
+ MenuFocusSurface(
+ onClick = { if (canInteract) onDismiss() },
+ modifier = Modifier.size(38.dp),
+ containerColor = AppColors.SurfaceAccent
) {
- Icon(Icons.Default.Close, contentDescription = stringResource(R.string.add_group_close_cd))
+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+ Icon(Icons.Default.Close,
+ contentDescription = stringResource(R.string.add_group_close_cd),
+ tint = AppColors.TextSecondary,
+ modifier = Modifier.size(20.dp))
+ }
}
}
LazyColumn(
- modifier = Modifier.weight(1f, fill = false),
+ modifier = Modifier.heightIn(max = maxListHeight),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
- // ג”€ג”€ Favorites ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
- item {
- var isFocused by remember { mutableStateOf(false) }
- val favoriteInk = contentOnColor(
- when {
- isFocused -> AppColors.Focus
- isFavorite -> AppColors.Warning
- else -> AppColors.Brand
- }
- )
- Button(
- onClick = safeToggleFavorite,
- modifier = Modifier
- .fillMaxWidth()
- .focusRequester(contentFocusRequester)
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeToggleFavorite),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isFavorite -> AppColors.Warning
- else -> AppColors.Brand
- },
- contentColor = favoriteInk
- )
- ) {
- Icon(
- imageVector = Icons.Default.Star,
- contentDescription = if (isFavorite) stringResource(R.string.add_group_remove_favorites)
- else stringResource(R.string.add_group_add_favorites),
- tint = favoriteInk
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = if (isFavorite) stringResource(R.string.add_group_remove_favorites)
- else stringResource(R.string.add_group_add_favorites),
- color = favoriteInk
+ item {
+ MenuAction(
+ label = stringResource(
+ if (isFavorite) R.string.add_group_remove_favorites
+ else R.string.add_group_add_favorites),
+ icon = Icons.Default.Star,
+ accent = AppColors.Brand,
+ selected = isFavorite,
+ onClick = { if (canInteract) onToggleFavorite() },
+ modifier = Modifier.focusRequester(firstActionFocus)
)
}
- }
-
- if (onMoveToMovies != null) {
- item {
- Button(
- onClick = safeMoveToMovies,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveToMovies),
- colors = ButtonDefaults.colors(
- containerColor = AppColors.Brand,
- contentColor = contentOnColor(AppColors.Brand)
- )
- ) { Text(stringResource(R.string.m3u_move_to_movies)) }
+ if (onMoveToMovies != null) item {
+ MenuAction(stringResource(R.string.m3u_move_to_movies), Icons.Default.Add,
+ AppColors.Brand, onClick = { if (canInteract) onMoveToMovies() })
}
- }
-
- if (onMoveToSeries != null) {
- item {
- Button(
- onClick = safeMoveToSeries,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveToSeries),
- colors = ButtonDefaults.colors(
- containerColor = AppColors.Success,
- contentColor = contentOnColor(AppColors.Success)
- )
- ) { Text(stringResource(R.string.m3u_move_to_series)) }
+ if (onMoveToSeries != null) item {
+ MenuAction(stringResource(R.string.m3u_move_to_series), Icons.Default.Add,
+ AppColors.Success, onClick = { if (canInteract) onMoveToSeries() })
}
- }
-
- if (onMoveBackToLive != null) {
- item {
- Button(
- onClick = safeMoveBackToLive,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveBackToLive),
- colors = ButtonDefaults.colors(
- containerColor = MaterialTheme.colorScheme.errorContainer,
- contentColor = MaterialTheme.colorScheme.onErrorContainer
- )
- ) { Text(stringResource(R.string.m3u_move_back_to_live)) }
+ if (onMoveBackToLive != null) item {
+ MenuAction(stringResource(R.string.m3u_move_back_to_live), Icons.Default.Add,
+ AppColors.Brand, onClick = { if (canInteract) onMoveBackToLive() })
}
- }
-
- // ג”€ג”€ Split Screen ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
- if (channel != null && onOpenSplitScreenPlanner != null) {
- item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeOpenSplitScreenPlanner,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeOpenSplitScreenPlanner),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isQueuedForSplitScreen -> AppColors.Success.copy(alpha = 0.8f)
- else -> AppColors.Success
- }
+ if (channel != null && onOpenSplitScreenPlanner != null) item {
+ MenuAction(
+ label = stringResource(
+ if (isQueuedForSplitScreen) R.string.multiview_queued
+ else R.string.multiview_add_to_split),
+ icon = Icons.Default.Add,
+ accent = AppColors.Success,
+ selected = isQueuedForSplitScreen,
+ onClick = { if (canInteract) onOpenSplitScreenPlanner() }
)
- ) {
- Icon(
- imageVector = Icons.Default.Add,
- contentDescription = stringResource(R.string.multiview_add_to_split),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else Color.White
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = if (isQueuedForSplitScreen) stringResource(R.string.multiview_queued)
- else stringResource(R.string.multiview_add_to_split),
- color = if (isFocused) contentOnColor(AppColors.Focus) else Color.White
- )
- }
}
- }
-
- // ג”€ג”€ Hide channel ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
- if (channel != null && onHideChannel != null) {
- item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeHideChannel,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeHideChannel),
- colors = ButtonDefaults.colors(
- containerColor = if (isFocused) AppColors.Focus else AppColors.SurfaceAccent,
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Icon(
- imageVector = Icons.Default.Lock,
- contentDescription = stringResource(R.string.channel_action_hide),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.channel_action_hide),
- color = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- }
+ if (channel != null && onHideChannel != null) item {
+ MenuAction(stringResource(R.string.channel_action_hide), Icons.Default.Lock,
+ AppColors.Warning, onClick = { if (canInteract) onHideChannel() })
+ }
+ if (onRemoveFromRecent != null) item {
+ MenuAction(stringResource(R.string.channel_options_remove_from_recent),
+ Icons.Default.Close, AppColors.Warning,
+ onClick = { if (canInteract) onRemoveFromRecent() })
}
- }
-
- // ג”€ג”€ Remove from Recent ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
- if (onRemoveFromRecent != null) {
item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeRemoveFromRecent,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeRemoveFromRecent),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- else -> MaterialTheme.colorScheme.errorContainer
- },
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- ) {
- Icon(
- imageVector = Icons.Default.Close,
- contentDescription = stringResource(R.string.channel_options_remove_from_recent),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.channel_options_remove_from_recent),
- color = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- }
+ Spacer(Modifier.height(4.dp))
+ Box(Modifier.fillMaxWidth().height(1.dp).background(AppColors.Outline))
+ Text(stringResource(R.string.add_group_custom_groups_title),
+ style = MaterialTheme.typography.labelLarge,
+ fontWeight = FontWeight.SemiBold,
+ color = AppColors.TextSecondary,
+ modifier = Modifier.padding(top = 14.dp, bottom = 4.dp))
}
- }
-
- // ג”€ג”€ Custom Groups Section ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€ג”€
- item {
- Box(
- modifier = Modifier
- .fillMaxWidth()
- .padding(vertical = 8.dp)
- .height(1.dp)
- .background(AppColors.SurfaceAccent.copy(alpha = 0.7f))
- )
- Text(
- text = stringResource(R.string.add_group_custom_groups_title),
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextPrimary,
- modifier = Modifier.padding(bottom = 8.dp)
- )
- }
-
- items(
- items = groups,
- key = { it.id },
- contentType = { "category" }
- ) { group ->
- val isMember = memberOfGroups.contains(group.id)
- var isFocused by remember { mutableStateOf(false) }
- val groupAction = { if (isMember) safeRemoveFromGroup(group) else safeAddToGroup(group) }
-
- Row(
- modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = group.name,
- style = MaterialTheme.typography.bodyMedium,
- color = AppColors.TextPrimary,
- modifier = Modifier.weight(1f)
+ items(groups, key = { it.id }) { group ->
+ val isMember = group.id in memberOfGroups
+ MenuAction(
+ label = group.name,
+ icon = Icons.Default.Add,
+ accent = AppColors.Brand,
+ selected = isMember,
+ trailing = stringResource(
+ if (isMember) R.string.add_group_remove_btn
+ else R.string.add_group_add_btn),
+ onClick = {
+ if (canInteract) {
+ if (isMember) onRemoveFromGroup(group) else onAddToGroup(group)
+ }
+ }
)
- Button(
- onClick = groupAction,
- modifier = Modifier
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .onFocusChanged { isFocused = it.isFocused }
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = groupAction),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isMember -> AppColors.Live.copy(alpha = 0.2f)
- else -> AppColors.BrandMuted.copy(alpha = 0.4f)
- },
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Text(
- if (isMember) stringResource(R.string.add_group_remove_btn)
- else stringResource(R.string.add_group_add_btn)
- )
- }
}
- }
-
- if (onCreateGroup != null) item {
- var isFocused by remember { mutableStateOf(false) }
- Spacer(modifier = Modifier.height(8.dp))
- OutlinedButton(
- onClick = safeCreateGroup,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 1.dp,
- if (isFocused) AppColors.Focus else AppColors.BrandMuted.copy(alpha = 0.55f),
- CircleShape
- )
- .mouseClickable(onClick = safeCreateGroup),
- colors = ButtonDefaults.colors(
- containerColor = if (isFocused) AppColors.Focus else Color.Transparent,
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_group_create_new_btn))
- Spacer(modifier = Modifier.width(8.dp))
- Text(stringResource(R.string.add_group_create_new_btn))
- }
- }
+ if (onCreateGroup != null) item {
+ MenuAction(stringResource(R.string.add_group_create_new_btn),
+ Icons.Default.Add, AppColors.Brand,
+ onClick = { if (canInteract) showCreateGroup = true })
+ }
}
}
}
}
+ }
+ }
+}
- if (isTelevisionDevice) {
- dialogContent(dialogModifier)
- } else {
- BoxWithConstraints(
- modifier = Modifier.fillMaxWidth(),
- contentAlignment = Alignment.Center
- ) {
- val responsiveModifier = when {
- maxWidth < 700.dp -> Modifier.fillMaxWidth(0.92f)
- maxWidth < 1280.dp -> Modifier.fillMaxWidth(0.58f)
- else -> Modifier.width(400.dp)
- }
- dialogContent(responsiveModifier)
- }
+@Composable
+private fun MenuAction(
+ label: String,
+ icon: ImageVector,
+ accent: Color,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ selected: Boolean = false,
+ trailing: String? = null
+) {
+ MenuFocusSurface(
+ onClick = onClick,
+ modifier = modifier.fillMaxWidth(),
+ containerColor = if (selected) accent.copy(alpha = 0.17f) else AppColors.SurfaceAccent
+ ) {
+ Row(
+ Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 11.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Box(
+ Modifier.size(34.dp).background(accent.copy(alpha = 0.17f), RoundedCornerShape(9.dp)),
+ contentAlignment = Alignment.Center
+ ) {
+ Icon(icon, contentDescription = null, tint = accent, modifier = Modifier.size(20.dp))
+ }
+ Text(label, style = MaterialTheme.typography.bodyMedium,
+ fontWeight = FontWeight.Medium, color = AppColors.TextPrimary,
+ maxLines = 2, overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.weight(1f))
+ if (trailing != null) {
+ Text(trailing, style = MaterialTheme.typography.labelMedium, color = accent)
}
}
}
}
+
+@Composable
+private fun MenuFocusSurface(
+ onClick: () -> Unit,
+ modifier: Modifier,
+ containerColor: Color,
+ content: @Composable BoxScope.() -> Unit
+) {
+ TvClickableSurface(
+ onClick = onClick,
+ modifier = modifier,
+ shape = ClickableSurfaceDefaults.shape(actionShape),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = containerColor,
+ focusedContainerColor = containerColor,
+ contentColor = AppColors.TextPrimary,
+ focusedContentColor = AppColors.TextPrimary
+ ),
+ border = ClickableSurfaceDefaults.border(
+ border = Border(border = BorderStroke(1.dp, AppColors.Outline), shape = actionShape),
+ focusedBorder = Border(border = BorderStroke(2.dp, AppColors.Focus), shape = actionShape)
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),
+ content = content
+ )
+}
diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt
index 979f3fef..ded7854e 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt
@@ -1,6 +1,7 @@
package com.streamvault.app.ui.components.dialogs
import androidx.compose.foundation.background
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
@@ -22,6 +23,7 @@ import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.tv.material3.Button
import androidx.tv.material3.ButtonDefaults
+import androidx.tv.material3.Border
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
@@ -32,6 +34,8 @@ import com.streamvault.core.ui.theme.OnSurfaceDim
import com.streamvault.core.ui.theme.Primary
import com.streamvault.core.ui.theme.SurfaceElevated
import com.streamvault.core.ui.interaction.mouseClickable
+import com.streamvault.core.ui.design.BrowseColors
+import com.streamvault.core.ui.design.BrowseShapes
import com.streamvault.core.ui.components.dialogs.rememberDialogOpenGestureBlocker
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.ui.Alignment
@@ -206,10 +210,18 @@ fun CategoryOptionsDialog(
Button(
onClick = safeDismiss,
modifier = Modifier.mouseClickable(onClick = safeDismiss),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.08f),
- contentColor = OnSurface
- )
+ containerColor = BrowseColors.SurfaceAccent,
+ focusedContainerColor = BrowseColors.SurfaceAccent,
+ contentColor = BrowseColors.TextPrimary,
+ focusedContentColor = BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(stringResource(R.string.category_options_cancel))
}
@@ -228,10 +240,18 @@ private fun PremiumDialogAction(
Button(
onClick = onClick,
modifier = Modifier.fillMaxWidth().mouseClickable(onClick = onClick),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else Color.White.copy(alpha = 0.08f),
- contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else OnSurface
- )
+ containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ focusedContainerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary,
+ focusedContentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(label)
}
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index e6cacc7d..d90ecee4 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -51,6 +51,7 @@ All notable product changes are recorded in this document.
### Changed
- Improved the VOD UI with consistent subtitle, audio, and OpenSubtitles side panels matching playback settings, separate Sources and Settings tabs, immediate access to provider, online, and device subtitles, and clearer remote navigation and track selection.
+- Modernized the visual design across Live TV, Movies & Series details and episode lists, search, split-screen setup and controls, and Settings detail pages and selection dialogs. Unified surfaces, spacing, shapes, and theme-aware colors while preserving the blue default, alternate themes, navigation, and feature placement; selection focus now uses a steady outline without scaling.
- Raised M3U admission ceilings to 500,000 entries and 400,000 live channels or movies per provider.
- Reduced duplicate category requests and per-row identity database work during Stalker provider setup, preserving portal verification and stable catalog IDs.
- Added direct Stalker live-row decoding and bounded ingestion with isolated authorization retries; incomplete responses cannot promote a full catalog, and bootstrap prefixes do not certify bulk catalog fidelity.
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogDetailVisuals.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogDetailVisuals.kt
new file mode 100644
index 00000000..dd428711
--- /dev/null
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogDetailVisuals.kt
@@ -0,0 +1,128 @@
+package com.streamvault.feature.catalog.presentation.components
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.ColumnScope
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.filled.PlayArrow
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.dp
+import androidx.tv.material3.Border
+import androidx.tv.material3.ButtonDefaults
+import androidx.tv.material3.Icon
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Text
+import com.streamvault.core.ui.design.BrowseColors as AppColors
+import com.streamvault.core.ui.interaction.TvButton
+
+private val detailPanelShape = RoundedCornerShape(20.dp)
+private val detailControlShape = RoundedCornerShape(11.dp)
+
+@Composable
+fun DetailInfoPanel(
+ modifier: Modifier = Modifier,
+ spacing: androidx.compose.ui.unit.Dp = 16.dp,
+ content: @Composable ColumnScope.() -> Unit
+) {
+ Column(
+ modifier = modifier
+ .clip(detailPanelShape)
+ .background(
+ Brush.horizontalGradient(
+ listOf(AppColors.SurfaceElevated.copy(alpha = 0.96f),
+ AppColors.Surface.copy(alpha = 0.89f))
+ )
+ )
+ .border(1.dp, AppColors.Outline, detailPanelShape)
+ .padding(24.dp),
+ verticalArrangement = Arrangement.spacedBy(spacing),
+ content = content
+ )
+}
+
+@Composable
+fun DetailSectionHeading(title: String, subtitle: String? = null) {
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(12.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Spacer(
+ Modifier.width(4.dp).height(if (subtitle == null) 24.dp else 38.dp)
+ .background(AppColors.Brand, RoundedCornerShape(3.dp))
+ )
+ Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
+ Text(
+ title,
+ style = MaterialTheme.typography.titleLarge,
+ fontWeight = FontWeight.SemiBold,
+ color = AppColors.TextPrimary
+ )
+ if (!subtitle.isNullOrBlank()) {
+ Text(subtitle, style = MaterialTheme.typography.bodySmall,
+ color = AppColors.TextSecondary)
+ }
+ }
+ }
+}
+
+@Composable
+fun DetailActionButton(
+ label: String,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ primary: Boolean = false,
+ enabled: Boolean = true,
+ icon: ImageVector? = if (primary) Icons.Default.PlayArrow else null,
+ compact: Boolean = false
+) {
+ val fill = if (primary) AppColors.Brand else AppColors.SurfaceAccent
+ val ink = if (primary) AppColors.OnPrimary else AppColors.TextPrimary
+ TvButton(
+ onClick = onClick,
+ modifier = modifier,
+ enabled = enabled,
+ shape = ButtonDefaults.shape(shape = detailControlShape),
+ colors = ButtonDefaults.colors(
+ containerColor = fill,
+ contentColor = ink,
+ focusedContainerColor = fill,
+ focusedContentColor = ink
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, AppColors.Outline), shape = detailControlShape),
+ focusedBorder = Border(BorderStroke(2.dp, AppColors.Focus), shape = detailControlShape)
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f),
+ contentPadding = PaddingValues(
+ horizontal = if (compact) 12.dp else 18.dp,
+ vertical = if (compact) 8.dp else 11.dp
+ )
+ ) {
+ if (icon != null) {
+ Icon(icon, contentDescription = null)
+ Spacer(Modifier.width(6.dp))
+ }
+ Text(
+ label,
+ style = if (compact) MaterialTheme.typography.labelMedium
+ else MaterialTheme.typography.labelLarge,
+ fontWeight = FontWeight.SemiBold
+ )
+ }
+}
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogEpisodeRowCard.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogEpisodeRowCard.kt
index cb34264d..ce7fd881 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogEpisodeRowCard.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/CatalogEpisodeRowCard.kt
@@ -5,6 +5,7 @@ import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.snap
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
@@ -378,75 +379,89 @@ fun EpisodeRowCard(
fallbackImageUrl: String? = null
) {
val screenWidth = LocalConfiguration.current.screenWidthDp.dp
- val previewWidth = if (screenWidth < 700.dp) 124.dp else 164.dp
+ val previewWidth = if (screenWidth < 700.dp) 116.dp else 154.dp
val durationMs = episode.durationSeconds.toLong() * 1000L
val showProgress = episode.watchProgress > 5000L && durationMs > 0L &&
!isPlaybackComplete(episode.watchProgress, durationMs)
val displayUrl = episode.coverUrl.takeIf { !it.isNullOrBlank() } ?: fallbackImageUrl
- Box(
+ Column(
modifier = modifier
.fillMaxWidth()
.clip(BrowseShapes.Panel)
- .background(AppColors.SurfaceElevated)
- .padding(16.dp)
+ .background(
+ Brush.horizontalGradient(
+ listOf(AppColors.SurfaceElevated, AppColors.Surface)
+ )
+ )
+ .border(1.dp, AppColors.Outline, BrowseShapes.Panel)
+ .padding(14.dp),
+ verticalArrangement = Arrangement.spacedBy(10.dp)
) {
- Column {
- Row(horizontalArrangement = Arrangement.spacedBy(14.dp), verticalAlignment = Alignment.CenterVertically) {
- Box(
- modifier = Modifier
- .width(previewWidth)
- .aspectRatio(16f / 9f)
- .clip(BrowseShapes.Artwork)
- .background(AppColors.SurfaceEmphasis),
- contentAlignment = Alignment.Center
- ) {
+ Row(
+ horizontalArrangement = Arrangement.spacedBy(16.dp),
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Box(
+ modifier = Modifier.width(previewWidth).aspectRatio(16f / 9f)
+ .clip(BrowseShapes.Artwork)
+ .background(AppColors.SurfaceEmphasis)
+ .border(1.dp, AppColors.Outline, BrowseShapes.Artwork),
+ contentAlignment = Alignment.Center
+ ) {
+ if (displayUrl != null) {
+ AsyncImage(
+ model = rememberCrossfadeImageModel(displayUrl),
+ contentDescription = episode.title,
+ modifier = Modifier.fillMaxSize(),
+ contentScale = ContentScale.Crop
+ )
+ }
+ Text(
+ text = stringResource(R.string.label_episode_full, episode.episodeNumber),
+ style = MaterialTheme.typography.labelSmall,
+ color = AppColors.TextPrimary,
+ modifier = Modifier.align(Alignment.TopStart)
+ .padding(7.dp)
+ .background(AppColors.HeroBottom.copy(alpha = 0.9f), RoundedCornerShape(6.dp))
+ .padding(horizontal = 8.dp, vertical = 4.dp)
+ )
+ if (showProgress) {
+ LinearProgressIndicator(
+ progress = { (episode.watchProgress.toFloat() / durationMs).coerceIn(0f, 1f) },
+ modifier = Modifier.align(Alignment.BottomCenter).fillMaxWidth().height(4.dp),
+ color = AppColors.Brand,
+ trackColor = AppColors.SurfaceEmphasis
+ )
+ }
+ }
+ Column(
+ modifier = Modifier.weight(1f),
+ verticalArrangement = Arrangement.spacedBy(5.dp)
+ ) {
+ Text(
+ text = episode.title,
+ style = MaterialTheme.typography.titleMedium,
+ color = AppColors.TextPrimary,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ episode.duration?.takeIf { it.isNotBlank() }?.let { duration ->
Text(
- text = stringResource(R.string.label_episode, episode.episodeNumber),
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextSecondary
+ duration,
+ style = MaterialTheme.typography.labelMedium,
+ color = AppColors.Brand
)
- if (displayUrl != null) {
- AsyncImage(
- model = displayUrl,
- contentDescription = episode.title,
- modifier = Modifier.fillMaxSize(),
- contentScale = ContentScale.Crop
- )
- }
}
- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
+ episode.plot?.takeIf { it.isNotBlank() }?.let { plot ->
Text(
- text = episode.title,
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextPrimary,
- maxLines = 1,
+ text = plot,
+ style = MaterialTheme.typography.bodySmall,
+ color = AppColors.TextSecondary,
+ maxLines = 2,
overflow = TextOverflow.Ellipsis
)
- ContentMetadataStrip(
- values = listOf(stringResource(R.string.label_episode_full, episode.episodeNumber), episode.duration ?: "")
- )
- episode.plot?.takeIf { it.isNotBlank() }?.let { plot ->
- Text(
- text = plot,
- style = MaterialTheme.typography.bodySmall,
- color = AppColors.TextSecondary,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis
- )
- }
}
}
- if (showProgress) {
- LinearProgressIndicator(
- progress = { (episode.watchProgress.toFloat() / durationMs).coerceIn(0f, 1f) },
- modifier = Modifier
- .fillMaxWidth()
- .padding(top = 8.dp)
- .height(3.dp),
- color = AppColors.Brand,
- trackColor = AppColors.SurfaceEmphasis
- )
- }
}
}
}
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/AddToGroupDialog.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/AddToGroupDialog.kt
index f03e4773..73d2584a 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/AddToGroupDialog.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/AddToGroupDialog.kt
@@ -1,44 +1,50 @@
-package com.streamvault.feature.catalog.presentation.components.dialogs
+package com.streamvault.feature.catalog.presentation.components.dialogs
-import com.streamvault.core.ui.design.contentOnColor
-import com.streamvault.core.ui.design.BrowseShapes
-import androidx.compose.foundation.layout.*
-import androidx.compose.foundation.border
+import android.view.KeyEvent as AndroidKeyEvent
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Close
-import androidx.compose.material.icons.filled.Star
import androidx.compose.material.icons.filled.Lock
+import androidx.compose.material.icons.filled.Star
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
+import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.input.key.KeyEvent
+import androidx.compose.ui.input.key.onPreviewKeyEvent
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
-import com.streamvault.domain.model.Channel
-import com.streamvault.domain.model.Category
-import androidx.compose.ui.res.stringResource
+import androidx.tv.material3.*
import com.streamvault.feature.catalog.R
+import com.streamvault.core.ui.device.rememberIsTelevisionDevice
import com.streamvault.core.ui.design.BrowseColors as AppColors
-import androidx.compose.ui.input.key.*
-import androidx.compose.ui.focus.onFocusChanged
-import androidx.compose.foundation.shape.CircleShape
+import com.streamvault.core.ui.interaction.TvClickableSurface
+import com.streamvault.domain.model.Category
+import com.streamvault.domain.model.Channel
import kotlinx.coroutines.delay
-import androidx.tv.material3.*
-import com.streamvault.core.ui.device.rememberIsTelevisionDevice
-import com.streamvault.core.ui.interaction.mouseClickable
-import android.view.KeyEvent as AndroidKeyEvent
+
+private val menuShape = RoundedCornerShape(20.dp)
+private val actionShape = RoundedCornerShape(12.dp)
@Composable
fun AddToGroupDialog(
contentTitle: String,
- channel: Channel? = null, // the channel being managed (for split screen)
+ channel: Channel? = null,
groups: List<Category>,
isFavorite: Boolean,
memberOfGroups: List<Long>,
@@ -56,422 +62,237 @@ fun AddToGroupDialog(
onMoveBackToLive: (() -> Unit)? = null
) {
var showCreateGroup by remember { mutableStateOf(false) }
+ var canInteract by remember { mutableStateOf(false) }
+ val firstActionFocus = remember { FocusRequester() }
val isTelevisionDevice = rememberIsTelevisionDevice()
- val contentFocusRequester = remember { FocusRequester() } // focuses first interactive item, not close button
- // Ghost-click debounce
- var canInteract by remember { mutableStateOf(false) }
- LaunchedEffect(Unit) {
- runCatching { contentFocusRequester.requestFocus() }
- delay(500)
- canInteract = true
+ LaunchedEffect(showCreateGroup) {
+ if (!showCreateGroup) {
+ canInteract = false
+ runCatching { firstActionFocus.requestFocus() }
+ delay(500)
+ canInteract = true
+ }
}
-
val blockOpenGesture: (KeyEvent) -> Boolean = { event ->
- !canInteract &&
- event.nativeKeyEvent.action == AndroidKeyEvent.ACTION_UP &&
- when (event.nativeKeyEvent.keyCode) {
- AndroidKeyEvent.KEYCODE_DPAD_CENTER,
- AndroidKeyEvent.KEYCODE_ENTER,
- AndroidKeyEvent.KEYCODE_NUMPAD_ENTER,
- AndroidKeyEvent.KEYCODE_BUTTON_A -> true
- else -> false
- }
+ !canInteract && event.nativeKeyEvent.action == AndroidKeyEvent.ACTION_UP &&
+ event.nativeKeyEvent.keyCode in listOf(
+ AndroidKeyEvent.KEYCODE_DPAD_CENTER, AndroidKeyEvent.KEYCODE_ENTER,
+ AndroidKeyEvent.KEYCODE_NUMPAD_ENTER, AndroidKeyEvent.KEYCODE_BUTTON_A
+ )
}
- val safeDismiss = { if (canInteract) onDismiss() }
- val safeToggleFavorite = { if (canInteract) onToggleFavorite() }
- val safeOpenSplitScreenPlanner = { if (canInteract) onOpenSplitScreenPlanner?.invoke() }
- val safeRemoveFromRecent = { if (canInteract) onRemoveFromRecent?.invoke() }
- val safeHideChannel = { if (canInteract) onHideChannel?.invoke() }
- val safeMoveToMovies = { if (canInteract) onMoveToMovies?.invoke() }
- val safeMoveToSeries = { if (canInteract) onMoveToSeries?.invoke() }
- val safeMoveBackToLive = { if (canInteract) onMoveBackToLive?.invoke() }
- val safeCreateGroup = { if (canInteract && onCreateGroup != null) showCreateGroup = true }
- val safeAddToGroup: (Category) -> Unit = { group -> if (canInteract) onAddToGroup(group) }
- val safeRemoveFromGroup: (Category) -> Unit = { group -> if (canInteract) onRemoveFromGroup(group) }
-
if (showCreateGroup && onCreateGroup != null) {
CreateGroupDialog(
onDismissRequest = { showCreateGroup = false },
onConfirm = { name ->
- onCreateGroup.invoke(name)
+ onCreateGroup(name)
showCreateGroup = false
}
)
- }
-
- if (!showCreateGroup) {
+ } else {
Dialog(
- onDismissRequest = safeDismiss,
+ onDismissRequest = { if (canInteract) onDismiss() },
properties = DialogProperties(usePlatformDefaultWidth = false)
) {
- val dialogModifier = if (isTelevisionDevice) {
- Modifier.width(400.dp)
- } else {
- Modifier
- }
-
- val dialogContent: @Composable (Modifier) -> Unit = { resolvedModifier ->
+ BoxWithConstraints(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
+ val width = when {
+ isTelevisionDevice -> Modifier.width(420.dp)
+ maxWidth < 700.dp -> Modifier.fillMaxWidth(0.92f)
+ maxWidth < 1280.dp -> Modifier.fillMaxWidth(0.58f)
+ else -> Modifier.width(420.dp)
+ }
+ val maxListHeight = maxHeight * 0.68f
Surface(
- shape = BrowseShapes.Control,
+ shape = menuShape,
colors = SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated),
- modifier = resolvedModifier
- .padding(16.dp)
+ modifier = width.padding(12.dp)
+ .border(1.dp, AppColors.Outline, menuShape)
.onPreviewKeyEvent(blockOpenGesture)
) {
- Column(modifier = Modifier.padding(24.dp)) {
- // Header
+ Column(
+ Modifier.background(
+ Brush.verticalGradient(
+ listOf(AppColors.BrandMuted.copy(alpha = 0.16f),
+ AppColors.SurfaceElevated, AppColors.Surface)
+ )
+ ).padding(22.dp),
+ verticalArrangement = Arrangement.spacedBy(16.dp)
+ ) {
Row(
- modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
+ Modifier.fillMaxWidth(),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
- text = stringResource(R.string.add_group_manage_title, contentTitle),
+ stringResource(R.string.add_group_manage_title, contentTitle),
style = MaterialTheme.typography.titleLarge,
+ fontWeight = FontWeight.SemiBold,
color = AppColors.TextPrimary,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
modifier = Modifier.weight(1f)
)
- IconButton(
- onClick = safeDismiss,
- modifier = Modifier.mouseClickable(onClick = safeDismiss)
+ MenuFocusSurface(
+ onClick = { if (canInteract) onDismiss() },
+ modifier = Modifier.size(38.dp),
+ containerColor = AppColors.SurfaceAccent
) {
- Icon(Icons.Default.Close, contentDescription = stringResource(R.string.add_group_close_cd))
+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+ Icon(Icons.Default.Close,
+ contentDescription = stringResource(R.string.add_group_close_cd),
+ tint = AppColors.TextSecondary,
+ modifier = Modifier.size(20.dp))
+ }
}
}
LazyColumn(
- modifier = Modifier.weight(1f, fill = false),
+ modifier = Modifier.heightIn(max = maxListHeight),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
- // ׳’ג€ג‚¬׳’ג€ג‚¬ Favorites ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
- item {
- var isFocused by remember { mutableStateOf(false) }
- val favoriteInk = contentOnColor(
- when {
- isFocused -> AppColors.Focus
- isFavorite -> AppColors.Warning
- else -> AppColors.Brand
- }
- )
- Button(
- onClick = safeToggleFavorite,
- modifier = Modifier
- .fillMaxWidth()
- .focusRequester(contentFocusRequester)
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeToggleFavorite),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isFavorite -> AppColors.Warning
- else -> AppColors.Brand
- },
- contentColor = favoriteInk
- )
- ) {
- Icon(
- imageVector = Icons.Default.Star,
- contentDescription = if (isFavorite) stringResource(R.string.add_group_remove_favorites)
- else stringResource(R.string.add_group_add_favorites),
- tint = favoriteInk
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = if (isFavorite) stringResource(R.string.add_group_remove_favorites)
- else stringResource(R.string.add_group_add_favorites),
- color = favoriteInk
+ item {
+ MenuAction(
+ label = stringResource(
+ if (isFavorite) R.string.add_group_remove_favorites
+ else R.string.add_group_add_favorites),
+ icon = Icons.Default.Star,
+ accent = AppColors.Brand,
+ selected = isFavorite,
+ onClick = { if (canInteract) onToggleFavorite() },
+ modifier = Modifier.focusRequester(firstActionFocus)
)
}
- }
-
- if (onMoveToMovies != null) {
- item {
- Button(
- onClick = safeMoveToMovies,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveToMovies),
- colors = ButtonDefaults.colors(
- containerColor = AppColors.Brand,
- contentColor = contentOnColor(AppColors.Brand)
- )
- ) { Text(stringResource(R.string.m3u_move_to_movies)) }
+ if (onMoveToMovies != null) item {
+ MenuAction(stringResource(R.string.m3u_move_to_movies), Icons.Default.Add,
+ AppColors.Brand, onClick = { if (canInteract) onMoveToMovies() })
}
- }
-
- if (onMoveToSeries != null) {
- item {
- Button(
- onClick = safeMoveToSeries,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveToSeries),
- colors = ButtonDefaults.colors(
- containerColor = AppColors.Success,
- contentColor = contentOnColor(AppColors.Success)
- )
- ) { Text(stringResource(R.string.m3u_move_to_series)) }
+ if (onMoveToSeries != null) item {
+ MenuAction(stringResource(R.string.m3u_move_to_series), Icons.Default.Add,
+ AppColors.Success, onClick = { if (canInteract) onMoveToSeries() })
}
- }
-
- if (onMoveBackToLive != null) {
- item {
- Button(
- onClick = safeMoveBackToLive,
- modifier = Modifier.fillMaxWidth().mouseClickable(onClick = safeMoveBackToLive),
- colors = ButtonDefaults.colors(
- containerColor = MaterialTheme.colorScheme.errorContainer,
- contentColor = MaterialTheme.colorScheme.onErrorContainer
- )
- ) { Text(stringResource(R.string.m3u_move_back_to_live)) }
+ if (onMoveBackToLive != null) item {
+ MenuAction(stringResource(R.string.m3u_move_back_to_live), Icons.Default.Add,
+ AppColors.Brand, onClick = { if (canInteract) onMoveBackToLive() })
}
- }
-
- // ׳’ג€ג‚¬׳’ג€ג‚¬ Split Screen ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
- if (channel != null && onOpenSplitScreenPlanner != null) {
- item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeOpenSplitScreenPlanner,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeOpenSplitScreenPlanner),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isQueuedForSplitScreen -> AppColors.Success.copy(alpha = 0.8f)
- else -> AppColors.Success
- }
+ if (channel != null && onOpenSplitScreenPlanner != null) item {
+ MenuAction(
+ label = stringResource(
+ if (isQueuedForSplitScreen) R.string.multiview_queued
+ else R.string.multiview_add_to_split),
+ icon = Icons.Default.Add,
+ accent = AppColors.Success,
+ selected = isQueuedForSplitScreen,
+ onClick = { if (canInteract) onOpenSplitScreenPlanner() }
)
- ) {
- Icon(
- imageVector = Icons.Default.Add,
- contentDescription = stringResource(R.string.multiview_add_to_split),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else Color.White
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = if (isQueuedForSplitScreen) stringResource(R.string.multiview_queued)
- else stringResource(R.string.multiview_add_to_split),
- color = if (isFocused) contentOnColor(AppColors.Focus) else Color.White
- )
- }
}
- }
-
- // ׳’ג€ג‚¬׳’ג€ג‚¬ Hide channel ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
- if (channel != null && onHideChannel != null) {
- item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeHideChannel,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeHideChannel),
- colors = ButtonDefaults.colors(
- containerColor = if (isFocused) AppColors.Focus else AppColors.SurfaceAccent,
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Icon(
- imageVector = Icons.Default.Lock,
- contentDescription = stringResource(R.string.channel_action_hide),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.channel_action_hide),
- color = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- }
+ if (channel != null && onHideChannel != null) item {
+ MenuAction(stringResource(R.string.channel_action_hide), Icons.Default.Lock,
+ AppColors.Warning, onClick = { if (canInteract) onHideChannel() })
+ }
+ if (onRemoveFromRecent != null) item {
+ MenuAction(stringResource(R.string.channel_options_remove_from_recent),
+ Icons.Default.Close, AppColors.Warning,
+ onClick = { if (canInteract) onRemoveFromRecent() })
}
- }
-
- // ׳’ג€ג‚¬׳’ג€ג‚¬ Remove from Recent ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
- if (onRemoveFromRecent != null) {
item {
- var isFocused by remember { mutableStateOf(false) }
- Button(
- onClick = safeRemoveFromRecent,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = safeRemoveFromRecent),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- else -> MaterialTheme.colorScheme.errorContainer
- },
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- ) {
- Icon(
- imageVector = Icons.Default.Close,
- contentDescription = stringResource(R.string.channel_options_remove_from_recent),
- tint = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- Spacer(modifier = Modifier.width(8.dp))
- Text(
- text = stringResource(R.string.channel_options_remove_from_recent),
- color = if (isFocused) contentOnColor(AppColors.Focus) else MaterialTheme.colorScheme.onErrorContainer
- )
- }
+ Spacer(Modifier.height(4.dp))
+ Box(Modifier.fillMaxWidth().height(1.dp).background(AppColors.Outline))
+ Text(stringResource(R.string.add_group_custom_groups_title),
+ style = MaterialTheme.typography.labelLarge,
+ fontWeight = FontWeight.SemiBold,
+ color = AppColors.TextSecondary,
+ modifier = Modifier.padding(top = 14.dp, bottom = 4.dp))
}
- }
-
- // ׳’ג€ג‚¬׳’ג€ג‚¬ Custom Groups Section ׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬׳’ג€ג‚¬
- item {
- Box(
- modifier = Modifier
- .fillMaxWidth()
- .padding(vertical = 8.dp)
- .height(1.dp)
- .background(AppColors.SurfaceAccent.copy(alpha = 0.7f))
- )
- Text(
- text = stringResource(R.string.add_group_custom_groups_title),
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextPrimary,
- modifier = Modifier.padding(bottom = 8.dp)
- )
- }
-
- items(
- items = groups,
- key = { it.id },
- contentType = { "category" }
- ) { group ->
- val isMember = memberOfGroups.contains(group.id)
- var isFocused by remember { mutableStateOf(false) }
- val groupAction = { if (isMember) safeRemoveFromGroup(group) else safeAddToGroup(group) }
-
- Row(
- modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),
- horizontalArrangement = Arrangement.SpaceBetween,
- verticalAlignment = Alignment.CenterVertically
- ) {
- Text(
- text = group.name,
- style = MaterialTheme.typography.bodyMedium,
- color = AppColors.TextPrimary,
- modifier = Modifier.weight(1f)
+ items(groups, key = { it.id }) { group ->
+ val isMember = group.id in memberOfGroups
+ MenuAction(
+ label = group.name,
+ icon = Icons.Default.Add,
+ accent = AppColors.Brand,
+ selected = isMember,
+ trailing = stringResource(
+ if (isMember) R.string.add_group_remove_btn
+ else R.string.add_group_add_btn),
+ onClick = {
+ if (canInteract) {
+ if (isMember) onRemoveFromGroup(group) else onAddToGroup(group)
+ }
+ }
)
- Button(
- onClick = groupAction,
- modifier = Modifier
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .onFocusChanged { isFocused = it.isFocused }
- .border(
- if (isFocused) 3.dp else 0.dp,
- if (isFocused) AppColors.Focus else Color.Transparent,
- CircleShape
- )
- .mouseClickable(onClick = groupAction),
- colors = ButtonDefaults.colors(
- containerColor = when {
- isFocused -> AppColors.Focus
- isMember -> AppColors.Live.copy(alpha = 0.2f)
- else -> AppColors.BrandMuted.copy(alpha = 0.4f)
- },
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Text(
- if (isMember) stringResource(R.string.add_group_remove_btn)
- else stringResource(R.string.add_group_add_btn)
- )
- }
}
- }
-
- if (onCreateGroup != null) item {
- var isFocused by remember { mutableStateOf(false) }
- Spacer(modifier = Modifier.height(8.dp))
- OutlinedButton(
- onClick = safeCreateGroup,
- modifier = Modifier
- .fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
- .background(
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = CircleShape
- )
- .border(
- if (isFocused) 3.dp else 1.dp,
- if (isFocused) AppColors.Focus else AppColors.BrandMuted.copy(alpha = 0.55f),
- CircleShape
- )
- .mouseClickable(onClick = safeCreateGroup),
- colors = ButtonDefaults.colors(
- containerColor = if (isFocused) AppColors.Focus else Color.Transparent,
- contentColor = if (isFocused) contentOnColor(AppColors.Focus) else AppColors.TextPrimary
- )
- ) {
- Icon(Icons.Default.Add, contentDescription = stringResource(R.string.add_group_create_new_btn))
- Spacer(modifier = Modifier.width(8.dp))
- Text(stringResource(R.string.add_group_create_new_btn))
- }
- }
+ if (onCreateGroup != null) item {
+ MenuAction(stringResource(R.string.add_group_create_new_btn),
+ Icons.Default.Add, AppColors.Brand,
+ onClick = { if (canInteract) showCreateGroup = true })
+ }
}
}
}
}
+ }
+ }
+}
- if (isTelevisionDevice) {
- dialogContent(dialogModifier)
- } else {
- BoxWithConstraints(
- modifier = Modifier.fillMaxWidth(),
- contentAlignment = Alignment.Center
- ) {
- val responsiveModifier = when {
- maxWidth < 700.dp -> Modifier.fillMaxWidth(0.92f)
- maxWidth < 1280.dp -> Modifier.fillMaxWidth(0.58f)
- else -> Modifier.width(400.dp)
- }
- dialogContent(responsiveModifier)
- }
+@Composable
+private fun MenuAction(
+ label: String,
+ icon: ImageVector,
+ accent: Color,
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ selected: Boolean = false,
+ trailing: String? = null
+) {
+ MenuFocusSurface(
+ onClick = onClick,
+ modifier = modifier.fillMaxWidth(),
+ containerColor = if (selected) accent.copy(alpha = 0.17f) else AppColors.SurfaceAccent
+ ) {
+ Row(
+ Modifier.fillMaxWidth().padding(horizontal = 14.dp, vertical = 11.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Box(
+ Modifier.size(34.dp).background(accent.copy(alpha = 0.17f), RoundedCornerShape(9.dp)),
+ contentAlignment = Alignment.Center
+ ) {
+ Icon(icon, contentDescription = null, tint = accent, modifier = Modifier.size(20.dp))
+ }
+ Text(label, style = MaterialTheme.typography.bodyMedium,
+ fontWeight = FontWeight.Medium, color = AppColors.TextPrimary,
+ maxLines = 2, overflow = TextOverflow.Ellipsis,
+ modifier = Modifier.weight(1f))
+ if (trailing != null) {
+ Text(trailing, style = MaterialTheme.typography.labelMedium, color = accent)
}
}
}
}
+@Composable
+private fun MenuFocusSurface(
+ onClick: () -> Unit,
+ modifier: Modifier,
+ containerColor: Color,
+ content: @Composable BoxScope.() -> Unit
+) {
+ TvClickableSurface(
+ onClick = onClick,
+ modifier = modifier,
+ shape = ClickableSurfaceDefaults.shape(actionShape),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = containerColor,
+ focusedContainerColor = containerColor,
+ contentColor = AppColors.TextPrimary,
+ focusedContentColor = AppColors.TextPrimary
+ ),
+ border = ClickableSurfaceDefaults.border(
+ border = Border(border = BorderStroke(1.dp, AppColors.Outline), shape = actionShape),
+ focusedBorder = Border(border = BorderStroke(2.dp, AppColors.Focus), shape = actionShape)
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),
+ content = content
+ )
+}
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/CategoryOptionsDialog.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/CategoryOptionsDialog.kt
index 6b71495c..2b9c125a 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/CategoryOptionsDialog.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/components/dialogs/CategoryOptionsDialog.kt
@@ -1,7 +1,8 @@
-package com.streamvault.feature.catalog.presentation.components.dialogs
+package com.streamvault.feature.catalog.presentation.components.dialogs
import com.streamvault.core.ui.design.BrowseShapes
import androidx.compose.foundation.background
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
@@ -22,6 +23,7 @@ import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.tv.material3.Button
import androidx.tv.material3.ButtonDefaults
+import androidx.tv.material3.Border
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
@@ -32,6 +34,7 @@ import com.streamvault.core.ui.design.browse.OnSurfaceDim
import com.streamvault.core.ui.design.browse.Primary
import com.streamvault.core.ui.design.browse.SurfaceElevated
import com.streamvault.core.ui.interaction.mouseClickable
+import com.streamvault.core.ui.design.BrowseColors
import com.streamvault.core.ui.components.dialogs.rememberDialogOpenGestureBlocker
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.ui.Alignment
@@ -206,10 +209,18 @@ fun CategoryOptionsDialog(
Button(
onClick = safeDismiss,
modifier = Modifier.mouseClickable(onClick = safeDismiss),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.08f),
- contentColor = OnSurface
- )
+ containerColor = BrowseColors.SurfaceAccent,
+ focusedContainerColor = BrowseColors.SurfaceAccent,
+ contentColor = BrowseColors.TextPrimary,
+ focusedContentColor = BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(stringResource(R.string.category_options_cancel))
}
@@ -228,10 +239,18 @@ private fun PremiumDialogAction(
Button(
onClick = onClick,
modifier = Modifier.fillMaxWidth().mouseClickable(onClick = onClick),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else Color.White.copy(alpha = 0.08f),
- contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else OnSurface
- )
+ containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ focusedContainerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary,
+ focusedContentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(label)
}
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MovieDetailScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MovieDetailScreen.kt
index 0198b38a..a17266ec 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MovieDetailScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/movies/MovieDetailScreen.kt
@@ -1,6 +1,5 @@
package com.streamvault.feature.catalog.presentation.movies
-import com.streamvault.core.ui.design.browsePrimaryButtonColors
import com.streamvault.core.ui.design.BrowseShapes
import android.content.Intent
import android.content.ClipData
@@ -9,6 +8,7 @@ import android.content.Context
import android.net.Uri
import android.widget.Toast
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.outlined.FavoriteBorder
@@ -59,6 +60,9 @@ import com.streamvault.feature.catalog.api.CatalogPlatformHost
import com.streamvault.feature.catalog.api.CatalogUiEvent
import com.streamvault.feature.catalog.presentation.catalogMessageText
import com.streamvault.feature.catalog.presentation.components.ExternalRatingsStrip
+import com.streamvault.feature.catalog.presentation.components.DetailActionButton
+import com.streamvault.feature.catalog.presentation.components.DetailInfoPanel
+import com.streamvault.feature.catalog.presentation.components.DetailSectionHeading
import com.streamvault.feature.catalog.presentation.components.formatVodRatingLabel
import com.streamvault.feature.catalog.presentation.time.formatPositionMs
import com.streamvault.core.ui.device.rememberIsTelevisionDevice
@@ -315,13 +319,14 @@ private fun MovieDetailContent(
}
}
+ if (listOf(movie.director, movie.releaseDate, movie.duration, movie.genre, movie.cast)
+ .any { !it.isNullOrBlank() }) {
+ item { MovieFactGrid(movie = movie) }
+ }
+
if (relatedContent.isNotEmpty()) {
item {
- Text(
- text = stringResource(R.string.movie_detail_related),
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextPrimary
- )
+ DetailSectionHeading(stringResource(R.string.movie_detail_related))
}
item {
LazyRow(
@@ -375,6 +380,7 @@ private fun MoviePoster(
.aspectRatio(2f / 3f)
.clip(BrowseShapes.Panel)
.background(AppColors.SurfaceElevated)
+ .border(1.dp, AppColors.Outline, BrowseShapes.Panel)
) {
AsyncImage(
model = rememberCrossfadeImageModel(movie.posterUrl ?: movie.backdropUrl),
@@ -443,76 +449,45 @@ private fun MovieDetailHeroText(
isLoading = isLoadingExternalRatings
)
- MovieFactGrid(movie = movie)
-
MovieVersionSelector(
variants = movie.variants,
selectedVariantId = movie.selectedVariantId ?: movie.id,
onSelectVariant = onSelectVariant
)
- Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
- TvButton(
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically) {
+ item { DetailActionButton(
+ label = if (hasResume) {
+ stringResource(R.string.movie_detail_resume_from, formatPositionMs(resumePositionMs))
+ } else {
+ stringResource(R.string.movie_detail_play)
+ },
onClick = onPlay,
modifier = Modifier.focusRequester(playButtonFocusRequester),
- colors = browsePrimaryButtonColors()
- ) {
- Text(
- text = if (hasResume) {
- stringResource(R.string.movie_detail_resume_from, formatPositionMs(resumePositionMs))
- } else {
- stringResource(R.string.movie_detail_play)
- }
- )
- }
- TvButton(
- onClick = onCopyUrl,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(stringResource(R.string.stream_url_copy))
- }
- TvButton(
- onClick = onDownload,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(stringResource(R.string.download_button_label))
- }
- TvButton(
- onClick = onCast,
- enabled = !isCasting,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(
- stringResource(
- if (isCasting) R.string.cast_launching else R.string.cast_button_label
- )
- )
- }
+ primary = true
+ ) }
+ item { DetailActionButton(stringResource(R.string.stream_url_copy), onCopyUrl) }
+ item { DetailActionButton(stringResource(R.string.download_button_label), onDownload) }
+ item { DetailActionButton(
+ stringResource(if (isCasting) R.string.cast_launching else R.string.cast_button_label),
+ onCast, enabled = !isCasting
+ ) }
if (hasTrailer) {
- TvButton(
- onClick = onPlayTrailer,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(stringResource(R.string.movie_detail_trailer))
- }
+ item { DetailActionButton(stringResource(R.string.movie_detail_trailer), onPlayTrailer) }
}
- TvIconButton(
+ item { TvIconButton(
onClick = onToggleFavorite,
+ scale = ButtonDefaults.scale(focusedScale = 1f),
+ shape = ButtonDefaults.shape(shape = CircleShape),
+ border = ButtonDefaults.border(
+ border = Border(androidx.compose.foundation.BorderStroke(1.dp, AppColors.Outline), shape = CircleShape),
+ focusedBorder = Border(androidx.compose.foundation.BorderStroke(2.dp, AppColors.Focus), shape = CircleShape)
+ ),
colors = ButtonDefaults.colors(
containerColor = if (movie.isFavorite) AppColors.Brand else AppColors.SurfaceEmphasis,
- contentColor = if (movie.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary
+ focusedContainerColor = if (movie.isFavorite) AppColors.Brand else AppColors.SurfaceEmphasis,
+ contentColor = if (movie.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary,
+ focusedContentColor = if (movie.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary
)
) {
Icon(
@@ -521,7 +496,7 @@ private fun MovieDetailHeroText(
if (movie.isFavorite) R.string.favorites_remove else R.string.favorites_add
)
)
- }
+ } }
}
Text(
@@ -529,7 +504,7 @@ private fun MovieDetailHeroText(
?: stringResource(R.string.movie_plot_fallback),
style = MaterialTheme.typography.bodyLarge,
color = AppColors.TextSecondary,
- maxLines = 6,
+ maxLines = 4,
overflow = TextOverflow.Ellipsis
)
}
@@ -592,32 +567,41 @@ private fun resolveTrailerUrl(rawTrailer: String?): String? {
@Composable
private fun MovieFactGrid(movie: Movie) {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- MovieFactRow(label = stringResource(R.string.movie_detail_director), value = movie.director)
- MovieFactRow(label = stringResource(R.string.movie_detail_release_date), value = movie.releaseDate)
- MovieFactRow(label = stringResource(R.string.movie_detail_duration), value = movie.duration)
- MovieFactRow(label = stringResource(R.string.movie_detail_genre), value = movie.genre)
- MovieFactRow(label = stringResource(R.string.movie_detail_cast), value = movie.cast)
+ DetailInfoPanel(spacing = 12.dp) {
+ movie.director?.takeIf { it.isNotBlank() }?.let {
+ MovieFactRow(label = stringResource(R.string.movie_detail_director), value = it)
+ }
+ movie.releaseDate?.takeIf { it.isNotBlank() }?.let {
+ MovieFactRow(label = stringResource(R.string.movie_detail_release_date), value = it)
+ }
+ movie.duration?.takeIf { it.isNotBlank() }?.let {
+ MovieFactRow(label = stringResource(R.string.movie_detail_duration), value = it)
+ }
+ movie.genre?.takeIf { it.isNotBlank() }?.let {
+ MovieFactRow(label = stringResource(R.string.movie_detail_genre), value = it)
+ }
+ movie.cast?.takeIf { it.isNotBlank() }?.let {
+ MovieFactRow(label = stringResource(R.string.movie_detail_cast), value = it)
+ }
}
}
@Composable
private fun MovieFactRow(
label: String,
- value: String?
+ value: String
) {
- val resolvedValue = value?.takeIf { it.isNotBlank() } ?: stringResource(R.string.movie_detail_unknown)
Row(horizontalArrangement = Arrangement.spacedBy(14.dp)) {
Text(
text = label,
- style = MaterialTheme.typography.titleMedium,
- color = AppColors.TextPrimary,
- modifier = Modifier.width(180.dp)
+ style = MaterialTheme.typography.labelMedium,
+ color = AppColors.TextTertiary,
+ modifier = Modifier.width(130.dp)
)
Text(
- text = resolvedValue,
- style = MaterialTheme.typography.bodyLarge,
- color = AppColors.TextSecondary,
+ text = value,
+ style = MaterialTheme.typography.bodyMedium,
+ color = AppColors.TextPrimary,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
index fd2178a3..2e3ecb1f 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/search/SearchScreen.kt
@@ -1328,36 +1328,34 @@ private fun SearchActionButton(
focusRequester: FocusRequester? = null,
enabled: Boolean = true
) {
- var isFocused by remember { mutableStateOf(false) }
val baseModifier = modifier
.fillMaxWidth()
- .onFocusChanged { isFocused = it.isFocused }
.then(
if (focusRequester != null) Modifier.focusRequester(focusRequester) else Modifier
)
- .border(
- width = if (isFocused) 2.dp else 0.dp,
- color = if (isFocused) AppColors.Focus else Color.Transparent,
- shape = BrowseShapes.Artwork
- )
.mouseClickable(onClick = onClick)
+ val actionColor = if (isActive) AppColors.Warning.copy(alpha = 0.18f)
+ else AppColors.SurfaceAccent
+
Button(
onClick = onClick,
enabled = enabled,
modifier = baseModifier,
colors = ButtonDefaults.colors(
- containerColor = when {
- !enabled -> AppColors.Surface.copy(alpha = 0.3f)
- isFocused -> AppColors.Focus
- isActive -> AppColors.Warning.copy(alpha = 0.85f)
- else -> AppColors.Brand.copy(alpha = 0.70f)
- },
- contentColor = if (!enabled) AppColors.TextSecondary else Color.Black,
+ containerColor = actionColor,
+ focusedContainerColor = actionColor,
+ contentColor = AppColors.TextPrimary,
+ focusedContentColor = AppColors.TextPrimary,
disabledContainerColor = AppColors.Surface.copy(alpha = 0.3f),
disabledContentColor = AppColors.TextSecondary
),
- shape = ButtonDefaults.shape(shape = BrowseShapes.Artwork)
+ shape = ButtonDefaults.shape(shape = BrowseShapes.Control),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, AppColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, AppColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Icon(
imageVector = icon,
diff --git a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesDetailScreen.kt b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesDetailScreen.kt
index 7f7934dc..d37fbfe0 100644
--- a/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesDetailScreen.kt
+++ b/feature/catalog/src/main/java/com/streamvault/feature/catalog/presentation/series/SeriesDetailScreen.kt
@@ -1,6 +1,5 @@
package com.streamvault.feature.catalog.presentation.series
-import com.streamvault.core.ui.design.browsePrimaryButtonColors
import com.streamvault.core.ui.design.BrowseShapes
import android.content.ClipData
import android.content.ClipboardManager
@@ -8,6 +7,8 @@ import android.content.Context
import android.content.ContextWrapper
import android.widget.Toast
import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -25,6 +26,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.outlined.FavoriteBorder
@@ -63,6 +65,8 @@ import com.streamvault.feature.catalog.api.CatalogPlatformHost
import com.streamvault.feature.catalog.api.CatalogUiEvent
import com.streamvault.feature.catalog.presentation.catalogMessageText
import com.streamvault.feature.catalog.presentation.components.EpisodeRowCard
+import com.streamvault.feature.catalog.presentation.components.DetailActionButton
+import com.streamvault.feature.catalog.presentation.components.DetailSectionHeading
import com.streamvault.feature.catalog.presentation.components.ExternalRatingsStrip
import com.streamvault.feature.catalog.presentation.components.formatVodRatingLabel
import com.streamvault.feature.catalog.presentation.time.formatPositionMs
@@ -269,6 +273,7 @@ private fun SeriesDetailContent(
.aspectRatio(2f / 3f)
.clip(BrowseShapes.Panel)
.background(AppColors.SurfaceElevated)
+ .border(1.dp, AppColors.Outline, BrowseShapes.Panel)
) {
AsyncImage(
model = rememberCrossfadeImageModel(series.posterUrl ?: series.backdropUrl),
@@ -357,6 +362,7 @@ private fun SeriesDetailContent(
.aspectRatio(2f / 3f)
.clip(BrowseShapes.Panel)
.background(AppColors.SurfaceElevated)
+ .border(1.dp, AppColors.Outline, BrowseShapes.Panel)
) {
AsyncImage(
model = rememberCrossfadeImageModel(series.posterUrl ?: series.backdropUrl),
@@ -440,11 +446,7 @@ private fun SeriesDetailContent(
if (series.seasons.isNotEmpty()) {
item {
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
- Text(
- text = stringResource(R.string.series_seasons),
- style = MaterialTheme.typography.titleLarge,
- color = AppColors.TextPrimary
- )
+ DetailSectionHeading(stringResource(R.string.series_seasons))
LazyRow(
horizontalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = PaddingValues(vertical = 2.dp)
@@ -463,18 +465,10 @@ private fun SeriesDetailContent(
selectedSeason?.let { season ->
item {
- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
- Text(
- text = stringResource(R.string.series_episodes, season.episodes.size),
- style = MaterialTheme.typography.titleLarge,
- color = AppColors.TextPrimary
- )
- Text(
- text = season.name,
- style = MaterialTheme.typography.bodyMedium,
- color = AppColors.TextTertiary
- )
- }
+ DetailSectionHeading(
+ stringResource(R.string.series_episodes, season.episodes.size),
+ season.name
+ )
}
val fallbackCover = series?.let {
it.posterUrl ?: it.backdropUrl
@@ -558,52 +552,31 @@ private fun SeriesDetailActions(
onCast: () -> Unit,
onToggleFavorite: () -> Unit
) {
- Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
- TvButton(
- onClick = { onResumeClick(resumeEpisode) },
- colors = browsePrimaryButtonColors()
- ) {
- Text(
- text = if (hasProgress) {
- stringResource(
- R.string.series_detail_resume,
- resumeEpisode.seasonNumber,
- resumeEpisode.episodeNumber,
- formatPositionMs(resumeEpisode.watchProgress)
- )
- } else {
- stringResource(
- R.string.series_detail_play_episode,
- resumeEpisode.seasonNumber,
- resumeEpisode.episodeNumber
- )
- }
- )
- }
- TvButton(
- onClick = onCopyUrl,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(stringResource(R.string.stream_url_copy))
- }
- TvButton(
- onClick = onCast,
- enabled = !isCasting,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(
+ LazyRow(horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically) {
+ item { DetailActionButton(
+ label = if (hasProgress) {
stringResource(
- if (isCasting) R.string.cast_launching else R.string.cast_button_label
+ R.string.series_detail_resume,
+ resumeEpisode.seasonNumber,
+ resumeEpisode.episodeNumber,
+ formatPositionMs(resumeEpisode.watchProgress)
)
- )
- }
- SeriesDetailFavoriteAction(series = series, onToggleFavorite = onToggleFavorite)
+ } else {
+ stringResource(
+ R.string.series_detail_play_episode,
+ resumeEpisode.seasonNumber,
+ resumeEpisode.episodeNumber
+ )
+ },
+ onClick = { onResumeClick(resumeEpisode) },
+ primary = true
+ ) }
+ item { DetailActionButton(stringResource(R.string.stream_url_copy), onCopyUrl) }
+ item { DetailActionButton(
+ stringResource(if (isCasting) R.string.cast_launching else R.string.cast_button_label),
+ onCast, enabled = !isCasting
+ ) }
+ item { SeriesDetailFavoriteAction(series = series, onToggleFavorite = onToggleFavorite) }
}
}
@@ -614,9 +587,17 @@ private fun SeriesDetailFavoriteAction(
) {
TvIconButton(
onClick = onToggleFavorite,
+ scale = ButtonDefaults.scale(focusedScale = 1f),
+ shape = ButtonDefaults.shape(shape = CircleShape),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, AppColors.Outline), shape = CircleShape),
+ focusedBorder = Border(BorderStroke(2.dp, AppColors.Focus), shape = CircleShape)
+ ),
colors = ButtonDefaults.colors(
containerColor = if (series.isFavorite) AppColors.Brand else AppColors.SurfaceEmphasis,
- contentColor = if (series.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary
+ focusedContainerColor = if (series.isFavorite) AppColors.Brand else AppColors.SurfaceEmphasis,
+ contentColor = if (series.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary,
+ focusedContentColor = if (series.isFavorite) AppColors.OnPrimary else AppColors.TextSecondary
)
) {
Icon(
@@ -640,7 +621,7 @@ fun SeasonChip(
colors = ClickableSurfaceDefaults.colors(
containerColor = if (isSelected) AppColors.BrandMuted else AppColors.SurfaceElevated,
contentColor = AppColors.TextPrimary,
- focusedContainerColor = AppColors.SurfaceEmphasis,
+ focusedContainerColor = if (isSelected) AppColors.BrandMuted else AppColors.SurfaceElevated,
focusedContentColor = AppColors.TextPrimary
),
border = ClickableSurfaceDefaults.border(
@@ -652,7 +633,8 @@ fun SeasonChip(
border = androidx.compose.foundation.BorderStroke(2.dp, AppColors.Focus),
shape = BrowseShapes.Control
)
- )
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
) {
Text(
text = season.name,
@@ -682,8 +664,13 @@ fun EpisodeItem(
shape = ClickableSurfaceDefaults.shape(shape = BrowseShapes.Panel),
colors = ClickableSurfaceDefaults.colors(
containerColor = AppColors.SurfaceElevated,
- focusedContainerColor = AppColors.SurfaceEmphasis
+ focusedContainerColor = AppColors.SurfaceElevated
+ ),
+ border = ClickableSurfaceDefaults.border(
+ border = Border(BorderStroke(1.dp, AppColors.Outline), shape = BrowseShapes.Panel),
+ focusedBorder = Border(BorderStroke(2.dp, AppColors.Focus), shape = BrowseShapes.Panel)
),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),
modifier = Modifier.weight(1f)
) {
EpisodeRowCard(
@@ -692,29 +679,17 @@ fun EpisodeItem(
modifier = Modifier.fillMaxWidth()
)
}
- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
- TvButton(
- onClick = onDownload,
- colors = ButtonDefaults.colors(
- containerColor = AppColors.SurfaceEmphasis,
- contentColor = AppColors.TextPrimary
- )
- ) {
- Text(stringResource(R.string.download_button_label))
- }
- TvButton(onClick = onCopyUrl) {
- Text(stringResource(R.string.stream_url_copy))
- }
- TvButton(
- onClick = onCast,
- enabled = !isCasting
- ) {
- Text(
- stringResource(
- if (isCasting) R.string.cast_launching else R.string.cast_button_label
- )
- )
- }
+ Column(
+ modifier = Modifier.width(140.dp),
+ verticalArrangement = Arrangement.spacedBy(7.dp)
+ ) {
+ DetailActionButton(stringResource(R.string.download_button_label), onDownload,
+ modifier = Modifier.fillMaxWidth(), compact = true)
+ DetailActionButton(stringResource(R.string.stream_url_copy), onCopyUrl,
+ modifier = Modifier.fillMaxWidth(), compact = true)
+ DetailActionButton(
+ stringResource(if (isCasting) R.string.cast_launching else R.string.cast_button_label),
+ onCast, modifier = Modifier.fillMaxWidth(), enabled = !isCasting, compact = true)
}
}
}
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveCategoryOptionsDialog.kt b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveCategoryOptionsDialog.kt
index 67cf1b7c..c561260d 100644
--- a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveCategoryOptionsDialog.kt
+++ b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveCategoryOptionsDialog.kt
@@ -2,6 +2,7 @@ package com.streamvault.feature.live.home
import com.streamvault.core.ui.design.BrowseShapes
import androidx.compose.foundation.background
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
@@ -23,11 +24,13 @@ import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.tv.material3.Button
import androidx.tv.material3.ButtonDefaults
+import androidx.tv.material3.Border
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
import com.streamvault.core.ui.components.dialogs.rememberDialogOpenGestureBlocker
+import com.streamvault.core.ui.design.BrowseColors
import com.streamvault.core.ui.interaction.mouseClickable
import com.streamvault.core.ui.design.browse.OnSurface
import com.streamvault.core.ui.design.browse.OnSurfaceDim
@@ -212,10 +215,18 @@ fun LiveCategoryOptionsDialog(
Button(
onClick = safeDismiss,
modifier = Modifier.mouseClickable(onClick = safeDismiss),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.08f),
- contentColor = OnSurface
- )
+ containerColor = BrowseColors.SurfaceAccent,
+ focusedContainerColor = BrowseColors.SurfaceAccent,
+ contentColor = BrowseColors.TextPrimary,
+ focusedContentColor = BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(labels.cancel)
}
@@ -234,18 +245,18 @@ private fun LiveCategoryOptionsAction(
Button(
onClick = onClick,
modifier = Modifier.fillMaxWidth().mouseClickable(onClick = onClick),
+ shape = ButtonDefaults.shape(BrowseShapes.Control),
colors = ButtonDefaults.colors(
- containerColor = if (destructive) {
- MaterialTheme.colorScheme.errorContainer
- } else {
- Color.White.copy(alpha = 0.08f)
- },
- contentColor = if (destructive) {
- MaterialTheme.colorScheme.onErrorContainer
- } else {
- OnSurface
- }
- )
+ containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ focusedContainerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else BrowseColors.SurfaceAccent,
+ contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary,
+ focusedContentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else BrowseColors.TextPrimary
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline)),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus))
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f)
) {
Text(label)
}
diff --git a/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/EnhancedMultiViewControlHud.kt b/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/EnhancedMultiViewControlHud.kt
index 9e397323..c4da60d3 100644
--- a/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/EnhancedMultiViewControlHud.kt
+++ b/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/EnhancedMultiViewControlHud.kt
@@ -1,32 +1,33 @@
package com.streamvault.feature.playback.multiview
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
-import androidx.tv.material3.Button
+import androidx.tv.material3.Border
import androidx.tv.material3.ButtonDefaults
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
+import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
-import com.streamvault.feature.playback.R
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.interaction.TvClickableSurface
+import com.streamvault.core.ui.design.BrowseColors
+import com.streamvault.core.ui.design.BrowseShapes
import com.streamvault.core.ui.interaction.TvButton
-import com.streamvault.core.ui.interaction.TvIconButton
+import com.streamvault.feature.playback.R
+import androidx.compose.ui.res.stringResource
@Composable
internal fun EnhancedMultiViewControlHud(
@@ -41,26 +42,34 @@ internal fun EnhancedMultiViewControlHud(
onSavePreset: (Int) -> Unit
) {
val telemetryTone = if (uiState.telemetry.standbySlots > 0 || uiState.telemetry.bufferingSlots > 0) {
- Color(0xFFFFD166)
+ BrowseColors.Warning
} else {
- Primary
+ BrowseColors.Success
}
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(12.dp),
modifier = Modifier
- .background(Color(0xFF0B1220).copy(alpha = 0.94f), RoundedCornerShape(24.dp))
- .border(1.dp, Color.White.copy(alpha = 0.08f), RoundedCornerShape(24.dp))
+ .background(
+ Brush.verticalGradient(
+ listOf(
+ BrowseColors.SurfaceEmphasis.copy(alpha = 0.98f),
+ BrowseColors.Surface.copy(alpha = 0.98f)
+ )
+ ),
+ BrowseShapes.Hero
+ )
+ .border(1.dp, BrowseColors.Outline, BrowseShapes.Hero)
.padding(horizontal = 22.dp, vertical = 18.dp)
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.spacedBy(6.dp)
+ verticalArrangement = Arrangement.spacedBy(5.dp)
) {
Text(
text = "Split Screen Controls",
- color = Color.White,
+ color = BrowseColors.TextPrimary,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Bold
)
@@ -70,7 +79,7 @@ internal fun EnhancedMultiViewControlHud(
uiState.performancePolicy.tier.name.lowercase().replaceFirstChar { it.uppercase() },
uiState.telemetry.activeSlotLimit
),
- color = Color.White.copy(alpha = 0.82f),
+ color = BrowseColors.TextSecondary,
style = MaterialTheme.typography.bodySmall
)
}
@@ -78,7 +87,7 @@ internal fun EnhancedMultiViewControlHud(
if (focused != null && focused.title.isNotBlank()) {
Text(
text = stringResource(R.string.multiview_focused_prefix, focused.title),
- color = Primary,
+ color = BrowseColors.BrandStrong,
style = MaterialTheme.typography.labelLarge,
fontWeight = FontWeight.Bold
)
@@ -89,10 +98,8 @@ internal fun EnhancedMultiViewControlHud(
verticalAlignment = Alignment.CenterVertically
) {
Surface(
- shape = RoundedCornerShape(999.dp),
- colors = androidx.tv.material3.SurfaceDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.08f)
- )
+ shape = BrowseShapes.Control,
+ colors = SurfaceDefaults.colors(containerColor = BrowseColors.SurfaceAccent)
) {
Text(
text = stringResource(
@@ -109,14 +116,14 @@ internal fun EnhancedMultiViewControlHud(
}
if (!uiState.telemetry.throttledReason.isNullOrBlank()) {
Surface(
- shape = RoundedCornerShape(999.dp),
- colors = androidx.tv.material3.SurfaceDefaults.colors(
- containerColor = Color(0xFFFFC107).copy(alpha = 0.16f)
+ shape = BrowseShapes.Control,
+ colors = SurfaceDefaults.colors(
+ containerColor = BrowseColors.Warning.copy(alpha = 0.14f)
)
) {
Text(
text = "Standby active",
- color = Color(0xFFFFD166),
+ color = BrowseColors.Warning,
style = MaterialTheme.typography.labelMedium,
modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp)
)
@@ -125,52 +132,27 @@ internal fun EnhancedMultiViewControlHud(
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- TvButton(
+ SplitControlButton(
onClick = onShowReplacementPicker,
modifier = Modifier.focusRequester(firstControlFocusRequester),
- colors = ButtonDefaults.colors(
- containerColor = Primary.copy(alpha = 0.94f),
- contentColor = Color.Black,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
+ primary = true
) {
Text(stringResource(R.string.multiview_replace_slot))
}
- TvButton(
+ SplitControlButton(
onClick = onRemoveFocusedSlot,
- enabled = focused != null && !focused.isEmpty,
- colors = ButtonDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.10f),
- contentColor = Color.White,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
+ enabled = focused != null && !focused.isEmpty
) {
Text(stringResource(R.string.multiview_remove_slot))
}
if (uiState.pinnedAudioSlotIndex == uiState.focusedSlotIndex) {
- TvButton(
- onClick = onClearPinnedAudio,
- colors = ButtonDefaults.colors(
- containerColor = Color(0xFF203A5C),
- contentColor = Color.White,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
- ) {
+ SplitControlButton(onClick = onClearPinnedAudio) {
Text(stringResource(R.string.multiview_audio_follow_focus))
}
} else {
- TvButton(
+ SplitControlButton(
onClick = onPinAudioToFocusedSlot,
- enabled = focused != null && !focused.isEmpty && focused.performanceBlockedReason == null,
- colors = ButtonDefaults.colors(
- containerColor = Color(0xFF203A5C),
- contentColor = Color.White,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
+ enabled = focused != null && !focused.isEmpty && focused.performanceBlockedReason == null
) {
Text(stringResource(R.string.multiview_pin_audio))
}
@@ -180,7 +162,7 @@ internal fun EnhancedMultiViewControlHud(
if (uiState.presets.isNotEmpty()) {
Text(
text = "Presets",
- color = Color.White.copy(alpha = 0.84f),
+ color = BrowseColors.TextSecondary,
style = MaterialTheme.typography.labelLarge
)
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
@@ -190,15 +172,7 @@ internal fun EnhancedMultiViewControlHud(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp)
) {
- TvButton(
- onClick = { onLoadPreset(preset.index) },
- colors = ButtonDefaults.colors(
- containerColor = Color.White.copy(alpha = 0.10f),
- contentColor = Color.White,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
- ) {
+ SplitControlButton(onClick = { onLoadPreset(preset.index) }) {
Text(
text = if (preset.isPopulated) {
"$presetLabel (${preset.channelCount})"
@@ -207,15 +181,7 @@ internal fun EnhancedMultiViewControlHud(
}
)
}
- TvButton(
- onClick = { onSavePreset(preset.index) },
- colors = ButtonDefaults.colors(
- containerColor = Color(0xFF172033),
- contentColor = Color.White,
- focusedContainerColor = Color.White,
- focusedContentColor = Color.Black
- )
- ) {
+ SplitControlButton(onClick = { onSavePreset(preset.index) }) {
Text(text = stringResource(R.string.multiview_preset_save, preset.index + 1))
}
}
@@ -226,10 +192,43 @@ internal fun EnhancedMultiViewControlHud(
if (!uiState.telemetry.throttledReason.isNullOrBlank()) {
Text(
text = uiState.telemetry.throttledReason.orEmpty(),
- color = Color(0xFFFFE7A3),
+ color = BrowseColors.Warning,
style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Center
)
}
}
}
+
+@Composable
+private fun SplitControlButton(
+ onClick: () -> Unit,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+ primary: Boolean = false,
+ content: @Composable RowScope.() -> Unit
+) {
+ val shape = BrowseShapes.Control
+ val containerColor = if (primary) BrowseColors.Brand else BrowseColors.SurfaceAccent
+ val contentColor = if (primary) BrowseColors.OnPrimary else BrowseColors.TextPrimary
+ TvButton(
+ onClick = onClick,
+ modifier = modifier,
+ enabled = enabled,
+ shape = ButtonDefaults.shape(shape),
+ colors = ButtonDefaults.colors(
+ containerColor = containerColor,
+ contentColor = contentColor,
+ focusedContainerColor = containerColor,
+ focusedContentColor = contentColor,
+ disabledContainerColor = BrowseColors.Surface.copy(alpha = 0.72f),
+ disabledContentColor = BrowseColors.TextDisabled
+ ),
+ border = ButtonDefaults.border(
+ border = Border(BorderStroke(1.dp, BrowseColors.Outline), shape = shape),
+ focusedBorder = Border(BorderStroke(2.dp, BrowseColors.Focus), shape = shape)
+ ),
+ scale = ButtonDefaults.scale(focusedScale = 1f),
+ content = content
+ )
+}
diff --git a/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/MultiViewPlannerDialog.kt b/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/MultiViewPlannerDialog.kt
index 36e306d5..e938e25d 100644
--- a/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/MultiViewPlannerDialog.kt
+++ b/feature/playback/src/main/java/com/streamvault/feature/playback/multiview/MultiViewPlannerDialog.kt
@@ -92,6 +92,7 @@ fun MultiViewPlannerDialog(
subtitle = subtitle,
onDismissRequest = onDismiss,
widthFraction = 0.58f,
+ bodyHeightFraction = 0.66f,
content = {
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
StatusPill(
@@ -110,6 +111,7 @@ fun MultiViewPlannerDialog(
} else {
listOf(listOf(0, 1), listOf(2, 3))
}
+ val slotAspectRatio = if (centeredTwoSlotLayout) 16f / 9f else 2.1f
plannerRows.forEachIndexed { rowIndex, rowSlots ->
Row(
modifier = Modifier.fillMaxWidth(),
@@ -121,6 +123,7 @@ fun MultiViewPlannerDialog(
slotIndex = slotIndex,
occupant = occupant,
isPickerMode = isPickerMode && !channelPlaced,
+ aspectRatio = slotAspectRatio,
modifier = Modifier
.weight(1f)
.then(
@@ -187,6 +190,7 @@ private fun MultiViewSlotCard(
slotIndex: Int,
occupant: Channel?,
isPickerMode: Boolean,
+ aspectRatio: Float,
modifier: Modifier = Modifier,
onSlotClick: () -> Unit,
onClearSlot: () -> Unit
@@ -201,18 +205,18 @@ private fun MultiViewSlotCard(
TvClickableSurface(
onClick = { if (isPickerMode) onSlotClick() else onClearSlot() },
- modifier = modifier.aspectRatio(16f / 9f),
+ modifier = modifier.aspectRatio(aspectRatio),
shape = ClickableSurfaceDefaults.shape(BrowseShapes.Panel),
colors = ClickableSurfaceDefaults.colors(
containerColor = AppColors.SurfaceElevated,
- focusedContainerColor = AppColors.SurfaceEmphasis,
+ focusedContainerColor = AppColors.SurfaceElevated,
pressedContainerColor = AppColors.SurfaceEmphasis
),
border = ClickableSurfaceDefaults.border(
border = Border(border = BorderStroke(1.dp, accent.copy(alpha = 0.35f))),
focusedBorder = Border(border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus))
),
- scale = ClickableSurfaceDefaults.scale(focusedScale = FocusSpec.FocusedScale)
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
) {
Box(
modifier = Modifier
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsAutomaticSync.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsAutomaticSync.kt
index 7de6b5a6..2cc69e46 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsAutomaticSync.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsAutomaticSync.kt
@@ -3,10 +3,7 @@ package com.streamvault.feature.settings.presentation
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.lazy.LazyColumn
-import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
@@ -17,7 +14,6 @@ import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
import com.streamvault.core.ui.theme.OnSurface
import com.streamvault.core.ui.theme.OnSurfaceDim
import com.streamvault.core.ui.theme.SurfaceElevated
@@ -48,9 +44,9 @@ internal fun AutomaticSyncSettingsCard(
val editable = provider == null || override != null
Surface(
- shape = RoundedCornerShape(12.dp),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),
- modifier = Modifier.fillMaxWidth(),
+ shape = SettingsDetailShapes.Panel,
+ colors = SurfaceDefaults.colors(containerColor = androidx.compose.ui.graphics.Color.Transparent),
+ modifier = Modifier.fillMaxWidth().settingsDetailPanel(),
) {
Column(
modifier = Modifier.fillMaxWidth().padding(16.dp),
@@ -328,8 +324,7 @@ internal fun AutomaticSyncSettingsCard(
}
dialog?.let { choice ->
- PremiumDialog(
- onDismissRequest = { dialog = null },
+ SettingsSingleChoiceDialog(
title = stringResource(
when (choice) {
"catalog" -> R.string.settings_auto_sync_catalog_interval
@@ -337,69 +332,70 @@ internal fun AutomaticSyncSettingsCard(
else -> R.string.settings_auto_sync_window
}
),
- content = {
- LazyColumn(Modifier.heightIn(max = 360.dp)) {
- if (choice == "window") {
- item {
- ClickableSettingsRow(
- stringResource(R.string.settings_auto_sync_any_time), "",
- {
- update(policy.copy(windowStartHour = 0, windowEndHour = 0))
- dialog = null
- },
- )
- ClickableSettingsRow(
- stringResource(R.string.settings_auto_sync_overnight), "",
- {
- update(policy.copy(windowStartHour = 2, windowEndHour = 6))
- dialog = null
- },
- )
- ClickableSettingsRow(
- stringResource(R.string.settings_auto_sync_start),
- stringResource(R.string.settings_auto_sync_hour, policy.windowStartHour),
- { dialog = "start" },
- )
- ClickableSettingsRow(
- stringResource(R.string.settings_auto_sync_end),
- stringResource(R.string.settings_auto_sync_hour, policy.windowEndHour),
- { dialog = "end" },
- )
- }
- } else if (choice == "start" || choice == "end") {
- items((0..23).toList()) { hour ->
- ClickableSettingsRow(
- stringResource(R.string.settings_auto_sync_hour, hour),
- "",
- {
- update(
- if (choice == "start") {
- policy.copy(windowStartHour = hour)
- } else {
- policy.copy(windowEndHour = hour)
- }
- )
- dialog = "window"
- },
+ onDismiss = { dialog = null },
+ widthFraction = 0.44f,
+ bodyHeightFraction = 0.62f,
+ ) {
+ when (choice) {
+ "window" -> {
+ SettingsChoiceOption(
+ label = stringResource(R.string.settings_auto_sync_any_time),
+ selected = policy.windowStartHour == policy.windowEndHour,
+ onSelect = {
+ update(policy.copy(windowStartHour = 0, windowEndHour = 0))
+ dialog = null
+ },
+ )
+ SettingsChoiceOption(
+ label = stringResource(R.string.settings_auto_sync_overnight),
+ selected = policy.windowStartHour == 2 && policy.windowEndHour == 6,
+ onSelect = {
+ update(policy.copy(windowStartHour = 2, windowEndHour = 6))
+ dialog = null
+ },
+ )
+ SettingsChoiceOption(
+ label = stringResource(R.string.settings_auto_sync_start),
+ description = stringResource(R.string.settings_auto_sync_hour, policy.windowStartHour),
+ selected = false,
+ onSelect = { dialog = "start" },
+ )
+ SettingsChoiceOption(
+ label = stringResource(R.string.settings_auto_sync_end),
+ description = stringResource(R.string.settings_auto_sync_hour, policy.windowEndHour),
+ selected = false,
+ onSelect = { dialog = "end" },
+ )
+ }
+ "start", "end" -> (0..23).forEach { hour ->
+ val isStart = choice == "start"
+ SettingsChoiceOption(
+ label = stringResource(R.string.settings_auto_sync_hour, hour),
+ selected = hour == if (isStart) policy.windowStartHour else policy.windowEndHour,
+ onSelect = {
+ update(
+ if (isStart) policy.copy(windowStartHour = hour)
+ else policy.copy(windowEndHour = hour)
)
- }
- } else {
- items(listOf(1, 3, 6, 12, 24, 48, 168)) { hours ->
- ClickableSettingsRow(
- pluralStringResource(R.plurals.settings_auto_sync_hours, hours, hours),
- "",
- {
- update(
- if (choice == "catalog") policy.copy(catalogHours = hours)
- else policy.copy(epgHours = hours)
- )
- dialog = null
- },
+ dialog = "window"
+ },
+ )
+ }
+ else -> listOf(1, 3, 6, 12, 24, 48, 168).forEach { hours ->
+ val selectedHours = if (choice == "catalog") policy.catalogHours else policy.epgHours
+ SettingsChoiceOption(
+ label = pluralStringResource(R.plurals.settings_auto_sync_hours, hours, hours),
+ selected = hours == selectedHours,
+ onSelect = {
+ update(
+ if (choice == "catalog") policy.copy(catalogHours = hours)
+ else policy.copy(epgHours = hours)
)
- }
- }
+ dialog = null
+ },
+ )
}
- },
- )
+ }
+ }
}
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt
index 1e8265de..4c989007 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt
@@ -357,7 +357,7 @@ private fun RemoteShortcutSettingsPanel(
Column(
modifier = Modifier
.fillMaxWidth()
- .background(com.streamvault.core.ui.theme.SurfaceElevated, RoundedCornerShape(18.dp))
+ .settingsDetailPanel()
.padding(horizontal = 14.dp, vertical = 14.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsCombinedM3uComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsCombinedM3uComponents.kt
index de2a96a5..8090aebb 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsCombinedM3uComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsCombinedM3uComponents.kt
@@ -70,9 +70,9 @@ public fun CombinedM3uProfilesCard(
targetFocusModifier: Modifier = Modifier,
) {
Surface(
- shape = RoundedCornerShape(12.dp),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),
- modifier = Modifier.fillMaxWidth()
+ shape = SettingsDetailShapes.Panel,
+ colors = SurfaceDefaults.colors(containerColor = androidx.compose.ui.graphics.Color.Transparent),
+ modifier = Modifier.fillMaxWidth().settingsDetailPanel()
) {
Column(
modifier = Modifier
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsDetailVisuals.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsDetailVisuals.kt
new file mode 100644
index 00000000..5ea36369
--- /dev/null
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsDetailVisuals.kt
@@ -0,0 +1,48 @@
+package com.streamvault.feature.settings.presentation
+
+import androidx.compose.foundation.border
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.draw.drawWithCache
+import androidx.compose.ui.geometry.Offset
+import androidx.compose.ui.geometry.Size
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.lerp
+import androidx.compose.ui.unit.dp
+import com.streamvault.core.ui.design.AppColors
+
+/** Detail-page surfaces are local to settings; player sheets and the settings rail are unchanged. */
+internal object SettingsDetailShapes {
+ val Panel = RoundedCornerShape(16.dp)
+ val Row = RoundedCornerShape(12.dp)
+ val Control = RoundedCornerShape(10.dp)
+ val Badge = RoundedCornerShape(999.dp)
+}
+
+internal fun Modifier.settingsDetailPanel(accented: Boolean = false): Modifier {
+ val palette = AppColors.current
+ return clip(SettingsDetailShapes.Panel)
+ .drawWithCache {
+ val fill = Brush.linearGradient(
+ colors = listOf(
+ lerp(palette.surfaceElevated, palette.brand, if (accented) 0.12f else 0.035f),
+ palette.surface,
+ ),
+ start = Offset.Zero,
+ end = Offset(size.width * 0.65f, size.height),
+ )
+ onDrawBehind {
+ drawRect(fill)
+ if (accented) {
+ drawRect(palette.brand, size = Size(3.dp.toPx(), size.height))
+ }
+ }
+ }
+ .border(
+ 1.dp,
+ if (accented) palette.brand.copy(alpha = 0.4f)
+ else palette.textPrimary.copy(alpha = if (palette.isLight) 0.12f else 0.09f),
+ SettingsDetailShapes.Panel,
+ )
+}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgAssignmentComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgAssignmentComponents.kt
index 0b490a56..437f2f2f 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgAssignmentComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgAssignmentComponents.kt
@@ -48,7 +48,7 @@ internal fun ProviderEpgAssignmentsCard(
androidx.compose.foundation.layout.Box(
modifier = modifier
.fillMaxWidth()
- .background(SurfaceElevated, RoundedCornerShape(12.dp))
+ .settingsDetailPanel()
) {
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(providerName, style = MaterialTheme.typography.titleSmall, color = OnSurface)
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSection.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSection.kt
index 87db4fee..1c513db2 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSection.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSection.kt
@@ -214,8 +214,7 @@ private fun ProviderGuideAndLogoPolicyCard(
modifier = modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
- .clip(RoundedCornerShape(18.dp))
- .background(SurfaceElevated)
+ .settingsDetailPanel()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
@@ -317,8 +316,7 @@ private fun EpgTimeShiftCard(
modifier = modifier
.fillMaxWidth()
.padding(vertical = 6.dp)
- .clip(RoundedCornerShape(12.dp))
- .background(SurfaceElevated)
+ .settingsDetailPanel()
.padding(16.dp)
) {
Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSourceComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSourceComponents.kt
index 8e8c6968..9fe58393 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSourceComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsEpgSourceComponents.kt
@@ -66,8 +66,7 @@ internal fun EpgSourceCard(
Box(
modifier = modifier
.fillMaxWidth()
- .clip(RoundedCornerShape(12.dp))
- .background(SurfaceElevated)
+ .settingsDetailPanel()
) {
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -289,8 +288,7 @@ internal fun AddEpgSourceCard(
Box(
modifier = Modifier
.fillMaxWidth()
- .clip(RoundedCornerShape(12.dp))
- .background(SurfaceElevated)
+ .settingsDetailPanel()
) {
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(stringResource(R.string.settings_epg_add_source), style = MaterialTheme.typography.titleSmall, color = OnSurface)
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsExternalPlaybackDialog.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsExternalPlaybackDialog.kt
index ebe0ee3c..b4c05a26 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsExternalPlaybackDialog.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsExternalPlaybackDialog.kt
@@ -1,22 +1,7 @@
package com.streamvault.feature.settings.presentation
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.Text
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
-import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.core.ui.theme.OnBackground
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
import com.streamvault.domain.model.ExternalPlaybackMode
import com.streamvault.feature.settings.R
@@ -24,53 +9,27 @@ import com.streamvault.feature.settings.R
public fun ExternalPlaybackModeDialog(
selectedMode: ExternalPlaybackMode,
onDismiss: () -> Unit,
- onModeSelected: (ExternalPlaybackMode) -> Unit
+ onModeSelected: (ExternalPlaybackMode) -> Unit,
) {
- val modes = listOf(ExternalPlaybackMode.INTERNAL_PLAYER, ExternalPlaybackMode.EXTERNAL_PLAYER)
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_external_playback),
subtitle = stringResource(R.string.settings_external_playback_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- modes.forEach { mode ->
- val isSelected = mode == selectedMode ||
- (mode == ExternalPlaybackMode.EXTERNAL_PLAYER && selectedMode == ExternalPlaybackMode.ASK_EVERY_TIME)
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(
- when (mode) {
- ExternalPlaybackMode.INTERNAL_PLAYER -> R.string.settings_external_playback_mode_internal
- ExternalPlaybackMode.EXTERNAL_PLAYER -> R.string.settings_external_playback_mode_external
- ExternalPlaybackMode.ASK_EVERY_TIME -> R.string.settings_external_playback_mode_external
- }
- ),
- style = androidx.compose.material3.MaterialTheme.typography.titleSmall,
- color = if (isSelected) Primary else OnBackground
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ listOf(ExternalPlaybackMode.INTERNAL_PLAYER, ExternalPlaybackMode.EXTERNAL_PLAYER).forEach { mode ->
+ val isSelected = mode == selectedMode ||
+ (mode == ExternalPlaybackMode.EXTERNAL_PLAYER && selectedMode == ExternalPlaybackMode.ASK_EVERY_TIME)
+ SettingsChoiceOption(
+ label = stringResource(
+ when (mode) {
+ ExternalPlaybackMode.INTERNAL_PLAYER -> R.string.settings_external_playback_mode_internal
+ ExternalPlaybackMode.EXTERNAL_PLAYER,
+ ExternalPlaybackMode.ASK_EVERY_TIME -> R.string.settings_external_playback_mode_external
+ },
+ ),
+ selected = isSelected,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsInternetSpeedTestCard.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsInternetSpeedTestCard.kt
index 8a478ec7..399479f4 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsInternetSpeedTestCard.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsInternetSpeedTestCard.kt
@@ -48,7 +48,7 @@ public fun InternetSpeedTestCard(
TvClickableSurface(
onClick = onRunTest,
enabled = !isRunning,
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),
+ shape = ClickableSurfaceDefaults.shape(SettingsDetailShapes.Panel),
colors = ClickableSurfaceDefaults.colors(
containerColor = SurfaceElevated,
focusedContainerColor = Primary.copy(alpha = 0.18f)
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsLiveTvComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsLiveTvComponents.kt
index bbdb4e6f..faf0d8e9 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsLiveTvComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsLiveTvComponents.kt
@@ -18,17 +18,13 @@ import androidx.tv.material3.ClickableSurfaceDefaults
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.streamvault.feature.settings.R
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
import com.streamvault.core.ui.interaction.TvClickableSurface
import com.streamvault.domain.model.LiveTvChannelMode
import com.streamvault.domain.model.LiveTvQuickFilterVisibilityMode
import com.streamvault.core.ui.theme.ErrorColor
import com.streamvault.core.ui.theme.OnBackground
-import com.streamvault.core.ui.theme.OnSurfaceDim
import com.streamvault.core.ui.theme.Primary
import com.streamvault.core.ui.theme.Secondary
-import com.streamvault.core.ui.theme.SurfaceElevated
@Composable
public fun ParentalControlCard(
@@ -43,7 +39,7 @@ public fun ParentalControlCard(
Column(
modifier = Modifier
.fillMaxWidth()
- .background(SurfaceElevated, RoundedCornerShape(8.dp))
+ .settingsDetailPanel()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
@@ -122,49 +118,20 @@ public fun LiveTvChannelModeDialog(
onDismiss: () -> Unit,
onModeSelected: (LiveTvChannelMode) -> Unit
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_live_tv_channel_mode),
subtitle = stringResource(R.string.settings_live_tv_channel_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- LiveTvChannelMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ LiveTvChannelMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
@@ -173,47 +140,18 @@ public fun LiveTvQuickFilterVisibilityDialog(
onDismiss: () -> Unit,
onModeSelected: (LiveTvQuickFilterVisibilityMode) -> Unit
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_live_tv_quick_filter_visibility),
subtitle = stringResource(R.string.settings_live_tv_quick_filter_visibility_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- LiveTvQuickFilterVisibilityMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ LiveTvQuickFilterVisibilityMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsModeDialogs.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsModeDialogs.kt
index de1b755f..debe4467 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsModeDialogs.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsModeDialogs.kt
@@ -1,393 +1,171 @@
package com.streamvault.feature.settings.presentation
-import com.streamvault.feature.settings.presentation.*
-
-import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.unit.dp
-import androidx.tv.material3.ClickableSurfaceDefaults
-import androidx.tv.material3.MaterialTheme
-import androidx.tv.material3.Text
-import com.streamvault.feature.settings.R
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
-import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.domain.model.VodViewMode
-import com.streamvault.core.ui.theme.OnBackground
-import com.streamvault.core.ui.theme.OnSurfaceDim
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
import com.streamvault.domain.model.ChannelNumberingMode
+import com.streamvault.domain.model.ExternalPlaybackMode
import com.streamvault.domain.model.GroupedChannelLabelMode
import com.streamvault.domain.model.LiveChannelGroupingMode
import com.streamvault.domain.model.LiveVariantPreferenceMode
-import com.streamvault.domain.model.RemoteColorButton
-import com.streamvault.domain.model.RemoteShortcutProfile
import com.streamvault.domain.model.RemoteShortcutSelection
import com.streamvault.domain.model.VodDuplicateHandlingMode
import com.streamvault.domain.model.VodVariantPreferenceMode
+import com.streamvault.domain.model.VodViewMode
+import com.streamvault.feature.settings.R
@Composable
public fun VodViewModeDialog(
selectedMode: VodViewMode,
onDismiss: () -> Unit,
- onModeSelected: (VodViewMode) -> Unit
+ onModeSelected: (VodViewMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_vod_view_mode),
subtitle = stringResource(R.string.settings_vod_view_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- VodViewMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ VodViewMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun LiveChannelNumberingModeDialog(
selectedMode: ChannelNumberingMode,
onDismiss: () -> Unit,
- onModeSelected: (ChannelNumberingMode) -> Unit
+ onModeSelected: (ChannelNumberingMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_live_channel_numbering_mode),
subtitle = stringResource(R.string.settings_live_channel_numbering_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- ChannelNumberingMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ ChannelNumberingMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun LiveChannelGroupingModeDialog(
selectedMode: LiveChannelGroupingMode,
onDismiss: () -> Unit,
- onModeSelected: (LiveChannelGroupingMode) -> Unit
+ onModeSelected: (LiveChannelGroupingMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_live_channel_grouping_mode),
subtitle = stringResource(R.string.settings_live_channel_grouping_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- LiveChannelGroupingMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ LiveChannelGroupingMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun GroupedChannelLabelModeDialog(
selectedMode: GroupedChannelLabelMode,
onDismiss: () -> Unit,
- onModeSelected: (GroupedChannelLabelMode) -> Unit
+ onModeSelected: (GroupedChannelLabelMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_grouped_channel_label_mode),
subtitle = stringResource(R.string.settings_grouped_channel_label_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- GroupedChannelLabelMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ GroupedChannelLabelMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun VodDuplicateHandlingModeDialog(
selectedMode: VodDuplicateHandlingMode,
onDismiss: () -> Unit,
- onModeSelected: (VodDuplicateHandlingMode) -> Unit
+ onModeSelected: (VodDuplicateHandlingMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_vod_duplicate_handling_mode),
subtitle = stringResource(R.string.settings_vod_duplicate_handling_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- VodDuplicateHandlingMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ VodDuplicateHandlingMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun VodVariantPreferenceModeDialog(
selectedMode: VodVariantPreferenceMode,
onDismiss: () -> Unit,
- onModeSelected: (VodVariantPreferenceMode) -> Unit
+ onModeSelected: (VodVariantPreferenceMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_vod_variant_preference_mode),
subtitle = stringResource(R.string.settings_vod_variant_preference_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- VodVariantPreferenceMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ VodVariantPreferenceMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
public fun LiveVariantPreferenceModeDialog(
selectedMode: LiveVariantPreferenceMode,
onDismiss: () -> Unit,
- onModeSelected: (LiveVariantPreferenceMode) -> Unit
+ onModeSelected: (LiveVariantPreferenceMode) -> Unit,
) {
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_live_variant_preference_mode),
subtitle = stringResource(R.string.settings_live_variant_preference_mode_subtitle),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- LiveVariantPreferenceMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == selectedMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = stringResource(mode.labelResId()),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == selectedMode) Primary else OnBackground
- )
- Text(
- text = stringResource(mode.descriptionResId()),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ LiveVariantPreferenceMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = stringResource(mode.labelResId()),
+ description = stringResource(mode.descriptionResId()),
+ selected = mode == selectedMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
@Composable
@@ -395,50 +173,26 @@ public fun RemoteShortcutSelectionDialog(
target: RemoteShortcutDialogTarget,
selectedSelection: RemoteShortcutSelection,
onDismiss: () -> Unit,
- onSelection: (RemoteShortcutSelection) -> Unit
+ onSelection: (RemoteShortcutSelection) -> Unit,
) {
- PremiumDialog(
+ val context = LocalContext.current
+ SettingsSingleChoiceDialog(
title = stringResource(R.string.settings_remote_dialog_title, stringResource(target.button.labelResId())),
subtitle = stringResource(R.string.settings_remote_dialog_subtitle, stringResource(target.profile.labelResId())),
- onDismissRequest = onDismiss,
+ onDismiss = onDismiss,
widthFraction = 0.56f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- remoteShortcutSelectionOptions(target.profile).forEach { selection ->
- val isSelected = selection == selectedSelection.normalizedForProfile(target.profile)
- TvClickableSurface(
- onClick = { onSelection(selection) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = formatRemoteShortcutSelectionLabel(
- selection = selection,
- profile = target.profile,
- button = target.button,
- context = androidx.compose.ui.platform.LocalContext.current
- ),
- style = MaterialTheme.typography.titleSmall,
- color = if (isSelected) Primary else OnBackground
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ ) {
+ remoteShortcutSelectionOptions(target.profile).forEach { selection ->
+ SettingsChoiceOption(
+ label = formatRemoteShortcutSelectionLabel(
+ selection = selection,
+ profile = target.profile,
+ button = target.button,
+ context = context,
+ ),
+ selected = selection == selectedSelection.normalizedForProfile(target.profile),
+ onSelect = { onSelection(selection) },
)
}
- )
+ }
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPageComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPageComponents.kt
index 6f5f316d..fd66ef0e 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPageComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPageComponents.kt
@@ -22,7 +22,7 @@ import com.streamvault.core.ui.design.AppColors
@Composable
internal fun SettingsPageCard(page: SettingsPage, modifier: Modifier = Modifier, onClick: () -> Unit) {
val colors = SettingsDesignTokens.colors(AppColors.current)
- SettingsActionSurface(onClick, modifier) {
+ SettingsActionSurface(onClick, modifier, overview = true) {
Row(Modifier.fillMaxWidth().heightIn(min = SettingsDesignTokens.explanatoryRowMinHeight)
.padding(horizontal = SettingsDesignTokens.space16, vertical = SettingsDesignTokens.space8),
horizontalArrangement = Arrangement.spacedBy(SettingsDesignTokens.space12),
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderCardSections.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderCardSections.kt
index e45572fd..a9de68a9 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderCardSections.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderCardSections.kt
@@ -44,8 +44,7 @@ public fun ProviderM3uOptionsPanel(
Column(
modifier = Modifier
.fillMaxWidth()
- .background(Surface, RoundedCornerShape(10.dp))
- .border(1.dp, SurfaceHighlight, RoundedCornerShape(10.dp))
+ .settingsDetailPanel()
.padding(12.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
@@ -235,17 +234,17 @@ private fun ProviderActionButton(
TvClickableSurface(
onClick = onClick,
modifier = modifier,
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(6.dp)),
+ shape = ClickableSurfaceDefaults.shape(SettingsDetailShapes.Control),
colors = ClickableSurfaceDefaults.colors(
- containerColor = if (filled) accent else accent.copy(alpha = 0.2f),
- focusedContainerColor = if (filled) accent.copy(alpha = 0.8f) else accent.copy(alpha = 0.5f),
+ containerColor = if (filled) accent else accent.copy(alpha = 0.12f),
+ focusedContainerColor = accent,
contentColor = contentColor,
- focusedContentColor = contentColor
+ focusedContentColor = com.streamvault.core.ui.design.contentOnColor(accent)
),
border = ClickableSurfaceDefaults.border(
focusedBorder = Border(
border = BorderStroke(FocusSpec.BorderWidth, com.streamvault.core.ui.theme.FocusBorder),
- shape = RoundedCornerShape(6.dp)
+ shape = SettingsDetailShapes.Control
)
),
scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
@@ -253,7 +252,6 @@ private fun ProviderActionButton(
Text(
text = label,
style = MaterialTheme.typography.labelMedium,
- color = contentColor,
modifier = Modifier
.widthIn(min = 0.dp)
.padding(horizontal = 16.dp, vertical = 10.dp)
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderComponents.kt
index 9e228089..1e6d7e65 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderComponents.kt
@@ -55,17 +55,9 @@ public fun ProviderSettingsCard(
Column(
modifier = Modifier
.fillMaxWidth()
- .background(
- color = if (isActive) SurfaceHighlight else SurfaceElevated,
- shape = RoundedCornerShape(8.dp)
- )
- .border(
- width = if (isActive) 2.dp else 0.dp,
- color = if (isActive) Primary else Color.Transparent,
- shape = RoundedCornerShape(8.dp)
- )
- .padding(16.dp),
- verticalArrangement = Arrangement.spacedBy(12.dp)
+ .settingsDetailPanel(accented = isActive)
+ .padding(20.dp),
+ verticalArrangement = Arrangement.spacedBy(16.dp)
) {
// Provider info
Row(
@@ -73,16 +65,17 @@ public fun ProviderSettingsCard(
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
- Column {
+ Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(
text = provider.name,
- style = MaterialTheme.typography.bodyLarge,
+ style = MaterialTheme.typography.titleLarge,
+ fontWeight = androidx.compose.ui.text.font.FontWeight.SemiBold,
color = OnBackground
)
Text(
- text = provider.type.name,
- style = MaterialTheme.typography.bodySmall,
- color = OnSurface
+ text = diagnostics?.sourceLabel ?: provider.type.name.replace('_', ' '),
+ style = MaterialTheme.typography.labelMedium,
+ color = OnSurfaceDim
)
}
ProviderStatusBadge(
@@ -93,14 +86,15 @@ public fun ProviderSettingsCard(
com.streamvault.domain.model.StalkerTransportMode.AUTO_STRICT
)
if (isActive) {
+ Spacer(Modifier.width(8.dp))
Text(
text = stringResource(R.string.settings_provider_in_use),
style = MaterialTheme.typography.labelSmall,
color = Primary,
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
modifier = Modifier
- .background(Primary.copy(alpha = 0.1f), RoundedCornerShape(4.dp))
- .padding(horizontal = 8.dp, vertical = 4.dp)
+ .background(Primary.copy(alpha = 0.1f), SettingsDetailShapes.Badge)
+ .padding(horizontal = 10.dp, vertical = 6.dp)
)
}
}
@@ -167,27 +161,31 @@ public fun ProviderSettingsCard(
style = MaterialTheme.typography.bodySmall,
color = OnSurface
)
- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ Row(Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
ProviderCompactStat(
title = stringResource(R.string.settings_diagnostic_live),
- value = model.liveCatalogCount(liveOnboardingIncomplete, xtreamLiveOnboardingPhase)
+ value = model.liveCatalogCount(liveOnboardingIncomplete, xtreamLiveOnboardingPhase),
+ modifier = Modifier.weight(1f)
)
ProviderCompactStat(
title = stringResource(R.string.settings_diagnostic_movies),
value = model.movieCatalogCount(xtreamIndexSectionStatuses["MOVIE"]),
- syncingLabel = stringResource(R.string.settings_catalog_count_indexing)
+ syncingLabel = stringResource(R.string.settings_catalog_count_indexing),
+ modifier = Modifier.weight(1f)
)
if (provider.type != ProviderType.M3U) {
ProviderCompactStat(
title = stringResource(R.string.settings_diagnostic_series),
value = model.seriesCatalogCount(xtreamIndexSectionStatuses["SERIES"]),
- syncingLabel = stringResource(R.string.settings_catalog_count_indexing)
+ syncingLabel = stringResource(R.string.settings_catalog_count_indexing),
+ modifier = Modifier.weight(1f)
)
}
ProviderCompactStat(
title = stringResource(R.string.settings_diagnostic_epg),
value = model.epgCatalogCount(xtreamIndexSectionStatuses["EPG"]),
- syncingLabel = stringResource(R.string.settings_catalog_count_indexing)
+ syncingLabel = stringResource(R.string.settings_catalog_count_indexing),
+ modifier = Modifier.weight(1f)
)
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderUiComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderUiComponents.kt
index ea04a124..61ef73c0 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderUiComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsProviderUiComponents.kt
@@ -4,9 +4,11 @@ import com.streamvault.feature.settings.presentation.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@@ -124,32 +126,40 @@ public fun ProviderCompactStat(
public fun ProviderCompactStat(
title: String,
value: ProviderCatalogCountUiModel,
- syncingLabel: String = stringResource(R.string.settings_catalog_count_syncing)
+ syncingLabel: String = stringResource(R.string.settings_catalog_count_syncing),
+ modifier: Modifier = Modifier,
) {
- Surface(
- shape = RoundedCornerShape(10.dp),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 10.dp, vertical = 8.dp),
- verticalArrangement = Arrangement.spacedBy(2.dp)
- ) {
- Text(
- text = title,
- style = MaterialTheme.typography.labelSmall,
- color = OnSurfaceDim
+ BoxWithConstraints(modifier) {
+ val compact = maxWidth < 100.dp
+ Surface(
+ modifier = Modifier.fillMaxWidth(),
+ shape = SettingsDetailShapes.Row,
+ colors = SurfaceDefaults.colors(
+ containerColor = com.streamvault.core.ui.design.AppColors.current.canvas.copy(alpha = 0.6f)
)
- Text(
- text = value.count.toString(),
- style = MaterialTheme.typography.labelMedium,
- color = OnBackground
- )
- providerCatalogStatusTagText(value, syncingLabel)?.let { tag ->
+ ) {
+ Column(
+ modifier = Modifier.padding(horizontal = if (compact) 8.dp else 14.dp, vertical = 12.dp),
+ verticalArrangement = Arrangement.spacedBy(6.dp)
+ ) {
Text(
- text = tag,
+ text = title,
style = MaterialTheme.typography.labelSmall,
- color = Secondary
+ color = OnSurfaceDim
)
+ Text(
+ text = value.count.toString(),
+ style = if (compact) MaterialTheme.typography.titleSmall else MaterialTheme.typography.titleLarge,
+ fontWeight = FontWeight.SemiBold,
+ color = OnBackground
+ )
+ providerCatalogStatusTagText(value, syncingLabel)?.let { tag ->
+ Text(
+ text = tag,
+ style = MaterialTheme.typography.labelSmall,
+ color = Secondary
+ )
+ }
}
}
}
@@ -197,7 +207,7 @@ public fun ProviderStatusBadge(
color = color,
fontWeight = FontWeight.Bold,
modifier = Modifier
- .background(color.copy(alpha = 0.16f), RoundedCornerShape(4.dp))
- .padding(horizontal = 8.dp, vertical = 4.dp)
+ .background(color.copy(alpha = 0.12f), SettingsDetailShapes.Badge)
+ .padding(horizontal = 10.dp, vertical = 6.dp)
)
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
index f53b2862..4914b33d 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingComponents.kt
@@ -22,8 +22,8 @@ public fun RecordingMetaPill(label: String, value: String) {
Column(
modifier = Modifier
.widthIn(min = 92.dp, max = 160.dp)
- .background(SurfaceElevated, RoundedCornerShape(10.dp))
- .padding(horizontal = 7.dp, vertical = 5.dp)
+ .settingsDetailPanel()
+ .padding(horizontal = 12.dp, vertical = 8.dp)
) {
Text(text = label, style = MaterialTheme.typography.labelSmall, color = OnSurfaceDim)
Text(text = value, style = MaterialTheme.typography.labelMedium, color = OnBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingDisplayComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingDisplayComponents.kt
index bb5a8d3d..4849d456 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingDisplayComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingDisplayComponents.kt
@@ -30,8 +30,8 @@ public fun RecordingMetricCard(
) {
Column(
modifier = modifier
- .background(com.streamvault.core.ui.theme.SurfaceElevated, RoundedCornerShape(12.dp))
- .padding(horizontal = 12.dp, vertical = 10.dp),
+ .settingsDetailPanel()
+ .padding(horizontal = 16.dp, vertical = 14.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
@@ -41,7 +41,7 @@ public fun RecordingMetricCard(
)
Text(
text = value,
- style = MaterialTheme.typography.titleSmall,
+ style = MaterialTheme.typography.titleMedium,
color = OnBackground,
maxLines = 1,
overflow = TextOverflow.Ellipsis
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
index 4d8d814e..719a966b 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRecordingItemComponents.kt
@@ -51,13 +51,13 @@ public fun RecordingItemCard(
onToggleSchedule: (Boolean) -> Unit
) {
Surface(
- modifier = Modifier.fillMaxWidth(),
- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),
- shape = RoundedCornerShape(12.dp)
+ modifier = Modifier.fillMaxWidth().settingsDetailPanel(),
+ colors = SurfaceDefaults.colors(containerColor = androidx.compose.ui.graphics.Color.Transparent),
+ shape = SettingsDetailShapes.Panel
) {
Column(
- modifier = Modifier.padding(horizontal = 10.dp, vertical = 8.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
+ modifier = Modifier.padding(16.dp),
+ verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Row(
modifier = Modifier.fillMaxWidth(),
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRowComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRowComponents.kt
index d70be3dc..48240f80 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRowComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsRowComponents.kt
@@ -5,12 +5,16 @@ import androidx.compose.ui.semantics.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
+import androidx.compose.foundation.layout.widthIn
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.rounded.Check
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
@@ -47,23 +51,31 @@ internal fun SettingsActionSurface(
onClick: () -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
+ overview: Boolean = false,
content: @Composable androidx.compose.foundation.layout.BoxScope.() -> Unit
) {
val colors = SettingsDesignTokens.colors(AppColors.current)
+ val shape = if (overview) RoundedCornerShape(SettingsDesignTokens.groupRadius) else SettingsDetailShapes.Row
TvClickableSurface(
onClick = onClick,
enabled = enabled,
modifier = modifier.fillMaxWidth(),
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(SettingsDesignTokens.groupRadius)),
+ shape = ClickableSurfaceDefaults.shape(shape),
colors = ClickableSurfaceDefaults.colors(
- containerColor = colors.groupSurface,
+ containerColor = if (overview) colors.groupSurface else AppColors.current.surfaceElevated,
focusedContainerColor = colors.focusedSurface,
disabledContainerColor = colors.groupSurface.copy(alpha = 0.58f)
),
border = ClickableSurfaceDefaults.border(
+ border = androidx.tv.material3.Border(
+ androidx.compose.foundation.BorderStroke(
+ if (overview) 0.dp else 1.dp,
+ if (overview) Color.Transparent else colors.primaryText.copy(alpha = 0.09f)
+ ), shape = shape,
+ ),
focusedBorder = androidx.tv.material3.Border(
androidx.compose.foundation.BorderStroke(SettingsDesignTokens.focusStroke, colors.focusOutline),
- shape = RoundedCornerShape(SettingsDesignTokens.groupRadius)
+ shape = shape
)
),
scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),
@@ -74,11 +86,11 @@ internal fun SettingsActionSurface(
@Composable
public fun SettingsRow(label: String, value: String, modifier: Modifier = Modifier) {
val colors = SettingsDesignTokens.colors(AppColors.current)
- Column(modifier.fillMaxWidth().heightIn(min = SettingsDesignTokens.simpleRowMinHeight)
- .padding(horizontal = SettingsDesignTokens.space16, vertical = SettingsDesignTokens.space8),
+ Column(modifier.fillMaxWidth().settingsDetailPanel().heightIn(min = SettingsDesignTokens.simpleRowMinHeight)
+ .padding(horizontal = SettingsDesignTokens.space16, vertical = SettingsDesignTokens.space12),
verticalArrangement = Arrangement.spacedBy(4.dp)) {
- Text(label, style = MaterialTheme.typography.bodyMedium, color = colors.secondaryText)
- Text(value, style = MaterialTheme.typography.bodyMedium, color = colors.primaryText)
+ Text(label, style = MaterialTheme.typography.labelMedium, color = colors.secondaryText)
+ Text(value, style = MaterialTheme.typography.titleSmall, color = colors.primaryText)
}
}
@@ -93,21 +105,42 @@ public fun ClickableSettingsRow(
) {
val colors = SettingsDesignTokens.colors(AppColors.current)
SettingsActionSurface(onClick = onClick, enabled = enabled, modifier = modifier) {
- Row(Modifier.fillMaxWidth().heightIn(min = SettingsDesignTokens.explanatoryRowMinHeight)
- .padding(start = SettingsDesignTokens.space16 + indent, end = SettingsDesignTokens.space16,
- top = SettingsDesignTokens.space8, bottom = SettingsDesignTokens.space8),
- horizontalArrangement = Arrangement.spacedBy(SettingsDesignTokens.space16), verticalAlignment = Alignment.CenterVertically) {
- Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
- Text(label, style = MaterialTheme.typography.bodyMedium,
- fontWeight = FontWeight.Medium,
- color = if (enabled) colors.primaryText else colors.disabledText)
- if (value.isNotBlank()) Text(value, style = MaterialTheme.typography.bodySmall,
- color = if (enabled) colors.secondaryText else colors.disabledText)
+ BoxWithConstraints(Modifier.fillMaxWidth()) {
+ val compactValue = value.isNotBlank() && value.length <= 28 &&
+ !value.contains('\n') && maxWidth >= 520.dp
+ val valueMaxWidth = maxWidth * 0.4f
+ Row(
+ Modifier.fillMaxWidth().heightIn(min = SettingsDesignTokens.explanatoryRowMinHeight)
+ .padding(
+ start = SettingsDesignTokens.space16 + indent,
+ end = SettingsDesignTokens.space16,
+ top = SettingsDesignTokens.space8,
+ bottom = SettingsDesignTokens.space8,
+ ),
+ horizontalArrangement = Arrangement.spacedBy(SettingsDesignTokens.space16),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
+ Text(label, style = MaterialTheme.typography.titleSmall,
+ fontWeight = FontWeight.Medium,
+ color = if (enabled) colors.primaryText else colors.disabledText)
+ if (value.isNotBlank() && !compactValue) {
+ Text(value, style = MaterialTheme.typography.bodySmall,
+ color = if (enabled) colors.secondaryText else colors.disabledText)
+ }
+ }
+ if (compactValue) {
+ Text(value, style = MaterialTheme.typography.labelLarge,
+ color = if (enabled) colors.accent else colors.disabledText,
+ modifier = Modifier.widthIn(max = valueMaxWidth)
+ .background(colors.accent.copy(alpha = 0.10f), SettingsDetailShapes.Control)
+ .padding(horizontal = 12.dp, vertical = 8.dp))
+ }
+ androidx.tv.material3.Icon(Icons.AutoMirrored.Rounded.KeyboardArrowRight,
+ contentDescription = null,
+ tint = if (enabled) colors.secondaryText else colors.disabledText,
+ modifier = Modifier.size(20.dp))
}
- androidx.tv.material3.Icon(androidx.compose.material.icons.Icons.AutoMirrored.Rounded.KeyboardArrowRight,
- contentDescription = null,
- tint = if (enabled) colors.secondaryText else colors.disabledText,
- modifier = Modifier.size(20.dp))
}
}
}
@@ -136,18 +169,22 @@ public fun SwitchSettingsRow(
top = SettingsDesignTokens.space8, bottom = SettingsDesignTokens.space8),
horizontalArrangement = Arrangement.spacedBy(SettingsDesignTokens.space16), verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(4.dp)) {
- Text(label, style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium,
+ Text(label, style = MaterialTheme.typography.titleSmall, fontWeight = FontWeight.Medium,
color = if (enabled) colors.primaryText else colors.disabledText)
if (value.isNotBlank()) Text(value, style = MaterialTheme.typography.bodySmall,
color = if (enabled) colors.secondaryText else colors.disabledText)
}
Switch(checked = checked, onCheckedChange = null, enabled = enabled,
+ thumbContent = if (checked) ({
+ androidx.tv.material3.Icon(Icons.Rounded.Check, contentDescription = null,
+ tint = colors.accent, modifier = Modifier.size(14.dp))
+ }) else null,
colors = androidx.compose.material3.SwitchDefaults.colors(
checkedTrackColor = colors.accent,
- checkedThumbColor = colors.canvas,
- uncheckedTrackColor = colors.groupSurface,
+ checkedThumbColor = com.streamvault.core.ui.design.contentOnColor(colors.accent),
+ uncheckedTrackColor = colors.canvas,
uncheckedThumbColor = colors.secondaryText,
- uncheckedBorderColor = colors.secondaryText
+ uncheckedBorderColor = colors.secondaryText.copy(alpha = 0.55f)
))
}
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogComponents.kt
index a2a91502..74e30a60 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogComponents.kt
@@ -1,159 +1,186 @@
package com.streamvault.feature.settings.presentation
-import androidx.compose.foundation.border
-import androidx.compose.foundation.clickable
+import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.layout.Arrangement
-import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
-import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
-import androidx.compose.foundation.verticalScroll
-import androidx.compose.material3.HorizontalDivider
-import androidx.compose.material3.RadioButton
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.rounded.Check
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
-import androidx.compose.ui.Alignment.Companion.Center
import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.input.key.onPreviewKeyEvent
-import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.graphics.lerp
+import androidx.compose.ui.semantics.Role
+import androidx.compose.ui.semantics.role
+import androidx.compose.ui.semantics.selected
+import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
-import androidx.compose.ui.window.Dialog
+import androidx.tv.material3.Border
import androidx.tv.material3.ClickableSurfaceDefaults
+import androidx.tv.material3.Icon
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.streamvault.feature.settings.R
-import com.streamvault.core.ui.components.dialogs.rememberDialogOpenGestureBlocker
+import com.streamvault.core.ui.components.dialogs.PremiumDialog
+import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
+import com.streamvault.core.ui.design.AppColors
import com.streamvault.core.ui.interaction.TvClickableSurface
-import com.streamvault.core.ui.theme.OnBackground
-import com.streamvault.core.ui.theme.OnSurfaceDim
-import com.streamvault.core.ui.theme.Primary
-import com.streamvault.core.ui.theme.SurfaceElevated
+/** A compact, shared shell for settings dialogs that choose one value from a list. */
@Composable
-fun PremiumSelectionDialog(
+internal fun SettingsSingleChoiceDialog(
title: String,
+ subtitle: String? = null,
onDismiss: () -> Unit,
- content: @Composable ColumnScope.() -> Unit
+ widthFraction: Float = 0.52f,
+ bodyHeightFraction: Float = 0.62f,
+ content: @Composable ColumnScope.() -> Unit,
) {
- val isTelevisionDevice = com.streamvault.core.ui.device.rememberIsTelevisionDevice()
- var canInteract by remember { mutableStateOf(false) }
- val blockOpenGesture = rememberDialogOpenGestureBlocker(canInteract)
- LaunchedEffect(Unit) {
- kotlinx.coroutines.delay(500)
- canInteract = true
- }
- Dialog(onDismissRequest = { if (canInteract) onDismiss() }) {
- val dialogContent: @Composable (Modifier) -> Unit = { resolvedModifier ->
- androidx.compose.material3.Surface(
- shape = RoundedCornerShape(14.dp),
- color = SurfaceElevated,
- modifier = resolvedModifier
- .border(1.dp, Primary.copy(alpha = 0.4f), RoundedCornerShape(14.dp))
- .onPreviewKeyEvent(blockOpenGesture)
+ PremiumDialog(
+ title = title,
+ subtitle = subtitle,
+ onDismissRequest = onDismiss,
+ widthFraction = widthFraction,
+ heightFraction = null,
+ bodyHeightFraction = bodyHeightFraction,
+ content = {
+ Column(
+ modifier = Modifier.fillMaxWidth(),
+ verticalArrangement = Arrangement.spacedBy(8.dp),
+ content = content,
+ )
+ },
+ footer = {
+ PremiumDialogFooterButton(
+ label = androidx.compose.ui.res.stringResource(R.string.settings_cancel),
+ onClick = onDismiss,
+ )
+ },
+ )
+}
+
+/** Focus is shown with a steady outline; selection is shown with a quiet theme tint and check. */
+@Composable
+internal fun SettingsChoiceOption(
+ label: String,
+ selected: Boolean,
+ onSelect: () -> Unit,
+ description: String? = null,
+ modifier: Modifier = Modifier,
+ enabled: Boolean = true,
+) {
+ val palette = AppColors.current
+ val shape = RoundedCornerShape(14.dp)
+ val container = if (selected) lerp(palette.surfaceElevated, palette.brand, 0.14f)
+ else palette.surfaceElevated
+
+ TvClickableSurface(
+ onClick = onSelect,
+ enabled = enabled,
+ modifier = modifier
+ .fillMaxWidth()
+ .semantics {
+ role = Role.RadioButton
+ this.selected = selected
+ },
+ shape = ClickableSurfaceDefaults.shape(shape),
+ colors = ClickableSurfaceDefaults.colors(
+ containerColor = container,
+ focusedContainerColor = container,
+ contentColor = palette.textPrimary,
+ focusedContentColor = palette.textPrimary,
+ disabledContainerColor = palette.surface.copy(alpha = 0.7f),
+ disabledContentColor = palette.textDisabled,
+ ),
+ border = ClickableSurfaceDefaults.border(
+ border = Border(
+ border = BorderStroke(1.dp, palette.outline.copy(alpha = 0.72f)),
+ shape = shape,
+ ),
+ focusedBorder = Border(
+ border = BorderStroke(2.dp, palette.focus),
+ shape = shape,
+ ),
+ ),
+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),
+ ) {
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .heightIn(min = if (description.isNullOrBlank()) 56.dp else 68.dp)
+ .padding(horizontal = 16.dp, vertical = 10.dp),
+ horizontalArrangement = Arrangement.spacedBy(14.dp),
+ verticalAlignment = Alignment.CenterVertically,
+ ) {
+ Column(
+ modifier = Modifier.weight(1f),
+ verticalArrangement = Arrangement.spacedBy(3.dp),
) {
- Column(
- modifier = Modifier.padding(18.dp),
- verticalArrangement = Arrangement.spacedBy(8.dp)
- ) {
+ Text(
+ text = label,
+ style = if (description.isNullOrBlank()) {
+ MaterialTheme.typography.bodyLarge
+ } else {
+ MaterialTheme.typography.titleSmall
+ },
+ color = if (enabled) palette.textPrimary else palette.textDisabled,
+ )
+ if (!description.isNullOrBlank()) {
Text(
- text = title,
- style = MaterialTheme.typography.titleMedium,
- color = Primary
+ text = description,
+ style = MaterialTheme.typography.bodySmall,
+ color = if (enabled) palette.textSecondary else palette.textDisabled,
)
- HorizontalDivider(color = com.streamvault.core.ui.design.AppColors.Divider)
- Column(
- verticalArrangement = Arrangement.spacedBy(6.dp),
- modifier = Modifier
- .padding(top = 6.dp)
- .weight(1f, fill = false)
- .verticalScroll(rememberScrollState())
- ) {
- content()
- }
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .padding(top = 8.dp),
- horizontalArrangement = Arrangement.End
- ) {
- TvClickableSurface(
- onClick = { if (canInteract) onDismiss() },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(6.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = Primary.copy(alpha = 0.2f),
- focusedContainerColor = Primary.copy(alpha = 0.4f)
- )
- ) {
- Text(
- text = stringResource(R.string.settings_cancel),
- style = MaterialTheme.typography.labelMedium,
- color = Primary,
- modifier = Modifier.padding(horizontal = 14.dp, vertical = 9.dp)
- )
- }
- }
}
}
- }
-
- if (isTelevisionDevice) {
- dialogContent(Modifier.fillMaxWidth(0.62f))
- } else {
- BoxWithConstraints(
- modifier = Modifier.fillMaxWidth(),
- contentAlignment = Center
- ) {
- val dialogWidthFraction = when {
- maxWidth < 700.dp -> 0.92f
- maxWidth < 1000.dp -> 0.78f
- else -> 0.62f
- }
- dialogContent(Modifier.fillMaxWidth(dialogWidthFraction))
+ if (selected) {
+ Icon(
+ imageVector = Icons.Rounded.Check,
+ contentDescription = null,
+ tint = palette.brand,
+ modifier = Modifier.size(22.dp),
+ )
+ } else {
+ Spacer(Modifier.size(22.dp))
}
}
}
}
+@Composable
+fun PremiumSelectionDialog(
+ title: String,
+ onDismiss: () -> Unit,
+ content: @Composable ColumnScope.() -> Unit,
+) {
+ SettingsSingleChoiceDialog(
+ title = title,
+ onDismiss = onDismiss,
+ widthFraction = 0.62f,
+ bodyHeightFraction = 0.66f,
+ content = content,
+ )
+}
+
@Composable
fun LevelOption(
level: Int,
text: String,
currentLevel: Int,
subtitle: String? = null,
- onSelect: () -> Unit
+ onSelect: () -> Unit,
) {
- Row(
- modifier = Modifier
- .fillMaxWidth()
- .clickable(onClick = onSelect)
- .padding(vertical = 12.dp),
- verticalAlignment = Alignment.CenterVertically
- ) {
- RadioButton(
- selected = level == currentLevel,
- onClick = onSelect
- )
- Spacer(modifier = Modifier.width(8.dp))
- if (subtitle != null) {
- Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
- Text(text, style = MaterialTheme.typography.titleSmall, color = OnBackground)
- Text(subtitle, style = MaterialTheme.typography.bodySmall, color = OnSurfaceDim)
- }
- } else {
- Text(text, style = MaterialTheme.typography.bodyMedium, color = OnBackground)
- }
- }
+ SettingsChoiceOption(
+ label = text,
+ description = subtitle,
+ selected = level == currentLevel,
+ onSelect = onSelect,
+ )
}
-
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogs.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogs.kt
index 93bdc0f8..27d6f166 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogs.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSelectionDialogs.kt
@@ -62,47 +62,18 @@ public fun CategorySortModeDialog(
onModeSelected: (CategorySortMode) -> Unit
) {
val context = LocalContext.current
- PremiumDialog(
+ SettingsSingleChoiceDialog(
title = categoryTypeLabel(type, context),
subtitle = categoryTypeDescription(type, context),
- onDismissRequest = onDismiss,
- widthFraction = 0.52f,
- content = {
- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {
- CategorySortMode.entries.forEach { mode ->
- TvClickableSurface(
- onClick = { onModeSelected(mode) },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = if (mode == currentMode) Primary.copy(alpha = 0.18f) else SurfaceElevated,
- focusedContainerColor = Primary.copy(alpha = 0.28f)
- ),
- modifier = Modifier.fillMaxWidth()
- ) {
- Column(
- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
- ) {
- Text(
- text = formatCategorySortModeLabel(mode, context),
- style = MaterialTheme.typography.titleSmall,
- color = if (mode == currentMode) Primary else OnBackground
- )
- Text(
- text = sortModeLabel(mode, context),
- style = MaterialTheme.typography.bodySmall,
- color = OnSurfaceDim
- )
- }
- }
- }
- }
- },
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.settings_cancel),
- onClick = onDismiss
+ onDismiss = onDismiss,
+ ) {
+ CategorySortMode.entries.forEach { mode ->
+ SettingsChoiceOption(
+ label = formatCategorySortModeLabel(mode, context),
+ description = sortModeLabel(mode, context),
+ selected = mode == currentMode,
+ onSelect = { onModeSelected(mode) },
)
}
- )
+ }
}
diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSharedUiComponents.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSharedUiComponents.kt
index 3a03c1bf..f014d1f9 100644
--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSharedUiComponents.kt
+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsSharedUiComponents.kt
@@ -66,18 +66,18 @@ fun SettingsOverviewStat(
) {
Column(
modifier = modifier
- .background(SurfaceHighlight.copy(alpha = 0.28f), RoundedCornerShape(12.dp))
- .padding(horizontal = 14.dp, vertical = 12.dp),
- verticalArrangement = Arrangement.spacedBy(4.dp)
+ .settingsDetailPanel()
+ .padding(horizontal = 16.dp, vertical = 14.dp),
+ verticalArrangement = Arrangement.spacedBy(6.dp)
) {
Text(
- text = label.uppercase(Locale.getDefault()),
+ text = label,
style = MaterialTheme.typography.labelSmall,
color = OnSurfaceDim
)
Text(
text = value,
- style = MaterialTheme.typography.titleSmall,
+ style = MaterialTheme.typography.titleMedium,
color = OnBackground,
fontWeight = FontWeight.SemiBold
)
@@ -96,7 +96,7 @@ fun CompactSettingsActionChip(
onClick = onClick,
enabled = enabled,
modifier = modifier,
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
+ shape = ClickableSurfaceDefaults.shape(SettingsDetailShapes.Control),
colors = ClickableSurfaceDefaults.colors(
containerColor = accent.copy(alpha = if (enabled) 0.14f else 0.08f),
contentColor = accent.copy(alpha = if (enabled) 1f else 0.42f),
@@ -108,11 +108,11 @@ fun CompactSettingsActionChip(
border = ClickableSurfaceDefaults.border(
border = Border(
border = BorderStroke(1.dp, com.streamvault.core.ui.design.AppColors.Divider),
- shape = RoundedCornerShape(8.dp)
+ shape = SettingsDetailShapes.Control
),
focusedBorder = Border(
border = BorderStroke(FocusSpec.BorderWidth, com.streamvault.core.ui.theme.FocusBorder),
- shape = RoundedCornerShape(8.dp)
+ shape = SettingsDetailShapes.Control
)
),
scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)
@@ -120,8 +120,8 @@ fun CompactSettingsActionChip(
Text(
text = label,
color = accent.copy(alpha = if (enabled) 1f else 0.42f),
- style = MaterialTheme.typography.labelSmall,
- modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp)
+ style = MaterialTheme.typography.labelMedium,
+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)
)
}
}
@@ -232,7 +232,7 @@ fun EpgSourceTextField(
pendingInputActivation = true
requestBringIntoView()
},
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
+ shape = ClickableSurfaceDefaults.shape(SettingsDetailShapes.Control),
colors = ClickableSurfaceDefaults.colors(
containerColor = settingsColors.searchSurface,
focusedContainerColor = settingsColors.searchFocusedSurface,
@@ -240,11 +240,11 @@ fun EpgSourceTextField(
border = ClickableSurfaceDefaults.border(
border = Border(
BorderStroke(1.dp, settingsColors.divider),
- shape = RoundedCornerShape(8.dp),
+ shape = SettingsDetailShapes.Control,
),
focusedBorder = Border(
BorderStroke(SettingsDesignTokens.focusStroke, settingsColors.focusOutline),
- shape = RoundedCornerShape(8.dp),
+ shape = SettingsDetailShapes.Control,
),
),
scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),