StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Polish TV overlays and VOD navigation
Davidonac810eb473891
diff --git a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt b/app/src/main/java/com/streamvault/app/ui/components/Cards.ktindex 49e4b9fc..4f5a4780 100644--- a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt@@ -93,7 +93,7 @@ fun FocusableCard(scaleX = scalescaleY = scaleshape = RoundedCornerShape(12.dp)- clip = false+ clip = true}.onFocusChanged { isFocused = it.isFocused },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.ktindex d14a0cf4..73bf2e02 100644--- a/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt@@ -318,8 +318,10 @@ private fun PosterCard(AsyncImage(model = imageUrl,contentDescription = title,- modifier = Modifier.fillMaxSize(),- contentScale = ContentScale.Crop+ modifier = Modifier+ .fillMaxSize()+ .clip(RoundedCornerShape(12.dp)),+ contentScale = ContentScale.Fit)} else {Box(diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.ktindex 122f81c6..374453b3 100644--- a/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt@@ -40,7 +40,11 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusProperties+import androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.zIndeximport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.graphics.graphicsLayer@@ -220,6 +224,7 @@ fun AppScreenHeader(}}+@OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class)@Composableprivate fun TopNavigationBar(currentRoute: String,@@ -229,8 +234,15 @@ private fun TopNavigationBar(val items = buildDestinationItems()val scrollState = rememberScrollState()+ val focusRequesters = remember { mutableMapOf<String, FocusRequester>() }+Surface(- modifier = modifier,+ modifier = modifier.focusProperties {+ enter = {+ val activeItem = items.firstOrNull { it.route == currentRoute }+ focusRequesters[activeItem?.route] ?: FocusRequester.Default+ }+ },shape = RoundedCornerShape(18.dp),colors = SurfaceDefaults.colors(containerColor = AppColors.Surface.copy(alpha = 0.9f))) {@@ -246,22 +258,23 @@ private fun TopNavigationBar(text = stringResource(R.string.app_name),style = MaterialTheme.typography.titleSmall,color = AppColors.TextPrimary,- modifier = Modifier- .width(190.dp)- .wrapContentWidth(Alignment.Start)+ modifier = Modifier.wrapContentWidth(Alignment.Start))- Spacer(modifier = Modifier.width(8.dp))+ Spacer(modifier = Modifier.width(32.dp)) // Increased spacing to prevent overlapRow(modifier = Modifier.weight(1f)- .horizontalScroll(scrollState),+ .horizontalScroll(scrollState)+ .padding(horizontal = 12.dp),horizontalArrangement = Arrangement.spacedBy(6.dp)) {items.forEach { item ->+ val requester = focusRequesters.getOrPut(item.route) { FocusRequester() }TopNavigationButton(label = stringResource(item.labelRes),icon = item.icon,selected = currentRoute == item.route,+ modifier = Modifier.focusRequester(requester),onClick = {if (currentRoute != item.route) {onNavigate(item.route)@@ -279,6 +292,7 @@ private fun TopNavigationButton(label: String,icon: ImageVector,selected: Boolean,+ modifier: Modifier = Modifier,onClick: () -> Unit) {var isFocused by remember { mutableStateOf(false) }@@ -290,7 +304,8 @@ private fun TopNavigationButton(Surface(onClick = onClick,- modifier = Modifier+ modifier = modifier+ .zIndex(if (isFocused) 1f else 0f) // Keep focused button on top.graphicsLayer {scaleX = scalescaleY = scalediff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.ktnew file mode 100644index 00000000..2db0ce25--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/VodChrome.kt@@ -0,0 +1,319 @@+package com.streamvault.app.ui.components.shell++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+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.RoundedCornerShape+import androidx.compose.runtime.Composable+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.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.compose.ui.res.stringResource+import androidx.tv.material3.Border+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.theme.FocusBorder+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevated+import com.streamvault.app.ui.theme.SurfaceHighlight+import com.streamvault.app.ui.theme.TextPrimary+import androidx.compose.foundation.BorderStroke+import com.streamvault.app.R+import com.streamvault.app.ui.components.SearchInput+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButton++@Composable+fun VodSectionHeader(+ title: String,+ onSeeAll: (() -> Unit)? = null,+ seeAllLabel: String = "See all"+) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 8.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium,+ color = TextPrimary+ )+ if (onSeeAll != null) {+ Surface(+ onClick = onSeeAll,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary.copy(alpha = 0.12f),+ focusedContainerColor = Primary.copy(alpha = 0.22f),+ contentColor = AppColors.TextSecondary+ )+ ) {+ Text(+ text = seeAllLabel,+ style = MaterialTheme.typography.labelSmall,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)+ )+ }+ }+ }+}++@Composable+fun VodActionChipRow(+ actions: List<VodActionChip>,+ selectedKey: String? = null,+ modifier: Modifier = Modifier+) {+ LazyRow(+ modifier = modifier.fillMaxWidth(),+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ items(actions, key = { it.key }) { action ->+ val isSelected = selectedKey == action.key+ Surface(+ onClick = action.onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,+ focusedContainerColor = if (isSelected) Primary.copy(alpha = 0.28f) else SurfaceHighlight+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(2.dp, FocusBorder),+ shape = RoundedCornerShape(999.dp)+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Text(+ text = action.label,+ style = MaterialTheme.typography.labelLarge,+ color = if (isSelected) Primary else TextPrimary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ action.detail?.takeIf { it.isNotBlank() }?.let {+ Text(+ text = it,+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+ }+ }+}++@Composable+fun VodHeroStrip(+ title: String,+ subtitle: String,+ actionLabel: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier+) {+ Surface(+ onClick = onClick,+ modifier = modifier+ .fillMaxWidth()+ .padding(horizontal = 20.dp)+ .height(132.dp),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(22.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceHighlight,+ focusedContainerColor = Primary.copy(alpha = 0.22f)+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(2.dp, FocusBorder),+ shape = RoundedCornerShape(22.dp)+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 20.dp, vertical = 18.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.headlineSmall,+ color = TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ }+ Surface(+ shape = RoundedCornerShape(999.dp),+ colors = SurfaceDefaults.colors(containerColor = Primary)+ ) {+ Text(+ text = actionLabel,+ style = MaterialTheme.typography.labelLarge,+ color = Color.Black,+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)+ )+ }+ }+ }+}++data class VodActionChip(+ val key: String,+ val label: String,+ val detail: String? = null,+ val onClick: () -> Unit+)++data class VodCategoryOption(+ val name: String,+ val count: Int,+ val onClick: () -> Unit+)++@Composable+fun VodCategoryPickerDialog(+ title: String,+ subtitle: String,+ categories: List<VodCategoryOption>,+ onDismiss: () -> Unit+) {+ var query by remember { mutableStateOf("") }+ val searchFocusRequester = remember { FocusRequester() }+ val filteredCategories = remember(categories, query) {+ val normalized = query.trim()+ if (normalized.isBlank()) categories+ else categories.filter { it.name.contains(normalized, ignoreCase = true) }+ }++ PremiumDialog(+ title = title,+ subtitle = subtitle,+ onDismissRequest = onDismiss,+ widthFraction = 0.52f,+ content = {+ SearchInput(+ value = query,+ onValueChange = { query = it },+ placeholder = stringResource(R.string.vod_category_picker_search_placeholder),+ focusRequester = searchFocusRequester,+ modifier = Modifier.fillMaxWidth()+ )++ if (filteredCategories.isEmpty()) {+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .padding(vertical = 20.dp),+ contentAlignment = Alignment.Center+ ) {+ Text(+ text = stringResource(R.string.vod_category_picker_empty),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ } else {+ LazyColumn(+ modifier = Modifier.height(420.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ items(filteredCategories, key = { it.name }) { category ->+ Surface(+ onClick = {+ category.onClick()+ onDismiss()+ },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = SurfaceHighlight+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(2.dp, FocusBorder),+ shape = RoundedCornerShape(14.dp)+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 16.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = category.name,+ style = MaterialTheme.typography.bodyLarge,+ color = TextPrimary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.weight(1f)+ )+ Text(+ text = category.count.toString(),+ style = MaterialTheme.typography.labelMedium,+ color = OnSurfaceDim+ )+ }+ }+ }+ }+ }+ },+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.category_options_cancel),+ onClick = onDismiss+ )+ }+ )+}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.ktindex 56f4f0ea..4d482b65 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt@@ -237,7 +237,9 @@ class HomeViewModel @Inject constructor(val providerId = _uiState.value.provider?.idif (providerId != null) {viewModelScope.launch {- preferencesRepository.setLastLiveCategoryId(providerId, category.id)+ if (!preferencesRepository.isIncognitoMode.first()) {+ preferencesRepository.setLastLiveCategoryId(providerId, category.id)+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.ktindex 73e4fdf1..5116b2f0 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt@@ -3,6 +3,7 @@ package com.streamvault.app.ui.screens.moviesimport androidx.activity.compose.BackHandlerimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.grid.LazyVerticalGridimport androidx.compose.foundation.lazy.grid.GridCells@@ -63,6 +64,12 @@ import com.streamvault.app.ui.components.shell.AppMessageStateimport com.streamvault.app.ui.components.shell.AppScreenScaffoldimport androidx.tv.material3.Borderimport com.streamvault.app.ui.components.dialogs.RenameGroupDialog+import com.streamvault.app.ui.components.shell.VodActionChip+import com.streamvault.app.ui.components.shell.VodActionChipRow+import com.streamvault.app.ui.components.shell.VodCategoryOption+import com.streamvault.app.ui.components.shell.VodCategoryPickerDialog+import com.streamvault.app.ui.components.shell.VodHeroStrip+import com.streamvault.app.ui.components.shell.VodSectionHeader@OptIn(ExperimentalFoundationApi::class)@Composable@@ -155,6 +162,25 @@ fun MoviesScreen()}} else {+ MoviesVodContent(+ uiState = uiState,+ selectedFacet = selectedFacet,+ onSelectedFacetChange = { selectedFacet = it },+ selectedSort = selectedSort,+ onSelectedSortChange = { selectedSort = it },+ onNavigate = onNavigate,+ onMovieClick = onMovieClick,+ onProtectedMovieClick = { movie ->+ pendingMovie = movie+ showPinDialog = true+ },+ onShowDialog = viewModel::onShowDialog,+ onSelectCategory = viewModel::selectCategory,+ onSelectFullLibraryBrowse = viewModel::selectFullLibraryBrowse,+ onLoadMore = viewModel::loadMoreSelectedCategory,+ onDismissReorder = viewModel::exitCategoryReorderMode+ )+ return@AppScreenScaffoldRow(modifier = Modifier.fillMaxSize()) {val focusManager = LocalFocusManager.currentval categorySearchFocusRequester = remember { FocusRequester() }@@ -813,6 +839,406 @@ private enum class MovieLibraryFacet {TOP_RATED}+@Composable+private fun MoviesVodContent(+ uiState: MoviesUiState,+ selectedFacet: String,+ onSelectedFacetChange: (String) -> Unit,+ selectedSort: String,+ onSelectedSortChange: (String) -> Unit,+ onNavigate: (String) -> Unit,+ onMovieClick: (Movie) -> Unit,+ onProtectedMovieClick: (Movie) -> Unit,+ onShowDialog: (Movie) -> Unit,+ onSelectCategory: (String?) -> Unit,+ onSelectFullLibraryBrowse: () -> Unit,+ onLoadMore: () -> Unit,+ onDismissReorder: () -> Unit+) {+ var showCategoryPicker by remember { mutableStateOf(false) }+ val favoriteMovies = uiState.moviesByCategory[uiState.favoriteCategoryName].orEmpty()+ val freshMovies = uiState.libraryLensRows[MovieLibraryLens.FRESH].orEmpty()+ val topRatedMovies = uiState.libraryLensRows[MovieLibraryLens.TOP_RATED].orEmpty()+ val continueWatching = uiState.continueWatching+ val heroMovie = freshMovies.firstOrNull() ?: topRatedMovies.firstOrNull() ?: favoriteMovies.firstOrNull()+ val categoryOptions = remember(uiState.categoryNames, uiState.categoryCounts) {+ uiState.categoryNames.map { name ->+ VodCategoryOption(+ name = name,+ count = uiState.categoryCounts[name] ?: 0,+ onClick = { onSelectCategory(name) }+ )+ }+ }++ if (showCategoryPicker) {+ VodCategoryPickerDialog(+ title = stringResource(R.string.vod_category_picker_title),+ subtitle = stringResource(R.string.vod_category_picker_subtitle),+ categories = categoryOptions,+ onDismiss = { showCategoryPicker = false }+ )+ }++ if (uiState.selectedCategory == null) {+ androidx.compose.foundation.lazy.LazyColumn(+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(bottom = 28.dp)+ ) {+ if (heroMovie != null) {+ item("hero") {+ VodHeroStrip(+ title = heroMovie.name,+ subtitle = heroMovie.plot?.takeIf { it.isNotBlank() }+ ?: heroMovie.year+ ?: stringResource(R.string.movies_library_lens_subtitle),+ actionLabel = stringResource(R.string.player_resume).substringBefore(" "),+ onClick = {+ val isLocked = (heroMovie.isAdult || heroMovie.isUserProtected) && uiState.parentalControlLevel == 1+ if (isLocked) onProtectedMovieClick(heroMovie) else onMovieClick(heroMovie)+ },+ modifier = Modifier.padding(top = 8.dp, bottom = 6.dp)+ )+ }+ }++ item("actions") {+ VodActionChipRow(+ actions = buildList {+ add(+ VodActionChip(+ key = "browse_all",+ label = stringResource(R.string.library_full_browse_title_movies),+ detail = stringResource(R.string.library_full_browse_subtitle, uiState.libraryCount),+ onClick = onSelectFullLibraryBrowse+ )+ )+ add(+ VodActionChip(+ key = "categories",+ label = stringResource(R.string.movies_categories_title),+ detail = "${uiState.categoryNames.size} groups",+ onClick = { showCategoryPicker = true }+ )+ )+ if (favoriteMovies.isNotEmpty()) {+ add(+ VodActionChip(+ key = "favorites",+ label = stringResource(R.string.favorites_title),+ detail = stringResource(R.string.library_saved_items_count, favoriteMovies.size),+ onClick = { onSelectCategory(uiState.favoriteCategoryName) }+ )+ )+ }+ if (continueWatching.isNotEmpty()) {+ add(+ VodActionChip(+ key = "resume",+ label = stringResource(R.string.library_lens_continue),+ detail = "${continueWatching.size} items",+ onClick = { }+ )+ )+ }+ if (topRatedMovies.isNotEmpty()) {+ add(+ VodActionChip(+ key = MovieLibraryLens.TOP_RATED.name,+ label = stringResource(R.string.library_lens_top_rated),+ detail = "${topRatedMovies.size} picks",+ onClick = { }+ )+ )+ }+ if (freshMovies.isNotEmpty()) {+ add(+ VodActionChip(+ key = MovieLibraryLens.FRESH.name,+ label = stringResource(R.string.library_lens_fresh_movies),+ detail = "${freshMovies.size} picks",+ onClick = { }+ )+ )+ }+ },+ modifier = Modifier.padding(top = 2.dp, bottom = 6.dp)+ )+ }++ if (continueWatching.isNotEmpty()) {+ item("continue_watching") {+ ContinueWatchingRow(+ items = continueWatching,+ onItemClick = { history ->+ onMovieClick(+ Movie(+ id = history.contentId,+ name = history.title,+ posterUrl = history.posterUrl,+ streamUrl = history.streamUrl,+ providerId = history.providerId+ )+ )+ }+ )+ }+ }++ if (favoriteMovies.isNotEmpty()) {+ item("favorites_header") {+ VodSectionHeader(+ title = stringResource(R.string.favorites_title),+ onSeeAll = { onSelectCategory(uiState.favoriteCategoryName) }+ )+ }+ item("favorites_row") {+ LazyRow(+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ items(favoriteMovies, key = { it.id }) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ onClick = {+ if (isLocked) onProtectedMovieClick(movie) else onMovieClick(movie)+ },+ onLongClick = { onShowDialog(movie) },+ modifier = Modifier.width(160.dp)+ )+ }+ }+ }+ }++ if (freshMovies.isNotEmpty()) {+ item("fresh_header") {+ VodSectionHeader(title = stringResource(R.string.library_lens_fresh_movies))+ }+ item("fresh_row") {+ CategoryRow(+ title = "",+ items = freshMovies,+ onSeeAll = null+ ) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedMovieClick(movie) else onMovieClick(movie) },+ onLongClick = { onShowDialog(movie) }+ )+ }+ }+ }++ if (topRatedMovies.isNotEmpty()) {+ item("top_header") {+ VodSectionHeader(title = stringResource(R.string.library_lens_top_rated))+ }+ item("top_row") {+ CategoryRow(+ title = "",+ items = topRatedMovies,+ onSeeAll = null+ ) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedMovieClick(movie) else onMovieClick(movie) },+ onLongClick = { onShowDialog(movie) }+ )+ }+ }+ }++ items(+ items = uiState.moviesByCategory.entries.filter { (name, items) ->+ name != uiState.favoriteCategoryName && items.isNotEmpty()+ }.take(8),+ key = { it.key }+ ) { (categoryName, movies) ->+ VodSectionHeader(+ title = categoryName,+ onSeeAll = { onSelectCategory(categoryName) }+ )+ CategoryRow(+ title = "",+ items = movies,+ onSeeAll = null+ ) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedMovieClick(movie) else onMovieClick(movie) },+ onLongClick = { onShowDialog(movie) }+ )+ }+ }+ }+ return+ }++ val baseMovies = uiState.selectedCategoryItems+ val resumeMovieIds = remember(uiState.continueWatching) { uiState.continueWatching.map { it.contentId }.toSet() }+ val activeFacet = remember(selectedFacet) {+ MovieLibraryFacet.entries.firstOrNull { it.name == selectedFacet } ?: MovieLibraryFacet.ALL+ }+ val activeSort = remember(selectedSort) {+ MovieLibrarySort.entries.firstOrNull { it.name == selectedSort } ?: MovieLibrarySort.LIBRARY+ }+ val filteredGridMovies = remember(baseMovies, activeFacet, activeSort, resumeMovieIds, uiState.isReorderMode, uiState.filteredMovies) {+ val source = if (uiState.isReorderMode) uiState.filteredMovies else baseMovies+ if (uiState.isReorderMode) source else applyMovieFacetAndSort(+ items = source,+ facet = activeFacet,+ sort = activeSort,+ resumeMovieIds = resumeMovieIds+ )+ }+ var draggingMovie by remember { mutableStateOf<Movie?>(null) }++ Column(modifier = Modifier.fillMaxSize()) {+ VodActionChipRow(+ actions = buildList {+ add(+ VodActionChip(+ key = "back_home",+ label = stringResource(R.string.nav_movies),+ detail = stringResource(R.string.category_see_all),+ onClick = { onSelectCategory(null) }+ )+ )+ add(+ VodActionChip(+ key = uiState.fullLibraryCategoryName,+ label = stringResource(R.string.library_full_browse_title_movies),+ detail = "${uiState.libraryCount} titles",+ onClick = onSelectFullLibraryBrowse+ )+ )+ add(+ VodActionChip(+ key = "categories",+ label = stringResource(R.string.movies_categories_title),+ detail = "${uiState.categoryNames.size} groups",+ onClick = { showCategoryPicker = true }+ )+ )+ if (uiState.selectedCategory != uiState.fullLibraryCategoryName) {+ add(+ VodActionChip(+ key = uiState.selectedCategory ?: "",+ label = uiState.selectedCategory ?: stringResource(R.string.nav_movies),+ detail = "${uiState.selectedCategoryTotalCount} titles",+ onClick = { }+ )+ )+ }+ },+ selectedKey = uiState.selectedCategory,+ modifier = Modifier.padding(vertical = 8.dp)+ )++ if (!uiState.isReorderMode) {+ SelectionChipRow(+ title = stringResource(R.string.library_filter_title),+ chips = buildMovieFacetChips(baseMovies, resumeMovieIds),+ selectedKey = activeFacet.name,+ onChipSelected = onSelectedFacetChange,+ modifier = Modifier.padding(horizontal = 16.dp),+ contentPadding = PaddingValues(horizontal = 4.dp)+ )+ SelectionChipRow(+ title = stringResource(R.string.library_sort_title),+ chips = MovieLibrarySort.entries.map { sort ->+ SelectionChip(+ key = sort.name,+ label = when (sort) {+ MovieLibrarySort.LIBRARY -> stringResource(R.string.library_sort_library)+ MovieLibrarySort.TITLE -> stringResource(R.string.library_sort_az)+ MovieLibrarySort.RELEASE -> stringResource(R.string.library_sort_release)+ MovieLibrarySort.RATING -> stringResource(R.string.library_sort_rating)+ }+ )+ },+ selectedKey = activeSort.name,+ onChipSelected = onSelectedSortChange,+ modifier = Modifier.padding(horizontal = 16.dp),+ contentPadding = PaddingValues(horizontal = 4.dp)+ )+ }++ LazyVerticalGrid(+ columns = GridCells.Adaptive(minSize = 148.dp),+ modifier = Modifier+ .fillMaxSize()+ .onPreviewKeyEvent { event ->+ if (uiState.isReorderMode && event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {+ if (event.nativeKeyEvent.keyCode == android.view.KeyEvent.KEYCODE_BACK) {+ draggingMovie = null+ onDismissReorder()+ true+ } else false+ } else false+ },+ contentPadding = PaddingValues(horizontal = 20.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ VodSectionHeader(+ title = when (uiState.selectedCategory) {+ uiState.fullLibraryCategoryName -> stringResource(R.string.library_full_browse_title_movies)+ else -> uiState.selectedCategory ?: stringResource(R.string.nav_movies)+ }+ )+ }++ gridItems(filteredGridMovies, key = { it.id }) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ val isDraggingThis = draggingMovie == movie+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ isReorderMode = uiState.isReorderMode,+ isDragging = isDraggingThis,+ onClick = {+ if (uiState.isReorderMode) {+ draggingMovie = if (isDraggingThis) null else movie+ } else if (isLocked) {+ onProtectedMovieClick(movie)+ } else {+ onMovieClick(movie)+ }+ },+ onLongClick = {+ if (!uiState.isReorderMode) onShowDialog(movie)+ }+ )+ }++ if (!uiState.isReorderMode && uiState.canLoadMoreSelectedCategory) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ LoadMoreCard(+ label = stringResource(+ R.string.library_load_more,+ uiState.selectedCategoryLoadedCount,+ uiState.selectedCategoryTotalCount+ ),+ onClick = onLoadMore,+ modifier = Modifier.padding(top = 8.dp, bottom = 24.dp)+ )+ }+ }+ }+ }+}+private enum class MovieLibrarySort {LIBRARY,TITLE,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.ktindex 6863be27..cda26ec4 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.screens.multiviewimport android.view.View+import android.view.KeyEventimport androidx.activity.compose.BackHandlerimport androidx.annotation.OptInimport androidx.compose.foundation.background@@ -16,6 +17,7 @@ import androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.material3.Text@@ -25,12 +27,16 @@ import androidx.compose.runtime.collectAsStateimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusPropertiesimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.input.key.onKeyEventimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.style.TextOverflow@@ -59,10 +65,18 @@ fun MultiViewScreen(viewModel: MultiViewViewModel = hiltViewModel()) {val uiState by viewModel.uiState.collectAsState()- val firstSlotFocusRequester = remember { androidx.compose.ui.focus.FocusRequester() }+ val firstSlotFocusRequester = remember { FocusRequester() }+ val firstControlFocusRequester = remember { FocusRequester() }var showReplacementPicker by remember { mutableStateOf(false) }+ var showControls by rememberSaveable { mutableStateOf(false) }- BackHandler(onBack = onBack)+ BackHandler {+ when {+ showReplacementPicker -> showReplacementPicker = false+ showControls -> showControls = false+ else -> onBack()+ }+ }LaunchedEffect(Unit) {viewModel.initSlots()@@ -74,10 +88,46 @@ fun MultiViewScreen(}}+ LaunchedEffect(showControls) {+ if (showControls) {+ try {+ kotlinx.coroutines.delay(60)+ firstControlFocusRequester.requestFocus()+ } catch (_: Exception) {+ // No-op: focus handoff can fail during composition transitions.+ }+ }+ }+Box(modifier = Modifier.fillMaxSize().background(Color.Black)+ .focusRequester(firstSlotFocusRequester)+ .onKeyEvent { event ->+ if (event.nativeKeyEvent.action != KeyEvent.ACTION_DOWN) return@onKeyEvent false+ when (event.nativeKeyEvent.keyCode) {+ KeyEvent.KEYCODE_MENU,+ KeyEvent.KEYCODE_INFO -> {+ showControls = !showControls+ true+ }+ KeyEvent.KEYCODE_BACK -> {+ when {+ showReplacementPicker -> {+ showReplacementPicker = false+ true+ }+ showControls -> {+ showControls = false+ true+ }+ else -> false+ }+ }+ else -> false+ }+ }) {if (showReplacementPicker) {ReplaceSlotDialog(@@ -96,17 +146,27 @@ fun MultiViewScreen(slot = uiState.slots.getOrNull(0),isFocused = uiState.focusedSlotIndex == 0,showSelectionBorder = uiState.showSelectionBorder,+ onClick = { showControls = !showControls },modifier = Modifier.weight(1f).fillMaxHeight()- .focusRequester(firstSlotFocusRequester),+ .focusRequester(firstSlotFocusRequester)+ .focusProperties {+ if (showControls) down = firstControlFocusRequester+ },onFocused = { viewModel.setFocus(0) })PlayerCell(slot = uiState.slots.getOrNull(1),isFocused = uiState.focusedSlotIndex == 1,showSelectionBorder = uiState.showSelectionBorder,- modifier = Modifier.weight(1f).fillMaxHeight(),+ onClick = { showControls = !showControls },+ modifier = Modifier+ .weight(1f)+ .fillMaxHeight()+ .focusProperties {+ if (showControls) down = firstControlFocusRequester+ },onFocused = { viewModel.setFocus(1) })}@@ -115,89 +175,51 @@ fun MultiViewScreen(slot = uiState.slots.getOrNull(2),isFocused = uiState.focusedSlotIndex == 2,showSelectionBorder = uiState.showSelectionBorder,- modifier = Modifier.weight(1f).fillMaxHeight(),+ onClick = { showControls = !showControls },+ modifier = Modifier+ .weight(1f)+ .fillMaxHeight()+ .focusProperties {+ if (showControls) down = firstControlFocusRequester+ },onFocused = { viewModel.setFocus(2) })PlayerCell(slot = uiState.slots.getOrNull(3),isFocused = uiState.focusedSlotIndex == 3,showSelectionBorder = uiState.showSelectionBorder,- modifier = Modifier.weight(1f).fillMaxHeight(),+ onClick = { showControls = !showControls },+ modifier = Modifier+ .weight(1f)+ .fillMaxHeight()+ .focusProperties {+ if (showControls) down = firstControlFocusRequester+ },onFocused = { viewModel.setFocus(3) })}}val focused = uiState.slots.getOrNull(uiState.focusedSlotIndex)- Column(- modifier = Modifier- .align(Alignment.BottomCenter)- .padding(bottom = 8.dp),- horizontalAlignment = Alignment.CenterHorizontally- ) {- MultiViewPolicyCard(- policy = uiState.performancePolicy,- telemetry = uiState.telemetry,- onModeSelected = viewModel::setPerformanceMode- )- if (focused != null && focused.title.isNotBlank()) {- Text(- text = stringResource(R.string.multiview_focused_prefix, focused.title),- color = Color(0xFF4CAF50),- fontSize = 12.sp,- fontWeight = FontWeight.Bold,- modifier = Modifier- .background(Color.Black.copy(alpha = 0.7f), RoundedCornerShape(4.dp))- .padding(horizontal = 12.dp, vertical = 4.dp)+ if (showControls) {+ Column(+ modifier = Modifier+ .align(Alignment.BottomCenter)+ .padding(bottom = 14.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ MultiViewControlHud(+ focused = focused,+ uiState = uiState,+ firstControlFocusRequester = firstControlFocusRequester,+ onShowReplacementPicker = { showReplacementPicker = true },+ onRemoveFocusedSlot = viewModel::removeFocusedSlot,+ onClearPinnedAudio = viewModel::clearPinnedAudio,+ onPinAudioToFocusedSlot = viewModel::pinAudioToFocusedSlot,+ onLoadPreset = viewModel::loadPreset,+ onSavePreset = viewModel::saveCurrentAsPreset)}- if (uiState.presets.isNotEmpty()) {- Spacer(modifier = Modifier.size(8.dp))- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- uiState.presets.forEach { preset ->- val presetLabel = stringResource(R.string.multiview_preset_label, preset.index + 1)- Button(onClick = { viewModel.loadPreset(preset.index) }) {- Text(- text = if (preset.isPopulated) {- "$presetLabel (${preset.channelCount})"- } else {- presetLabel- }- )- }- Button(onClick = { viewModel.saveCurrentAsPreset(preset.index) }) {- Text(text = stringResource(R.string.multiview_preset_save, preset.index + 1))- }- }- }- }- Spacer(modifier = Modifier.size(8.dp))- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- Button(- onClick = { showReplacementPicker = true },- enabled = uiState.replacementCandidates.isNotEmpty()- ) {- Text(stringResource(R.string.multiview_replace_slot))- }- Button(- onClick = { viewModel.removeFocusedSlot() },- enabled = focused != null && !focused.isEmpty- ) {- Text(stringResource(R.string.multiview_remove_slot))- }- if (uiState.pinnedAudioSlotIndex == uiState.focusedSlotIndex) {- Button(onClick = { viewModel.clearPinnedAudio() }) {- Text(stringResource(R.string.multiview_audio_follow_focus))- }- } else {- Button(- onClick = { viewModel.pinAudioToFocusedSlot() },- enabled = focused != null && !focused.isEmpty- ) {- Text(stringResource(R.string.multiview_pin_audio))- }- }- }}}}@@ -208,13 +230,14 @@ private fun PlayerCell(slot: MultiViewSlot?,isFocused: Boolean,showSelectionBorder: Boolean,+ onClick: () -> Unit,modifier: Modifier,onFocused: () -> Unit) {val showBorder = isFocused && showSelectionBorderSurface(- onClick = { },+ onClick = onClick,modifier = modifier.padding(2.dp).onFocusChanged { if (it.isFocused) onFocused() },@@ -359,119 +382,105 @@ private fun PlayerCell(}@Composable-private fun MultiViewPolicyCard(- policy: MultiViewPerformancePolicyUiModel,- telemetry: MultiViewTelemetryUiModel,- onModeSelected: (MultiViewPerformanceMode) -> Unit+private fun MultiViewControlHud(+ focused: MultiViewSlot?,+ uiState: MultiViewUiState,+ firstControlFocusRequester: FocusRequester,+ onShowReplacementPicker: () -> Unit,+ onRemoveFocusedSlot: () -> Unit,+ onClearPinnedAudio: () -> Unit,+ onPinAudioToFocusedSlot: () -> Unit,+ onLoadPreset: (Int) -> Unit,+ onSavePreset: (Int) -> Unit) {Column(horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(8.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp),modifier = Modifier- .background(Color.Black.copy(alpha = 0.7f), RoundedCornerShape(12.dp))- .padding(horizontal = 16.dp, vertical = 12.dp)+ .background(Color.Black.copy(alpha = 0.58f), RoundedCornerShape(18.dp))+ .border(1.dp, Color.White.copy(alpha = 0.08f), RoundedCornerShape(18.dp))+ .padding(horizontal = 18.dp, vertical = 14.dp)) {- Text(- text = stringResource(- R.string.multiview_policy_summary,- policy.tier.name.lowercase().replaceFirstChar { it.uppercase() },- policy.maxActiveSlots- ),- color = Color.White,- style = MaterialTheme.typography.labelLarge- )- Text(- text = policy.summary,- color = Color(0xFFB0BEC5),- style = MaterialTheme.typography.bodySmall,- textAlign = TextAlign.Center- )- Column(- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(4.dp)+ Row(+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically) {Text(text = stringResource(- R.string.multiview_telemetry_snapshot,- telemetry.activeSlots,- telemetry.standbySlots,- telemetry.bufferingSlots,- telemetry.errorSlots+ R.string.multiview_policy_summary,+ uiState.performancePolicy.tier.name.lowercase().replaceFirstChar { it.uppercase() },+ uiState.performancePolicy.maxActiveSlots),- color = Color.White,+ color = Color.White.copy(alpha = 0.86f),style = MaterialTheme.typography.labelMedium)+ Text(text = "•", color = Color.White.copy(alpha = 0.42f))Text(text = stringResource(- R.string.multiview_telemetry_detail,- telemetry.totalDroppedFrames,- telemetry.droppedFramesDelta,- telemetry.sustainedLoadScore,- when (telemetry.thermalStatus) {- MultiViewThermalStatus.NORMAL -> stringResource(R.string.multiview_thermal_normal)- MultiViewThermalStatus.LIGHT -> stringResource(R.string.multiview_thermal_light)- MultiViewThermalStatus.MODERATE -> stringResource(R.string.multiview_thermal_moderate)- MultiViewThermalStatus.SEVERE -> stringResource(R.string.multiview_thermal_severe)- MultiViewThermalStatus.CRITICAL -> stringResource(R.string.multiview_thermal_critical)- MultiViewThermalStatus.UNKNOWN -> stringResource(R.string.multiview_thermal_unknown)- }+ R.string.multiview_telemetry_snapshot,+ uiState.telemetry.activeSlots,+ uiState.telemetry.standbySlots,+ uiState.telemetry.bufferingSlots,+ uiState.telemetry.errorSlots),- color = Color(0xFFB0BEC5),- style = MaterialTheme.typography.bodySmall,- textAlign = TextAlign.Center+ color = Color.White.copy(alpha = 0.78f),+ style = MaterialTheme.typography.bodySmall)- if (telemetry.isLowMemory) {- Text(- text = stringResource(R.string.multiview_low_memory_warning),- color = Color(0xFFFFC107),- style = MaterialTheme.typography.bodySmall,- textAlign = TextAlign.Center- )- }- telemetry.throttledReason?.let { reason ->- Text(- text = reason,- color = Color(0xFFFFE082),- style = MaterialTheme.typography.bodySmall,- textAlign = TextAlign.Center- )- }+ }++ if (focused != null && focused.title.isNotBlank()) {Text(- text = telemetry.recommendation,- color = Color(0xFF90CAF9),- style = MaterialTheme.typography.bodySmall,- textAlign = TextAlign.Center+ text = stringResource(R.string.multiview_focused_prefix, focused.title),+ color = Primary,+ style = MaterialTheme.typography.labelLarge,+ fontWeight = FontWeight.Bold)}+Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- MultiViewPerformanceMode.entries.forEach { mode ->- Surface(- onClick = { onModeSelected(mode) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(20.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = if (policy.mode == mode) Color(0xFF1E3A5F) else Color(0xFF1A1A30),- focusedContainerColor = Color(0xFF294B75)- ),- border = ClickableSurfaceDefaults.border(- border = Border(- androidx.compose.foundation.BorderStroke(- width = 1.dp,- color = if (policy.mode == mode) Color.White else Color.Transparent- )- )- )+ Button(+ onClick = onShowReplacementPicker,+ enabled = uiState.replacementCandidates.isNotEmpty(),+ modifier = Modifier.focusRequester(firstControlFocusRequester)+ ) {+ Text(stringResource(R.string.multiview_replace_slot))+ }+ Button(+ onClick = onRemoveFocusedSlot,+ enabled = focused != null && !focused.isEmpty+ ) {+ Text(stringResource(R.string.multiview_remove_slot))+ }+ if (uiState.pinnedAudioSlotIndex == uiState.focusedSlotIndex) {+ Button(onClick = onClearPinnedAudio) {+ Text(stringResource(R.string.multiview_audio_follow_focus))+ }+ } else {+ Button(+ onClick = onPinAudioToFocusedSlot,+ enabled = focused != null && !focused.isEmpty) {- Text(- text = when (mode) {- MultiViewPerformanceMode.AUTO -> stringResource(R.string.multiview_policy_auto)- MultiViewPerformanceMode.CONSERVATIVE -> stringResource(R.string.multiview_policy_conservative)- MultiViewPerformanceMode.BALANCED -> stringResource(R.string.multiview_policy_balanced)- MultiViewPerformanceMode.MAXIMUM -> stringResource(R.string.multiview_policy_maximum)- },- color = Color.White,- style = MaterialTheme.typography.labelMedium,- modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp)- )+ Text(stringResource(R.string.multiview_pin_audio))+ }+ }+ }++ if (uiState.presets.isNotEmpty()) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ uiState.presets.forEach { preset ->+ val presetLabel = stringResource(R.string.multiview_preset_label, preset.index + 1)+ Button(onClick = { onLoadPreset(preset.index) }) {+ Text(+ text = if (preset.isPopulated) {+ "$presetLabel (${preset.channelCount})"+ } else {+ presetLabel+ }+ )+ }+ Button(onClick = { onSavePreset(preset.index) }) {+ Text(text = stringResource(R.string.multiview_preset_save, preset.index + 1))+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.ktindex b0deb48b..1defa193 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt@@ -75,7 +75,6 @@ import com.streamvault.app.ui.screens.player.overlay.PlayerAspectRatioToastimport com.streamvault.app.ui.screens.player.overlay.PlayerControlsOverlayimport com.streamvault.app.ui.screens.player.overlay.PlayerNumericInputOverlayimport com.streamvault.app.ui.screens.player.overlay.PlayerResolutionBadge-import com.streamvault.app.ui.screens.player.overlay.PlayerZapOverlayimport com.streamvault.app.ui.screens.multiview.MultiViewViewModelimport com.streamvault.app.ui.screens.multiview.MultiViewPlannerDialogimport com.streamvault.app.navigation.Routes@@ -112,7 +111,6 @@ fun PlayerScreen(val nextProgram by viewModel.nextProgram.collectAsState()val programHistory by viewModel.programHistory.collectAsState()val currentChannel by viewModel.currentChannel.collectAsState()- val showZapOverlay by viewModel.showZapOverlay.collectAsState()val resumePrompt by viewModel.resumePrompt.collectAsState()val showChannelListOverlay by viewModel.showChannelListOverlay.collectAsState()@@ -172,7 +170,7 @@ fun PlayerScreen(}// Consolidated focus management for all overlays- val anyOverlayVisible = showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showTrackSelection != null || showProgramHistory || showSplitDialog || showZapOverlay || showDiagnostics+ val anyOverlayVisible = showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showTrackSelection != null || showProgramHistory || showSplitDialog || showDiagnosticsLaunchedEffect(anyOverlayVisible) {if (anyOverlayVisible) {@@ -279,6 +277,9 @@ fun PlayerScreen(if (event.nativeKeyEvent.action == KeyEvent.ACTION_DOWN) {when (event.nativeKeyEvent.keyCode) {KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (contentType == "LIVE" && viewModel.hasPendingNumericChannelInput()) {viewModel.commitNumericChannelInput()} else if (contentType == "LIVE") {@@ -290,6 +291,9 @@ fun PlayerScreen(true}KeyEvent.KEYCODE_DPAD_LEFT -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (contentType == "LIVE" && !showChannelListOverlay && !showEpgOverlay && !showChannelInfoOverlay) {if (isRtl) viewModel.openEpgOverlay() else viewModel.openChannelListOverlay()true@@ -301,6 +305,9 @@ fun PlayerScreen(}}KeyEvent.KEYCODE_DPAD_RIGHT -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (contentType == "LIVE" && !showChannelListOverlay && !showEpgOverlay && !showChannelInfoOverlay) {if (isRtl) viewModel.openChannelListOverlay() else viewModel.openEpgOverlay()true@@ -312,6 +319,9 @@ fun PlayerScreen(}}KeyEvent.KEYCODE_DPAD_UP -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (showChannelListOverlay || showEpgOverlay) return@onKeyEvent falseif (contentType == "LIVE") {@@ -322,6 +332,9 @@ fun PlayerScreen(true}KeyEvent.KEYCODE_DPAD_DOWN -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (showChannelListOverlay || showEpgOverlay) return@onKeyEvent falseif (contentType == "LIVE") {@@ -401,6 +414,9 @@ fun PlayerScreen(}}KeyEvent.KEYCODE_INFO -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }if (contentType == "LIVE") {if (showChannelInfoOverlay) viewModel.closeChannelInfoOverlay()else viewModel.openChannelInfoOverlay()@@ -410,6 +426,9 @@ fun PlayerScreen(true}KeyEvent.KEYCODE_MENU -> {+ if (showChannelListOverlay || showEpgOverlay || showChannelInfoOverlay || showDiagnostics) {+ viewModel.onLiveOverlayInteraction()+ }viewModel.toggleControls()true}@@ -539,14 +558,6 @@ fun PlayerScreen(onOpenSplitScreen = { showSplitDialog = true })- PlayerZapOverlay(- visible = showZapOverlay && !showControls && currentChannel != null,- displayChannelNumber = displayChannelNumber,- channelName = currentChannel?.name,- programTitle = currentProgram?.title,- modifier = Modifier.align(Alignment.BottomStart)- )-PlayerNumericInputOverlay(state = numericChannelInput,visible = contentType == "LIVE" && !showControls,@@ -621,7 +632,8 @@ fun PlayerScreen(lastVisitedCategoryName = lastVisitedCategory?.name,onOpenLastGroup = { viewModel.openLastVisitedCategory() },onSelectChannel = { channelId -> viewModel.zapToChannel(channelId) },- onDismiss = { viewModel.closeOverlays() }+ onDismiss = { viewModel.closeOverlays() },+ onOverlayInteracted = viewModel::onLiveOverlayInteraction)}@@ -648,7 +660,8 @@ fun PlayerScreen(onPlayCatchUp = { program ->viewModel.playCatchUp(program)viewModel.closeOverlays()- }+ },+ onOverlayInteracted = viewModel::onLiveOverlayInteraction)}@@ -669,6 +682,7 @@ fun PlayerScreen(focusRequester = channelInfoFocusRequester,lastVisitedCategoryName = lastVisitedCategory?.name,onDismiss = { viewModel.closeChannelInfoOverlay() },+ onOverlayInteracted = viewModel::onLiveOverlayInteraction,onOpenFullEpg = {viewModel.closeChannelInfoOverlay()viewModel.openEpgOverlay()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.ktindex 14607b83..d0ef4d5f 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt@@ -160,6 +160,8 @@ class PlayerViewModel @Inject constructor(val currentChannelRecording: StateFlow<RecordingItem?> = _currentChannelRecording.asStateFlow()private var channelInfoHideJob: Job? = null+ private var liveOverlayHideJob: Job? = null+ private var diagnosticsHideJob: Job? = nullprivate var numericInputCommitJob: Job? = nullprivate var numericInputFeedbackJob: Job? = nullprivate var playerNoticeHideJob: Job? = null@@ -272,6 +274,7 @@ class PlayerViewModel @Inject constructor(_showEpgOverlay.value = false_showChannelInfoOverlay.value = false_showControls.value = false+ scheduleLiveOverlayAutoHide()}fun openEpgOverlay() {@@ -280,6 +283,7 @@ class PlayerViewModel @Inject constructor(_showChannelListOverlay.value = false_showChannelInfoOverlay.value = false_showControls.value = false+ scheduleLiveOverlayAutoHide()}fun openChannelInfoOverlay() {@@ -289,11 +293,13 @@ class PlayerViewModel @Inject constructor(_showEpgOverlay.value = false_showControls.value = falsechannelInfoHideJob?.cancel()+ scheduleLiveOverlayAutoHide()}fun closeChannelInfoOverlay() {channelInfoHideJob?.cancel()_showChannelInfoOverlay.value = false+ if (!hasVisibleTransientLiveOverlay()) clearLiveOverlayAutoHide()}fun closeOverlays() {@@ -301,7 +307,10 @@ class PlayerViewModel @Inject constructor(_showChannelListOverlay.value = false_showEpgOverlay.value = false_showChannelInfoOverlay.value = false+ _showDiagnostics.value = falsechannelInfoHideJob?.cancel()+ clearLiveOverlayAutoHide()+ clearDiagnosticsAutoHide()}private fun refreshCurrentChannelRecording(items: List<RecordingItem> = _recordingItems.value) {@@ -315,6 +324,20 @@ class PlayerViewModel @Inject constructor(fun toggleDiagnostics() {_showDiagnostics.value = !_showDiagnostics.value+ if (_showDiagnostics.value) {+ scheduleDiagnosticsAutoHide()+ } else {+ clearDiagnosticsAutoHide()+ }+ }++ fun onLiveOverlayInteraction() {+ if (hasVisibleTransientLiveOverlay()) {+ scheduleLiveOverlayAutoHide()+ }+ if (_showDiagnostics.value) {+ scheduleDiagnosticsAutoHide()+ }}// Zapping state@@ -949,16 +972,14 @@ class PlayerViewModel @Inject constructor(fetchEpg(currentProviderId, channel.epgChannelId)- // Show Zap Overlay & Brief Info- _showZapOverlay.value = true+ // Show bottom live info overlay+ _showZapOverlay.value = false_showControls.value = falseopenChannelInfoOverlay()// Reset tried streams for manual switchtriedAlternativeStreams.clear()triedAlternativeStreams.add(channel.streamUrl)-- hideZapOverlayAfterDelay()if (currentContentType == ContentType.LIVE) {recordLivePlayback(channel)scheduleZapBufferWatchdog(index)@@ -1405,6 +1426,47 @@ class PlayerViewModel @Inject constructor(_showZapOverlay.value = false}}++ private fun hasVisibleTransientLiveOverlay(): Boolean =+ _showChannelInfoOverlay.value ||+ _showChannelListOverlay.value ||+ _showEpgOverlay.value++ private fun clearLiveOverlayAutoHide() {+ liveOverlayHideJob?.cancel()+ liveOverlayHideJob = null+ }++ private fun clearDiagnosticsAutoHide() {+ diagnosticsHideJob?.cancel()+ diagnosticsHideJob = null+ }++ private fun scheduleLiveOverlayAutoHide() {+ if (currentContentType != ContentType.LIVE) {+ clearLiveOverlayAutoHide()+ return+ }+ liveOverlayHideJob?.cancel()+ liveOverlayHideJob = viewModelScope.launch {+ delay(4000)+ _showChannelInfoOverlay.value = false+ _showChannelListOverlay.value = false+ _showEpgOverlay.value = false+ }+ }++ private fun scheduleDiagnosticsAutoHide() {+ if (currentContentType != ContentType.LIVE) {+ clearDiagnosticsAutoHide()+ return+ }+ diagnosticsHideJob?.cancel()+ diagnosticsHideJob = viewModelScope.launch {+ delay(15000)+ _showDiagnostics.value = false+ }+ }fun retryStream(streamUrl: String, epgChannelId: String?) {val currentId = if (currentChannelIndex != -1 && channelList.isNotEmpty()) channelList[currentChannelIndex].id else -1L@@ -1424,6 +1486,8 @@ class PlayerViewModel @Inject constructor(super.onCleared()onPlayerScreenDisposed()channelInfoHideJob?.cancel()+ liveOverlayHideJob?.cancel()+ diagnosticsHideJob?.cancel()numericInputCommitJob?.cancel()numericInputFeedbackJob?.cancel()playerNoticeHideJob?.cancel()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.ktindex 16e04c7c..75ca9793 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt@@ -7,8 +7,8 @@ import androidx.compose.animation.fadeOutimport androidx.compose.animation.scaleInimport androidx.compose.animation.scaleOutimport androidx.compose.animation.togetherWith-import androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.background+import androidx.compose.foundation.borderimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column@@ -17,10 +17,14 @@ import androidx.compose.foundation.layout.PaddingValuesimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.Spacerimport androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxHeightimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightInimport androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.sizeimport androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.widthInimport androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.itemsIndexed@@ -32,6 +36,7 @@ import androidx.compose.runtime.rememberimport androidx.compose.runtime.rememberCoroutineScopeimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clipimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChanged@@ -41,10 +46,14 @@ import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.verticalScrollimport androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.Borderimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.Surfaceimport androidx.tv.material3.Text+import coil3.compose.AsyncImageimport com.streamvault.app.Rimport com.streamvault.app.ui.components.shell.StatusPillimport com.streamvault.app.ui.design.AppColors@@ -68,22 +77,30 @@ private fun PlayerOverlayPanel() {Surface(modifier = modifier,- shape = RoundedCornerShape(28.dp),- colors = androidx.tv.material3.SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ shape = RoundedCornerShape(26.dp),+ border = Border(+ border = androidx.compose.foundation.BorderStroke(+ 1.dp,+ AppColors.Focus.copy(alpha = 0.05f)+ )+ ),+ colors = androidx.tv.material3.SurfaceDefaults.colors(+ containerColor = AppColors.Canvas.copy(alpha = 0.38f)+ )) {Column(modifier = Modifier.background(Brush.verticalGradient(colors = listOf(- AppColors.BrandMuted.copy(alpha = 0.15f),- AppColors.SurfaceElevated,- AppColors.Surface+ AppColors.BrandMuted.copy(alpha = 0.06f),+ AppColors.SurfaceElevated.copy(alpha = 0.34f),+ AppColors.Surface.copy(alpha = 0.28f))))- .padding(24.dp),- verticalArrangement = Arrangement.spacedBy(12.dp),+ .padding(14.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp),content = content)}@@ -94,23 +111,35 @@ private fun PlayerMetaRow(label: String, value: String) {Row(modifier = Modifier.fillMaxWidth(),horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ verticalAlignment = Alignment.Top) {Text(text = label,- style = MaterialTheme.typography.bodySmall,- color = AppColors.TextTertiary- )- Text(- text = value,- style = MaterialTheme.typography.bodySmall,- color = AppColors.TextPrimary,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextTertiary,+ modifier = Modifier.weight(0.44f)+ )+ Text(+ text = value,+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextPrimary,+ modifier = Modifier.weight(0.56f),+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )}}+@Composable+private fun PlayerOverlaySectionLabel(text: String) {+ Text(+ text = text,+ color = Primary,+ style = MaterialTheme.typography.labelMedium,+ fontWeight = FontWeight.Bold+ )+}+@Composablefun ChannelInfoOverlay(currentChannel: Channel?,@@ -120,6 +149,7 @@ fun ChannelInfoOverlay(focusRequester: FocusRequester,lastVisitedCategoryName: String?,onDismiss: () -> Unit,+ onOverlayInteracted: () -> Unit,onOpenFullEpg: () -> Unit,onOpenLastGroup: () -> Unit,onOpenRecentChannels: () -> Unit,@@ -140,184 +170,267 @@ fun ChannelInfoOverlay(PlayerOverlayPanel(modifier = Modifier.fillMaxWidth()- .padding(horizontal = 48.dp, vertical = 32.dp)+ .padding(horizontal = 56.dp, vertical = 20.dp)) {Column(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 8.dp, vertical = 4.dp),- verticalArrangement = Arrangement.spacedBy(8.dp)+ modifier = Modifier.fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(10.dp)) {- if (currentChannel != null) {- Row(verticalAlignment = Alignment.CenterVertically) {- StatusPill(- label = stringResource(R.string.player_live_channel, displayChannelNumber),- containerColor = AppColors.BrandMuted- )- Spacer(Modifier.width(12.dp))- Text(- text = currentChannel.name,- style = MaterialTheme.typography.headlineMedium,- color = AppColors.TextPrimary,- fontWeight = FontWeight.Bold,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- if (currentChannel.catchUpSupported) {- Spacer(Modifier.width(12.dp))- StatusPill(- label = stringResource(R.string.player_catchup_badge),- containerColor = AppColors.Live- )+ Column(+ modifier = Modifier.fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(6.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ if (currentChannel != null) {+ Box(+ modifier = Modifier+ .size(52.dp)+ .clip(RoundedCornerShape(12.dp))+ .background(AppColors.SurfaceEmphasis.copy(alpha = 0.46f))+ .border(1.dp, AppColors.Focus.copy(alpha = 0.05f), RoundedCornerShape(12.dp)),+ contentAlignment = Alignment.Center+ ) {+ if (!currentChannel.logoUrl.isNullOrBlank()) {+ AsyncImage(+ model = currentChannel.logoUrl,+ contentDescription = null,+ modifier = Modifier+ .fillMaxSize()+ .padding(6.dp),+ contentScale = androidx.compose.ui.layout.ContentScale.Fit+ )+ } else {+ Text(+ text = currentChannel.name.take(2).uppercase(Locale.getDefault()),+ style = MaterialTheme.typography.labelLarge,+ color = AppColors.TextSecondary,+ fontWeight = FontWeight.Bold+ )+ }+ }}- }- }-- if (currentProgram != null) {- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {- Row(- modifier = Modifier.fillMaxWidth(),- verticalAlignment = Alignment.CenterVertically+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)) {- Column(modifier = Modifier.weight(1f)) {+ Row(+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ StatusPill(+ label = stringResource(R.string.player_live_channel, displayChannelNumber),+ containerColor = AppColors.BrandMuted+ )+ if (currentChannel != null) {+ Text(+ text = currentChannel.name,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.weight(1f, fill = false)+ )+ }+ if (currentChannel?.catchUpSupported == true) {+ StatusPill(+ label = stringResource(R.string.player_catchup_badge),+ containerColor = AppColors.Live+ )+ }+ }++ if (currentProgram != null) {Text(text = currentProgram.title,- style = MaterialTheme.typography.titleMedium,+ style = MaterialTheme.typography.titleSmall,color = AppColors.TextPrimary,fontWeight = FontWeight.Bold,maxLines = 1,overflow = TextOverflow.Ellipsis)+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(+ R.string.player_time_range_minutes,+ timeFormat.format(Date(currentProgram.startTime)),+ timeFormat.format(Date(currentProgram.endTime)),+ currentProgram.durationMinutes+ ),+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextSecondary,+ maxLines = 1+ )+ val now = System.currentTimeMillis()+ val start = currentProgram.startTime+ val end = currentProgram.endTime+ if (start in 1..<end) {+ val progress = (now - start).toFloat() / (end - start)+ val remainingMin = ((end - now) / 60000).toInt().coerceAtLeast(0)+ androidx.compose.material3.LinearProgressIndicator(+ progress = { progress.coerceIn(0f, 1f) },+ modifier = Modifier+ .weight(1f)+ .height(4.dp)+ .clip(RoundedCornerShape(999.dp)),+ color = Primary,+ trackColor = AppColors.SurfaceEmphasis.copy(alpha = 0.45f)+ )+ Text(+ text = stringResource(R.string.player_minutes_remaining, remainingMin),+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim,+ maxLines = 1+ )+ }+ }+ if (nextProgram != null) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(R.string.player_next_label),+ style = MaterialTheme.typography.labelSmall,+ color = Primary+ )+ Text(+ text = nextProgram.title,+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.weight(1f)+ )+ Text(+ text = timeFormat.format(Date(nextProgram.startTime)),+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextTertiary+ )+ }+ }+ } else {Text(- text = stringResource(- R.string.player_time_range_minutes,- timeFormat.format(Date(currentProgram.startTime)),- timeFormat.format(Date(currentProgram.endTime)),- currentProgram.durationMinutes- ),- style = MaterialTheme.typography.labelMedium,- color = AppColors.TextSecondary+ text = stringResource(R.string.player_no_guide_data),+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ fontWeight = FontWeight.Medium,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis)}}- val now = System.currentTimeMillis()- val start = currentProgram.startTime- val end = currentProgram.endTime- if (start in 1..<end) {- val progress = (now - start).toFloat() / (end - start)- val remainingMin = ((end - now) / 60000).toInt().coerceAtLeast(0)- androidx.compose.material3.LinearProgressIndicator(- progress = { progress.coerceIn(0f, 1f) },- modifier = Modifier- .fillMaxWidth()- .height(3.dp),- color = Primary,- trackColor = AppColors.SurfaceEmphasis- )- Text(- text = stringResource(R.string.player_minutes_remaining, remainingMin),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }}}Row(modifier = Modifier.fillMaxWidth(),- verticalAlignment = Alignment.Bottom,- horizontalArrangement = Arrangement.SpaceBetween+ horizontalArrangement = Arrangement.spacedBy(6.dp),+ verticalAlignment = Alignment.CenterVertically) {- Column(- modifier = Modifier- .weight(1f)- .padding(end = 16.dp)- ) {- if (nextProgram != null) {- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = stringResource(R.string.player_next_label),- style = MaterialTheme.typography.labelMedium,- color = Primary- )- Text(- text = nextProgram.title,- style = MaterialTheme.typography.labelMedium,- color = AppColors.TextSecondary,- maxLines = 1,- overflow = TextOverflow.Ellipsis,- modifier = Modifier.weight(1f)- )- Text(- text = timeFormat.format(Date(nextProgram.startTime)),- style = MaterialTheme.typography.labelSmall,- color = AppColors.TextTertiary- )- }- }- }-- Row(- horizontalArrangement = Arrangement.spacedBy(8.dp),- verticalAlignment = Alignment.CenterVertically- ) {- QuickActionButton(- icon = stringResource(R.string.player_action_playback),- label = if (isPlaying) stringResource(R.string.player_pause) else stringResource(R.string.player_play),- onClick = onTogglePlayPause,- colors = ClickableSurfaceDefaults.colors(- containerColor = Primary.copy(alpha = 0.25f),- focusedContainerColor = Primary,- pressedContainerColor = Primary.copy(alpha = 0.8f)- )- )- if (currentChannel?.catchUpSupported == true && currentProgram?.hasArchive == true) {- QuickActionButton(- icon = stringResource(R.string.player_action_restart_short),- label = stringResource(R.string.player_restart),- onClick = {- onRestartProgram()- onDismiss()- }- )- }- QuickActionButton(- icon = stringResource(R.string.player_action_view),- label = currentAspectRatio,- onClick = onToggleAspectRatio,- modifier = Modifier.focusRequester(focusRequester)- )- if (!lastVisitedCategoryName.isNullOrBlank()) {- QuickActionButton(- icon = stringResource(R.string.player_action_group),- label = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),- onClick = onOpenLastGroup- )- }- QuickActionButton(- icon = stringResource(R.string.player_action_recent_short),- label = stringResource(R.string.player_recent_channels),- onClick = onOpenRecentChannels- )- QuickActionButton(- icon = stringResource(R.string.player_action_guide),- label = stringResource(R.string.player_full_epg),- onClick = onOpenFullEpg- )+ QuickActionButton(+ icon = stringResource(R.string.player_action_playback),+ label = if (isPlaying) stringResource(R.string.player_pause) else stringResource(R.string.player_play),+ onClick = {+ onOverlayInteracted()+ onTogglePlayPause()+ },+ onInteraction = onOverlayInteracted,+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary.copy(alpha = 0.20f),+ focusedContainerColor = Primary,+ pressedContainerColor = Primary.copy(alpha = 0.8f)+ ),+ modifier = Modifier.focusRequester(focusRequester)+ )+ QuickActionButton(+ icon = stringResource(R.string.player_action_controls),+ label = stringResource(R.string.player_more_controls),+ onClick = {+ onOverlayInteracted()+ onDismiss()+ onOpenFullControls()+ },+ onInteraction = onOverlayInteracted+ )+ if (currentChannel?.catchUpSupported == true && currentProgram?.hasArchive == true) {QuickActionButton(- icon = stringResource(R.string.player_action_split),- label = stringResource(R.string.multiview_nav),+ icon = stringResource(R.string.player_action_restart_short),+ label = stringResource(R.string.player_restart),onClick = {+ onOverlayInteracted()+ onRestartProgram()onDismiss()- onOpenSplitScreen()- }+ },+ onInteraction = onOverlayInteracted)+ }+ QuickActionButton(+ icon = stringResource(R.string.player_action_view),+ label = currentAspectRatio,+ onClick = {+ onOverlayInteracted()+ onToggleAspectRatio()+ },+ onInteraction = onOverlayInteracted+ )+ if (!lastVisitedCategoryName.isNullOrBlank()) {QuickActionButton(- icon = stringResource(R.string.player_action_diagnostics),- label = stringResource(R.string.player_stats),- onClick = onToggleDiagnostics+ icon = stringResource(R.string.player_action_group),+ label = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),+ onClick = {+ onOverlayInteracted()+ onOpenLastGroup()+ },+ onInteraction = onOverlayInteracted)}+ QuickActionButton(+ icon = stringResource(R.string.player_action_recent_short),+ label = stringResource(R.string.player_recent_channels),+ onClick = {+ onOverlayInteracted()+ onOpenRecentChannels()+ },+ onInteraction = onOverlayInteracted+ )+ QuickActionButton(+ icon = stringResource(R.string.player_action_guide),+ label = stringResource(R.string.player_full_epg),+ onClick = {+ onOverlayInteracted()+ onOpenFullEpg()+ },+ onInteraction = onOverlayInteracted+ )+ QuickActionButton(+ icon = stringResource(R.string.player_action_split),+ label = stringResource(R.string.multiview_nav),+ onClick = {+ onOverlayInteracted()+ onDismiss()+ onOpenSplitScreen()+ },+ onInteraction = onOverlayInteracted+ )+ QuickActionButton(+ icon = stringResource(R.string.player_action_diagnostics),+ label = stringResource(R.string.player_stats),+ onClick = {+ onOverlayInteracted()+ onToggleDiagnostics()+ },+ onInteraction = onOverlayInteracted+ )}}}@@ -332,19 +445,27 @@ private fun QuickActionButton(containerColor = AppColors.SurfaceEmphasis,focusedContainerColor = Primary.copy(alpha = 0.85f)),+ onInteraction: () -> Unit = {},onClick: () -> Unit) {Surface(- onClick = onClick,- modifier = modifier,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ onClick = {+ onInteraction()+ onClick()+ },+ modifier = modifier+ .widthIn(min = 92.dp, max = 176.dp)+ .onFocusChanged {+ if (it.isFocused) onInteraction()+ },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),colors = colors,- scale = ClickableSurfaceDefaults.scale(focusedScale = 1.05f)+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1.01f)) {Column(- modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp),+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 7.dp),horizontalAlignment = Alignment.Start,- verticalArrangement = Arrangement.spacedBy(4.dp)+ verticalArrangement = Arrangement.spacedBy(1.dp)) {AnimatedContent(targetState = icon,@@ -357,14 +478,18 @@ private fun QuickActionButton(text = targetIcon.uppercase(Locale.getDefault()),style = MaterialTheme.typography.labelSmall,color = AppColors.BrandStrong,- fontWeight = FontWeight.Bold+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis)}Text(text = label,- style = MaterialTheme.typography.bodySmall,+ style = MaterialTheme.typography.labelSmall,color = AppColors.TextPrimary,- fontWeight = FontWeight.Bold+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis)}}@@ -381,7 +506,8 @@ fun ChannelListOverlay(lastVisitedCategoryName: String? = null,onOpenLastGroup: () -> Unit = {},onSelectChannel: (Long) -> Unit,- onDismiss: () -> Unit+ onDismiss: () -> Unit,+ onOverlayInteracted: () -> Unit = {}) {val listState = rememberLazyListState()val scope = rememberCoroutineScope()@@ -406,11 +532,11 @@ fun ChannelListOverlay(Box(modifier = Modifier.fillMaxSize()- .background(Color.Black.copy(alpha = 0.42f))+ .background(Color.Black.copy(alpha = 0.18f))) {PlayerOverlayPanel(modifier = Modifier- .width(520.dp)+ .width(500.dp).fillMaxWidth().padding(20.dp)) {@@ -435,12 +561,18 @@ fun ChannelListOverlay()if (!lastVisitedCategoryName.isNullOrBlank()) {Surface(- onClick = onOpenLastGroup,+ onClick = {+ onOverlayInteracted()+ onOpenLastGroup()+ },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = AppColors.SurfaceEmphasis,focusedContainerColor = Primary- )+ ),+ modifier = Modifier.onFocusChanged {+ if (it.isFocused) onOverlayInteracted()+ }) {Text(text = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),@@ -490,6 +622,7 @@ fun ChannelListOverlay(itemsIndexed(recentChannels, key = { _, channel -> channel.id }) { index, channel ->Surface(onClick = {+ onOverlayInteracted()onSelectChannel(channel.id)onDismiss()},@@ -497,7 +630,10 @@ fun ChannelListOverlay(colors = ClickableSurfaceDefaults.colors(containerColor = AppColors.SurfaceEmphasis,focusedContainerColor = Primary- )+ ),+ modifier = Modifier.onFocusChanged {+ if (it.isFocused) onOverlayInteracted()+ }) {Row(modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),@@ -540,6 +676,7 @@ fun ChannelListOverlay(.padding(vertical = 3.dp).onFocusChanged {if (it.isFocused) {+ onOverlayInteracted()onFocusedChannelChange(channel.id)scope.launch {val targetIndex = (index - 1).coerceAtLeast(0)@@ -554,7 +691,7 @@ fun ChannelListOverlay(scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),colors = ClickableSurfaceDefaults.colors(- containerColor = if (isSelected) Primary.copy(alpha = 0.25f) else AppColors.Surface.copy(alpha = 0.82f),+ containerColor = if (isSelected) Primary.copy(alpha = 0.20f) else AppColors.Surface.copy(alpha = 0.68f),focusedContainerColor = Primary)) {@@ -612,7 +749,8 @@ fun EpgOverlay(preferredFocusedProgramToken: Long? = null,onFocusedProgramChange: (Long) -> Unit = {},onDismiss: () -> Unit,- onPlayCatchUp: (Program) -> Unit+ onPlayCatchUp: (Program) -> Unit,+ onOverlayInteracted: () -> Unit = {}) {val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())val listState = rememberLazyListState()@@ -628,12 +766,12 @@ fun EpgOverlay(Box(modifier = Modifier.fillMaxSize()- .background(Color.Black.copy(alpha = 0.42f))+ .background(Color.Black.copy(alpha = 0.18f))) {PlayerOverlayPanel(modifier = Modifier.align(Alignment.CenterEnd)- .width(560.dp)+ .width(520.dp).padding(24.dp)) {androidx.compose.foundation.lazy.LazyColumn(@@ -644,7 +782,7 @@ fun EpgOverlay(item {Text(text = stringResource(R.string.epg_title),- style = MaterialTheme.typography.titleLarge,+ style = MaterialTheme.typography.titleMedium,color = Primary,fontWeight = FontWeight.Bold)@@ -769,6 +907,7 @@ fun EpgOverlay(Surface(onClick = {if (program.hasArchive || currentChannel?.catchUpSupported == true) {+ onOverlayInteracted()onPlayCatchUp(program)}},@@ -784,7 +923,10 @@ fun EpgOverlay(else Modifier).onFocusChanged {- if (it.isFocused) onFocusedProgramChange(focusToken)+ if (it.isFocused) {+ onOverlayInteracted()+ onFocusedProgramChange(focusToken)+ }}) {Column(modifier = Modifier.padding(12.dp)) {@@ -842,57 +984,70 @@ fun DiagnosticsOverlay(diagnostics: PlayerDiagnosticsUiState,modifier: Modifier = Modifier) {- PlayerOverlayPanel(modifier = modifier.width(420.dp)) {- Text(- text = stringResource(R.string.player_diagnostics_title),- color = Primary,- style = MaterialTheme.typography.titleMedium,- fontWeight = FontWeight.Bold- )- if (diagnostics.providerName.isNotBlank()) {- PlayerMetaRow(stringResource(R.string.player_diagnostics_provider), diagnostics.providerName)- }- if (diagnostics.providerSourceLabel.isNotBlank()) {- PlayerMetaRow(stringResource(R.string.player_diagnostics_source), diagnostics.providerSourceLabel)- }- PlayerMetaRow(stringResource(R.string.player_diagnostics_decoder), diagnostics.decoderMode.name)- PlayerMetaRow(stringResource(R.string.player_diagnostics_stream_class), diagnostics.streamClassLabel)- PlayerMetaRow(stringResource(R.string.player_diagnostics_playback_state), diagnostics.playbackStateLabel)- if (diagnostics.archiveSupportLabel.isNotBlank()) {- PlayerMetaRow(stringResource(R.string.player_diagnostics_archive), diagnostics.archiveSupportLabel)- }- PlayerMetaRow(stringResource(R.string.player_diagnostics_alternates), diagnostics.alternativeStreamCount.toString())- if (diagnostics.channelErrorCount > 0) {- PlayerMetaRow(stringResource(R.string.player_diagnostics_channel_errors), diagnostics.channelErrorCount.toString())- }- PlayerMetaRow(stringResource(R.string.player_diagnostics_resolution), "${stats.width}x${stats.height}")- PlayerMetaRow(stringResource(R.string.player_diagnostics_video_codec), stats.videoCodec)- PlayerMetaRow(stringResource(R.string.player_diagnostics_audio_codec), stats.audioCodec)- PlayerMetaRow(stringResource(R.string.player_diagnostics_video_bitrate), "${stats.videoBitrate / 1000} kbps")- PlayerMetaRow(stringResource(R.string.player_diagnostics_dropped_frames), stats.droppedFrames.toString())- diagnostics.lastFailureReason?.let { reason ->- PlayerMetaRow(stringResource(R.string.player_diagnostics_last_failure), reason)- }- if (diagnostics.recentRecoveryActions.isNotEmpty()) {+ PlayerOverlayPanel(modifier = modifier.width(380.dp)) {+ Column(+ modifier = Modifier+ .heightIn(max = 420.dp)+ .fillMaxWidth()+ .verticalScroll(rememberScrollState()),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {Text(- text = stringResource(R.string.player_diagnostics_recovery_actions),+ text = stringResource(R.string.player_diagnostics_title),color = Primary,- style = MaterialTheme.typography.labelMedium,+ style = MaterialTheme.typography.titleSmall,fontWeight = FontWeight.Bold)- diagnostics.recentRecoveryActions.forEach { action ->- Text(action, color = AppColors.TextSecondary, style = MaterialTheme.typography.bodySmall)+ PlayerOverlaySectionLabel(stringResource(R.string.player_diagnostics_section_source))+ if (diagnostics.providerName.isNotBlank()) {+ PlayerMetaRow(stringResource(R.string.player_diagnostics_provider), diagnostics.providerName)}- }- if (diagnostics.troubleshootingHints.isNotEmpty()) {- Text(- text = stringResource(R.string.player_diagnostics_troubleshooting),- color = Primary,- style = MaterialTheme.typography.labelMedium,- fontWeight = FontWeight.Bold- )- diagnostics.troubleshootingHints.forEach { hint ->- Text(hint, color = AppColors.TextSecondary, style = MaterialTheme.typography.bodySmall)+ if (diagnostics.providerSourceLabel.isNotBlank()) {+ PlayerMetaRow(stringResource(R.string.player_diagnostics_source), diagnostics.providerSourceLabel)+ }+ PlayerOverlaySectionLabel(stringResource(R.string.player_diagnostics_section_playback))+ PlayerMetaRow(stringResource(R.string.player_diagnostics_decoder), diagnostics.decoderMode.name)+ PlayerMetaRow(stringResource(R.string.player_diagnostics_stream_class), diagnostics.streamClassLabel)+ PlayerMetaRow(stringResource(R.string.player_diagnostics_playback_state), diagnostics.playbackStateLabel)+ if (diagnostics.archiveSupportLabel.isNotBlank()) {+ PlayerMetaRow(stringResource(R.string.player_diagnostics_archive), diagnostics.archiveSupportLabel)+ }+ PlayerMetaRow(stringResource(R.string.player_diagnostics_alternates), diagnostics.alternativeStreamCount.toString())+ if (diagnostics.channelErrorCount > 0) {+ PlayerMetaRow(stringResource(R.string.player_diagnostics_channel_errors), diagnostics.channelErrorCount.toString())+ }+ PlayerOverlaySectionLabel(stringResource(R.string.player_diagnostics_section_video))+ PlayerMetaRow(stringResource(R.string.player_diagnostics_resolution), "${stats.width}x${stats.height}")+ PlayerMetaRow(stringResource(R.string.player_diagnostics_video_codec), stats.videoCodec)+ PlayerMetaRow(stringResource(R.string.player_diagnostics_video_bitrate), "${stats.videoBitrate / 1000} kbps")+ PlayerMetaRow(stringResource(R.string.player_diagnostics_dropped_frames), stats.droppedFrames.toString())+ PlayerOverlaySectionLabel(stringResource(R.string.player_diagnostics_section_audio))+ PlayerMetaRow(stringResource(R.string.player_diagnostics_audio_codec), stats.audioCodec)+ PlayerOverlaySectionLabel(stringResource(R.string.player_diagnostics_section_recovery))+ diagnostics.lastFailureReason?.let { reason ->+ PlayerMetaRow(stringResource(R.string.player_diagnostics_last_failure), reason)+ }+ if (diagnostics.recentRecoveryActions.isNotEmpty()) {+ Text(+ text = stringResource(R.string.player_diagnostics_recovery_actions),+ color = Primary,+ style = MaterialTheme.typography.labelSmall,+ fontWeight = FontWeight.Bold+ )+ diagnostics.recentRecoveryActions.forEach { action ->+ Text(action, color = AppColors.TextSecondary, style = MaterialTheme.typography.labelSmall)+ }+ }+ if (diagnostics.troubleshootingHints.isNotEmpty()) {+ Text(+ text = stringResource(R.string.player_diagnostics_troubleshooting),+ color = Primary,+ style = MaterialTheme.typography.labelSmall,+ fontWeight = FontWeight.Bold+ )+ diagnostics.troubleshootingHints.forEach { hint ->+ Text(hint, color = AppColors.TextSecondary, style = MaterialTheme.typography.labelSmall)+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.ktindex c0909414..8d312e63 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt@@ -6,6 +6,7 @@ import androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.borderimport androidx.compose.foundation.clickable+import androidx.compose.foundation.focusableimport androidx.compose.foundation.layout.*import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.CircularProgressIndicator@@ -21,6 +22,7 @@ import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.input.key.onPreviewKeyEvent+import androidx.compose.ui.focus.onFocusEventimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.input.PasswordVisualTransformationimport androidx.compose.ui.text.input.VisualTransformation@@ -306,6 +308,7 @@ fun ProviderSetupScreen(onValueChange = { name = it },label = stringResource(R.string.setup_name_hint),focusRequester = providerNameFocusRequester,+ onMoveUp = { false },onMoveDown = {if (selectedTab == 1) {if (uiState.m3uTab == 0) {@@ -313,6 +316,9 @@ fun ProviderSetupScreen(} else {m3uFileTabFocusRequester.requestFocus()}+ true+ } else {+ false // Let system find next item (Server URL)}})@@ -361,8 +367,14 @@ fun ProviderSetupScreen(onClick = { viewModel.updateM3uTab(0) },onFocused = { viewModel.updateM3uTab(0) },focusRequester = m3uUrlTabFocusRequester,- onMoveUp = { providerNameFocusRequester.requestFocus() },- onMoveDown = { m3uValueFocusRequester.requestFocus() }+ onMoveUp = {+ providerNameFocusRequester.requestFocus()+ true+ },+ onMoveDown = {+ m3uValueFocusRequester.requestFocus()+ true+ })TabButton(text = stringResource(R.string.setup_tab_file),@@ -370,8 +382,14 @@ fun ProviderSetupScreen(onClick = { viewModel.updateM3uTab(1) },onFocused = { viewModel.updateM3uTab(1) },focusRequester = m3uFileTabFocusRequester,- onMoveUp = { providerNameFocusRequester.requestFocus() },- onMoveDown = { m3uValueFocusRequester.requestFocus() }+ onMoveUp = {+ providerNameFocusRequester.requestFocus()+ true+ },+ onMoveDown = {+ m3uValueFocusRequester.requestFocus()+ true+ })}@@ -381,8 +399,14 @@ fun ProviderSetupScreen(onValueChange = { m3uUrl = it },label = stringResource(R.string.setup_m3u_hint),focusRequester = m3uValueFocusRequester,- onMoveUp = { m3uUrlTabFocusRequester.requestFocus() },- onMoveDown = { m3uSubmitFocusRequester.requestFocus() }+ onMoveUp = {+ m3uUrlTabFocusRequester.requestFocus()+ true+ },+ onMoveDown = {+ m3uSubmitFocusRequester.requestFocus()+ true+ })} else {FileSelectorCard(@@ -396,8 +420,14 @@ fun ProviderSetupScreen(emptySelectionHint = stringResource(R.string.setup_file_browse_hint),onClick = { filePickerLauncher.launch(arrayOf("*/*")) },focusRequester = m3uValueFocusRequester,- onMoveUp = { m3uFileTabFocusRequester.requestFocus() },- onMoveDown = { m3uSubmitFocusRequester.requestFocus() }+ onMoveUp = {+ m3uFileTabFocusRequester.requestFocus()+ true+ },+ onMoveDown = {+ m3uSubmitFocusRequester.requestFocus()+ true+ })fileImportError?.let { importError ->@@ -420,7 +450,10 @@ fun ProviderSetupScreen(enabled = !uiState.isLoading,onClick = { viewModel.addM3u(m3uUrl, name) },focusRequester = m3uSubmitFocusRequester,- onMoveUp = { m3uValueFocusRequester.requestFocus() }+ onMoveUp = {+ m3uValueFocusRequester.requestFocus()+ true+ })}}@@ -506,8 +539,8 @@ private fun TvTextField(isPassword: Boolean = false,modifier: Modifier = Modifier,focusRequester: FocusRequester? = null,- onMoveUp: (() -> Unit)? = null,- onMoveDown: (() -> Unit)? = null+ onMoveUp: (() -> Boolean)? = null,+ onMoveDown: (() -> Boolean)? = null) {var isFocused by remember { mutableStateOf(false) }val internalFocusRequester = focusRequester ?: remember { FocusRequester() }@@ -516,13 +549,38 @@ private fun TvTextField(val bgColor = if (isFocused) Surface else SurfaceElevatedval borderWidth = if (isFocused) 2.dp else 1.dp- // Use Box instead of TV Surface so key events (paste, etc.) reach BasicTextField+ // Use Box as the focusable container (Mode 1: Highlighted)+ // BasicTextField will be Mode 2 (Edit Mode)Box(modifier = modifier.fillMaxWidth().height(52.dp).background(bgColor, RoundedCornerShape(8.dp)).border(borderWidth, borderColor, RoundedCornerShape(8.dp))+ .onFocusEvent { isFocused = it.isFocused }+ .focusRequester(internalFocusRequester)+ .focusable() // Make the container focusable+ .onPreviewKeyEvent { event ->+ if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {+ when (event.nativeKeyEvent.keyCode) {+ android.view.KeyEvent.KEYCODE_DPAD_UP -> {+ onMoveUp?.invoke() ?: false+ }+ android.view.KeyEvent.KEYCODE_DPAD_DOWN -> {+ onMoveDown?.invoke() ?: false+ }+ android.view.KeyEvent.KEYCODE_ENTER,+ android.view.KeyEvent.KEYCODE_NUMPAD_ENTER,+ android.view.KeyEvent.KEYCODE_DPAD_CENTER -> {+ // Click to enter edit mode (Mode 2)+ // In a real TV app, you might show a keyboard dialog here+ // For now, we just let the click reach the child if needed+ false+ }+ else -> false+ }+ } else false+ }.clickable { internalFocusRequester.requestFocus() }.padding(horizontal = 16.dp),contentAlignment = Alignment.CenterStart@@ -539,25 +597,7 @@ private fun TvTextField(androidx.compose.foundation.text.BasicTextField(value = value,onValueChange = onValueChange,- modifier = Modifier- .fillMaxWidth()- .focusRequester(internalFocusRequester)- .onFocusChanged { isFocused = it.isFocused }- .onPreviewKeyEvent { event ->- if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {- when (event.nativeKeyEvent.keyCode) {- android.view.KeyEvent.KEYCODE_DPAD_UP -> {- onMoveUp?.invoke()- onMoveUp != null- }- android.view.KeyEvent.KEYCODE_DPAD_DOWN -> {- onMoveDown?.invoke()- onMoveDown != null- }- else -> false- }- } else false- },+ modifier = Modifier.fillMaxWidth(),textStyle = MaterialTheme.typography.bodySmall.copy(color = OnBackground),singleLine = true,visualTransformation = if (isPassword) PasswordVisualTransformation() else VisualTransformation.None,@@ -572,7 +612,7 @@ private fun ActionButton(enabled: Boolean,onClick: () -> Unit,focusRequester: FocusRequester? = null,- onMoveUp: (() -> Unit)? = null+ onMoveUp: (() -> Boolean)? = null) {var isFocused by remember { mutableStateOf(false) }val internalFocusRequester = focusRequester ?: remember { FocusRequester() }@@ -597,7 +637,6 @@ private fun ActionButton(onMoveUp != null) {onMoveUp()- true} else false},shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),@@ -628,8 +667,8 @@ private fun FileSelectorCard(emptySelectionHint: String,onClick: () -> Unit,focusRequester: FocusRequester? = null,- onMoveUp: (() -> Unit)? = null,- onMoveDown: (() -> Unit)? = null+ onMoveUp: (() -> Boolean)? = null,+ onMoveDown: (() -> Boolean)? = null) {var isFocused by remember { mutableStateOf(false) }val internalFocusRequester = focusRequester ?: remember { FocusRequester() }@@ -649,12 +688,10 @@ private fun FileSelectorCard(if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {when (event.nativeKeyEvent.keyCode) {android.view.KeyEvent.KEYCODE_DPAD_UP -> {- onMoveUp?.invoke()- onMoveUp != null+ onMoveUp?.invoke() ?: false}android.view.KeyEvent.KEYCODE_DPAD_DOWN -> {- onMoveDown?.invoke()- onMoveDown != null+ onMoveDown?.invoke() ?: false}else -> false}@@ -710,8 +747,8 @@ private fun TabButton(onClick: () -> Unit,onFocused: (() -> Unit)? = null,focusRequester: FocusRequester? = null,- onMoveUp: (() -> Unit)? = null,- onMoveDown: (() -> Unit)? = null+ onMoveUp: (() -> Boolean)? = null,+ onMoveDown: (() -> Boolean)? = null) {var isFocused by remember { mutableStateOf(false) }val internalFocusRequester = focusRequester ?: remember { FocusRequester() }@@ -728,12 +765,10 @@ private fun TabButton(if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {when (event.nativeKeyEvent.keyCode) {android.view.KeyEvent.KEYCODE_DPAD_UP -> {- onMoveUp?.invoke()- onMoveUp != null+ onMoveUp?.invoke() ?: false}android.view.KeyEvent.KEYCODE_DPAD_DOWN -> {- onMoveDown?.invoke()- onMoveDown != null+ onMoveDown?.invoke() ?: false}else -> false}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.ktindex 8cdff313..47a29e36 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt@@ -3,6 +3,7 @@ package com.streamvault.app.ui.screens.seriesimport androidx.activity.compose.BackHandlerimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.grid.LazyVerticalGridimport androidx.compose.foundation.lazy.grid.GridCells@@ -45,6 +46,7 @@ import com.streamvault.app.ui.components.SelectionChipRowimport com.streamvault.app.ui.components.SeriesCardimport com.streamvault.app.ui.components.SkeletonRowimport com.streamvault.app.ui.theme.*+import com.streamvault.domain.model.Seriesimport kotlinx.coroutines.launchimport androidx.compose.ui.res.stringResourceimport com.streamvault.app.R@@ -61,6 +63,12 @@ import com.streamvault.app.ui.components.shell.LoadMoreCardimport com.streamvault.app.ui.components.shell.AppNavigationChromeimport com.streamvault.app.ui.components.shell.AppMessageStateimport com.streamvault.app.ui.components.shell.AppScreenScaffold+import com.streamvault.app.ui.components.shell.VodActionChip+import com.streamvault.app.ui.components.shell.VodActionChipRow+import com.streamvault.app.ui.components.shell.VodCategoryOption+import com.streamvault.app.ui.components.shell.VodCategoryPickerDialog+import com.streamvault.app.ui.components.shell.VodHeroStrip+import com.streamvault.app.ui.components.shell.VodSectionHeader@OptIn(ExperimentalFoundationApi::class)@Composable@@ -153,6 +161,25 @@ fun SeriesScreen()}} else {+ SeriesVodContent(+ uiState = uiState,+ selectedFacet = selectedFacet,+ onSelectedFacetChange = { selectedFacet = it },+ selectedSort = selectedSort,+ onSelectedSortChange = { selectedSort = it },+ onNavigate = onNavigate,+ onSeriesClick = onSeriesClick,+ onProtectedSeriesClick = { seriesId ->+ pendingSeriesId = seriesId+ showPinDialog = true+ },+ onShowDialog = viewModel::onShowDialog,+ onSelectCategory = viewModel::selectCategory,+ onSelectFullLibraryBrowse = viewModel::selectFullLibraryBrowse,+ onLoadMore = viewModel::loadMoreSelectedCategory,+ onDismissReorder = viewModel::exitCategoryReorderMode+ )+ return@AppScreenScaffoldRow(modifier = Modifier.fillMaxSize()) {// Category sidebarval categorySearchFocusRequester = remember { FocusRequester() }@@ -843,6 +870,396 @@ private enum class SeriesLibraryFacet {TOP_RATED}+@Composable+private fun SeriesVodContent(+ uiState: SeriesUiState,+ selectedFacet: String,+ onSelectedFacetChange: (String) -> Unit,+ selectedSort: String,+ onSelectedSortChange: (String) -> Unit,+ onNavigate: (String) -> Unit,+ onSeriesClick: (Long) -> Unit,+ onProtectedSeriesClick: (Long) -> Unit,+ onShowDialog: (Series) -> Unit,+ onSelectCategory: (String?) -> Unit,+ onSelectFullLibraryBrowse: () -> Unit,+ onLoadMore: () -> Unit,+ onDismissReorder: () -> Unit+) {+ var showCategoryPicker by remember { mutableStateOf(false) }+ val favoriteSeries = uiState.seriesByCategory[uiState.favoriteCategoryName].orEmpty()+ val freshSeries = uiState.libraryLensRows[SeriesLibraryLens.FRESH].orEmpty()+ val topRatedSeries = uiState.libraryLensRows[SeriesLibraryLens.TOP_RATED].orEmpty()+ val continueWatching = uiState.continueWatching+ val heroSeries = freshSeries.firstOrNull() ?: topRatedSeries.firstOrNull() ?: favoriteSeries.firstOrNull()+ val categoryOptions = remember(uiState.categoryNames, uiState.categoryCounts) {+ uiState.categoryNames.map { name ->+ VodCategoryOption(+ name = name,+ count = uiState.categoryCounts[name] ?: 0,+ onClick = { onSelectCategory(name) }+ )+ }+ }++ if (showCategoryPicker) {+ VodCategoryPickerDialog(+ title = stringResource(R.string.vod_category_picker_title),+ subtitle = stringResource(R.string.vod_category_picker_subtitle),+ categories = categoryOptions,+ onDismiss = { showCategoryPicker = false }+ )+ }++ if (uiState.selectedCategory == null) {+ androidx.compose.foundation.lazy.LazyColumn(+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(bottom = 28.dp)+ ) {+ if (heroSeries != null) {+ item("hero") {+ VodHeroStrip(+ title = heroSeries.name,+ subtitle = heroSeries.plot?.takeIf { it.isNotBlank() }+ ?: heroSeries.genre+ ?: stringResource(R.string.series_library_lens_subtitle),+ actionLabel = stringResource(R.string.player_resume).substringBefore(" "),+ onClick = {+ val isLocked = (heroSeries.isAdult || heroSeries.isUserProtected) && uiState.parentalControlLevel == 1+ if (isLocked) onProtectedSeriesClick(heroSeries.id) else onSeriesClick(heroSeries.id)+ },+ modifier = Modifier.padding(top = 8.dp, bottom = 6.dp)+ )+ }+ }++ item("actions") {+ VodActionChipRow(+ actions = buildList {+ add(+ VodActionChip(+ key = "browse_all",+ label = stringResource(R.string.library_full_browse_title_series),+ detail = stringResource(R.string.library_full_browse_subtitle, uiState.libraryCount),+ onClick = onSelectFullLibraryBrowse+ )+ )+ add(+ VodActionChip(+ key = "categories",+ label = stringResource(R.string.series_categories_title),+ detail = "${uiState.categoryNames.size} groups",+ onClick = { showCategoryPicker = true }+ )+ )+ if (favoriteSeries.isNotEmpty()) {+ add(+ VodActionChip(+ key = "favorites",+ label = stringResource(R.string.favorites_title),+ detail = stringResource(R.string.library_saved_items_count, favoriteSeries.size),+ onClick = { onSelectCategory(uiState.favoriteCategoryName) }+ )+ )+ }+ if (continueWatching.isNotEmpty()) {+ add(+ VodActionChip(+ key = "resume",+ label = stringResource(R.string.library_lens_continue),+ detail = "${continueWatching.size} items",+ onClick = { }+ )+ )+ }+ if (topRatedSeries.isNotEmpty()) {+ add(+ VodActionChip(+ key = SeriesLibraryLens.TOP_RATED.name,+ label = stringResource(R.string.library_lens_top_rated),+ detail = "${topRatedSeries.size} picks",+ onClick = { }+ )+ )+ }+ if (freshSeries.isNotEmpty()) {+ add(+ VodActionChip(+ key = SeriesLibraryLens.FRESH.name,+ label = stringResource(R.string.library_lens_fresh_series),+ detail = "${freshSeries.size} picks",+ onClick = { }+ )+ )+ }+ },+ modifier = Modifier.padding(top = 2.dp, bottom = 6.dp)+ )+ }++ if (continueWatching.isNotEmpty()) {+ item("continue") {+ ContinueWatchingRow(+ items = continueWatching,+ onItemClick = { history -> onSeriesClick(history.seriesId ?: history.contentId) }+ )+ }+ }++ if (favoriteSeries.isNotEmpty()) {+ item("favorites_header") {+ VodSectionHeader(+ title = stringResource(R.string.favorites_title),+ onSeeAll = { onSelectCategory(uiState.favoriteCategoryName) }+ )+ }+ item("favorites_row") {+ LazyRow(+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ items(favoriteSeries, key = { it.id }) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ SeriesCard(+ series = series,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedSeriesClick(series.id) else onSeriesClick(series.id) },+ onLongClick = { onShowDialog(series) },+ modifier = Modifier.width(160.dp)+ )+ }+ }+ }+ }++ if (freshSeries.isNotEmpty()) {+ item("fresh_header") {+ VodSectionHeader(title = stringResource(R.string.library_lens_fresh_series))+ }+ item("fresh_row") {+ CategoryRow(+ title = "",+ items = freshSeries,+ onSeeAll = null+ ) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ SeriesCard(+ series = series,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedSeriesClick(series.id) else onSeriesClick(series.id) },+ onLongClick = { onShowDialog(series) }+ )+ }+ }+ }++ if (topRatedSeries.isNotEmpty()) {+ item("top_header") {+ VodSectionHeader(title = stringResource(R.string.library_lens_top_rated))+ }+ item("top_row") {+ CategoryRow(+ title = "",+ items = topRatedSeries,+ onSeeAll = null+ ) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ SeriesCard(+ series = series,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedSeriesClick(series.id) else onSeriesClick(series.id) },+ onLongClick = { onShowDialog(series) }+ )+ }+ }+ }++ items(+ items = uiState.seriesByCategory.entries.filter { (name, items) ->+ name != uiState.favoriteCategoryName && items.isNotEmpty()+ }.take(8),+ key = { it.key }+ ) { (categoryName, seriesList) ->+ VodSectionHeader(+ title = categoryName,+ onSeeAll = { onSelectCategory(categoryName) }+ )+ CategoryRow(+ title = "",+ items = seriesList,+ onSeeAll = null+ ) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ SeriesCard(+ series = series,+ isLocked = isLocked,+ onClick = { if (isLocked) onProtectedSeriesClick(series.id) else onSeriesClick(series.id) },+ onLongClick = { onShowDialog(series) }+ )+ }+ }+ }+ return+ }++ val baseSeries = uiState.selectedCategoryItems+ val resumeSeriesIds = remember(uiState.continueWatching) {+ uiState.continueWatching.mapNotNull { it.seriesId ?: it.contentId }.toSet()+ }+ val activeFacet = remember(selectedFacet) {+ SeriesLibraryFacet.entries.firstOrNull { it.name == selectedFacet } ?: SeriesLibraryFacet.ALL+ }+ val activeSort = remember(selectedSort) {+ SeriesLibrarySort.entries.firstOrNull { it.name == selectedSort } ?: SeriesLibrarySort.LIBRARY+ }+ val filteredGridSeries = remember(baseSeries, activeFacet, activeSort, resumeSeriesIds, uiState.isReorderMode, uiState.filteredSeries) {+ val source = if (uiState.isReorderMode) uiState.filteredSeries else baseSeries+ if (uiState.isReorderMode) source else applySeriesFacetAndSort(+ items = source,+ facet = activeFacet,+ sort = activeSort,+ resumeSeriesIds = resumeSeriesIds+ )+ }+ var draggingSeries by remember { mutableStateOf<Series?>(null) }++ Column(modifier = Modifier.fillMaxSize()) {+ VodActionChipRow(+ actions = buildList {+ add(+ VodActionChip(+ key = "back_home",+ label = stringResource(R.string.nav_series),+ detail = stringResource(R.string.category_see_all),+ onClick = { onSelectCategory(null) }+ )+ )+ add(+ VodActionChip(+ key = uiState.fullLibraryCategoryName,+ label = stringResource(R.string.library_full_browse_title_series),+ detail = "${uiState.libraryCount} titles",+ onClick = onSelectFullLibraryBrowse+ )+ )+ add(+ VodActionChip(+ key = "categories",+ label = stringResource(R.string.series_categories_title),+ detail = "${uiState.categoryNames.size} groups",+ onClick = { showCategoryPicker = true }+ )+ )+ if (uiState.selectedCategory != uiState.fullLibraryCategoryName) {+ add(+ VodActionChip(+ key = uiState.selectedCategory ?: "",+ label = uiState.selectedCategory ?: stringResource(R.string.nav_series),+ detail = "${uiState.selectedCategoryTotalCount} titles",+ onClick = { }+ )+ )+ }+ },+ selectedKey = uiState.selectedCategory,+ modifier = Modifier.padding(vertical = 8.dp)+ )++ if (!uiState.isReorderMode) {+ SelectionChipRow(+ title = stringResource(R.string.library_filter_title),+ chips = buildSeriesFacetChips(baseSeries, resumeSeriesIds),+ selectedKey = activeFacet.name,+ onChipSelected = onSelectedFacetChange,+ modifier = Modifier.padding(horizontal = 16.dp),+ contentPadding = PaddingValues(horizontal = 4.dp)+ )+ SelectionChipRow(+ title = stringResource(R.string.library_sort_title),+ chips = SeriesLibrarySort.entries.map { sort ->+ SelectionChip(+ key = sort.name,+ label = when (sort) {+ SeriesLibrarySort.LIBRARY -> stringResource(R.string.library_sort_library)+ SeriesLibrarySort.TITLE -> stringResource(R.string.library_sort_az)+ SeriesLibrarySort.UPDATED -> stringResource(R.string.library_sort_updated)+ SeriesLibrarySort.RATING -> stringResource(R.string.library_sort_rating)+ }+ )+ },+ selectedKey = activeSort.name,+ onChipSelected = onSelectedSortChange,+ modifier = Modifier.padding(horizontal = 16.dp),+ contentPadding = PaddingValues(horizontal = 4.dp)+ )+ }++ LazyVerticalGrid(+ columns = GridCells.Adaptive(minSize = 148.dp),+ modifier = Modifier+ .fillMaxSize()+ .onPreviewKeyEvent { event ->+ if (uiState.isReorderMode && event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN) {+ if (event.nativeKeyEvent.keyCode == android.view.KeyEvent.KEYCODE_BACK) {+ draggingSeries = null+ onDismissReorder()+ true+ } else false+ } else false+ },+ contentPadding = PaddingValues(horizontal = 20.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ VodSectionHeader(+ title = when (uiState.selectedCategory) {+ uiState.fullLibraryCategoryName -> stringResource(R.string.library_full_browse_title_series)+ else -> uiState.selectedCategory ?: stringResource(R.string.nav_series)+ }+ )+ }++ gridItems(filteredGridSeries, key = { it.id }) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ val isDraggingThis = draggingSeries == series+ SeriesCard(+ series = series,+ isLocked = isLocked,+ isReorderMode = uiState.isReorderMode,+ isDragging = isDraggingThis,+ onClick = {+ if (uiState.isReorderMode) {+ draggingSeries = if (isDraggingThis) null else series+ } else if (isLocked) {+ onProtectedSeriesClick(series.id)+ } else {+ onSeriesClick(series.id)+ }+ },+ onLongClick = {+ if (!uiState.isReorderMode) onShowDialog(series)+ }+ )+ }++ if (!uiState.isReorderMode && uiState.canLoadMoreSelectedCategory) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ LoadMoreCard(+ label = stringResource(+ R.string.library_load_more,+ uiState.selectedCategoryLoadedCount,+ uiState.selectedCategoryTotalCount+ ),+ onClick = onLoadMore,+ modifier = Modifier.padding(top = 8.dp, bottom = 24.dp)+ )+ }+ }+ }+ }+}+private enum class SeriesLibrarySort {LIBRARY,TITLE,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.ktindex 89a9ac38..fa56d1ed 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreen.kt@@ -1,16 +1,19 @@-package com.streamvault.app.ui.screens.settings+package com.streamvault.app.ui.screens.settingsimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.borderimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.*+import androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.platform.LocalUriHandlerimport androidx.compose.ui.unit.dpimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.tv.material3.*@@ -80,6 +83,7 @@ fun SettingsScreen(var showPinDialog by remember { mutableStateOf(false) }var showLevelDialog by remember { mutableStateOf(false) }var showLanguageDialog by remember { mutableStateOf(false) }+ var showClearHistoryDialog by remember { mutableStateOf(false) }var pinError by remember { mutableStateOf<String?>(null) }var pendingAction by remember { mutableStateOf<ParentalAction?>(null) }@@ -95,7 +99,7 @@ fun SettingsScreen(uri?.let { viewModel.inspectBackup(it.toString()) }}-+ val uriHandler = LocalUriHandler.currentLaunchedEffect(uiState.userMessage) {uiState.userMessage?.let { message ->@@ -116,7 +120,7 @@ fun SettingsScreen() {LazyColumn(modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(start = 8.dp, end = 8.dp, bottom = 32.dp),+ contentPadding = PaddingValues(start = 8.dp, top = 80.dp, end = 8.dp, bottom = 32.dp),verticalArrangement = Arrangement.spacedBy(16.dp),userScrollEnabled = !uiState.isSyncing) {@@ -139,25 +143,55 @@ fun SettingsScreen()}} else {- items(uiState.providers, key = { it.id }) { provider ->- ProviderSettingsCard(- provider = provider,- isActive = provider.id == uiState.activeProviderId,- isSyncing = uiState.isSyncing,- diagnostics = uiState.diagnosticsByProvider[provider.id],- syncWarnings = uiState.syncWarningsByProvider[provider.id].orEmpty(),- onRetryWarningAction = { action -> viewModel.retryWarningAction(provider.id, action) },- onConnect = { viewModel.setActiveProvider(provider.id) },- onRefresh = { viewModel.refreshProvider(provider.id) },- onDelete = { viewModel.deleteProvider(provider.id) },- onEdit = { onEditProvider(provider) },- onParentalControl = { onNavigateToParentalControl(provider.id) }- )- }+ item {+ var selectedProviderId by rememberSaveable(uiState.providers, uiState.activeProviderId) {+ mutableStateOf(uiState.activeProviderId ?: uiState.providers.first().id)+ }+ LaunchedEffect(uiState.providers, uiState.activeProviderId) {+ val availableIds = uiState.providers.map { it.id }.toSet()+ if (selectedProviderId !in availableIds) {+ selectedProviderId = uiState.activeProviderId ?: uiState.providers.first().id+ }+ }+ val selectedProvider = uiState.providers.firstOrNull { it.id == selectedProviderId }+ ?: uiState.providers.first()+ Text(+ text = stringResource(R.string.settings_provider_selector_hint),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ modifier = Modifier.padding(bottom = 10.dp)+ )+ LazyRow(+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ contentPadding = PaddingValues(bottom = 14.dp)+ ) {+ items(uiState.providers, key = { it.id }) { provider ->+ ProviderSelectorTab(+ provider = provider,+ isSelected = provider.id == selectedProvider.id,+ isActive = provider.id == uiState.activeProviderId,+ onClick = { selectedProviderId = provider.id }+ )+ }+ }+ ProviderSettingsCard(+ provider = selectedProvider,+ isActive = selectedProvider.id == uiState.activeProviderId,+ isSyncing = uiState.isSyncing,+ diagnostics = uiState.diagnosticsByProvider[selectedProvider.id],+ syncWarnings = uiState.syncWarningsByProvider[selectedProvider.id].orEmpty(),+ onRetryWarningAction = { action -> viewModel.retryWarningAction(selectedProvider.id, action) },+ onConnect = { viewModel.setActiveProvider(selectedProvider.id) },+ onRefresh = { viewModel.refreshProvider(selectedProvider.id) },+ onDelete = { viewModel.deleteProvider(selectedProvider.id) },+ onEdit = { onEditProvider(selectedProvider) },+ onParentalControl = { onNavigateToParentalControl(selectedProvider.id) }+ )+ }}// Add Provider button@@ -318,13 +352,22 @@ fun SettingsScreen(if (uiState.recordingItems.isEmpty()) {item {- TvEmptyState(- title = stringResource(R.string.settings_recording_empty_title),- subtitle = stringResource(R.string.settings_recording_empty_subtitle),+ Surface(+ onClick = {},+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.1f)+ ),modifier = Modifier.fillMaxWidth().padding(top = 8.dp, bottom = 8.dp)- )+ ) {+ TvEmptyState(+ title = stringResource(R.string.settings_recording_empty_title),+ subtitle = stringResource(R.string.settings_recording_empty_subtitle)+ )+ }}} else {items(uiState.recordingItems, key = { it.id }) { item ->@@ -347,6 +390,90 @@ fun SettingsScreen(SettingsRow(label = stringResource(R.string.settings_buffer_duration), value = stringResource(R.string.settings_buffer_5s))}+ // Privacy section+ item {+ Spacer(Modifier.height(16.dp))+ SettingsSectionHeader(+ title = stringResource(R.string.settings_privacy),+ subtitle = stringResource(R.string.settings_privacy_subtitle)+ )++ Surface(+ onClick = { viewModel.toggleIncognitoMode() },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = Primary.copy(alpha = 0.2f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_incognito_mode),+ style = MaterialTheme.typography.bodyLarge,+ color = OnBackground+ )+ Text(+ text = stringResource(R.string.settings_incognito_mode_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = OnBackground.copy(alpha = 0.6f)+ )+ }+ Switch(+ checked = uiState.isIncognitoMode,+ onCheckedChange = { viewModel.toggleIncognitoMode() }+ )+ }+ }++ Spacer(Modifier.height(8.dp))++ Surface(+ onClick = { showClearHistoryDialog = true },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = Primary.copy(alpha = 0.2f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(16.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = stringResource(R.string.settings_clear_history),+ style = MaterialTheme.typography.bodyLarge,+ color = OnBackground+ )+ Text(+ text = stringResource(R.string.settings_clear_history_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = OnBackground.copy(alpha = 0.6f)+ )+ }+ Text(+ text = stringResource(R.string.settings_clear_history_confirm),+ style = MaterialTheme.typography.labelLarge,+ color = Primary+ )+ }+ }+ }+// About sectionitem {Spacer(Modifier.height(16.dp))@@ -357,6 +484,11 @@ fun SettingsScreen(SettingsRow(label = stringResource(R.string.settings_app_version), value = "1.0.0")SettingsRow(label = stringResource(R.string.settings_build), value = stringResource(R.string.settings_build_desc))SettingsRow(label = stringResource(R.string.settings_developed_by), value = stringResource(R.string.settings_developer_name))+ ClickableSettingsRow(+ label = stringResource(R.string.settings_github),+ value = stringResource(R.string.settings_github_url),+ onClick = { uriHandler.openUri(context.getString(R.string.settings_github_url)) }+ )}}}@@ -527,6 +659,32 @@ fun SettingsScreen(onConfirm = { viewModel.confirmBackupImport() })}++ if (showClearHistoryDialog) {+ androidx.compose.material3.AlertDialog(+ onDismissRequest = { showClearHistoryDialog = false },+ title = { Text(text = stringResource(R.string.settings_clear_history_dialog_title)) },+ text = { Text(text = stringResource(R.string.settings_clear_history_dialog_body)) },+ confirmButton = {+ TextButton(+ onClick = {+ viewModel.clearHistory()+ showClearHistoryDialog = false+ }+ ) {+ Text(text = stringResource(R.string.settings_clear_history_confirm), color = Primary)+ }+ },+ dismissButton = {+ TextButton(onClick = { showClearHistoryDialog = false }) {+ Text(text = stringResource(R.string.settings_cancel))+ }+ },+ containerColor = SurfaceElevated,+ titleContentColor = OnSurface,+ textContentColor = OnSurfaceVariant+ )+ }}}@@ -951,6 +1109,69 @@ private fun ProviderSettingsCard(}}+@Composable+private fun ProviderSelectorTab(+ provider: Provider,+ isSelected: Boolean,+ isActive: Boolean,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,+ focusedContainerColor = Primary.copy(alpha = 0.34f)+ ),+ border = ClickableSurfaceDefaults.border(+ border = Border(+ border = androidx.compose.foundation.BorderStroke(+ width = 1.dp,+ color = if (isSelected) Primary.copy(alpha = 0.45f) else Color.White.copy(alpha = 0.08f)+ )+ ),+ focusedBorder = Border(+ border = androidx.compose.foundation.BorderStroke(+ width = 2.dp,+ color = Primary+ )+ )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Text(+ text = provider.name,+ style = MaterialTheme.typography.labelLarge,+ color = OnBackground,+ fontWeight = FontWeight.Bold,+ maxLines = 1+ )+ Text(+ text = provider.type.name,+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim+ )+ }+ if (isActive) {+ Text(+ text = stringResource(R.string.settings_active),+ style = MaterialTheme.typography.labelSmall,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ }+ }+ }+}+@Composableprivate fun ProviderCompactStat(title: String,@@ -1211,14 +1432,51 @@ private fun SettingsSectionHeader(@Composableprivate fun SettingsRow(label: String, value: String) {- Row(- modifier = Modifier- .fillMaxWidth()- .padding(vertical = 8.dp),- horizontalArrangement = Arrangement.SpaceBetween+ Surface(+ onClick = {},+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.15f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 8.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(text = label, style = MaterialTheme.typography.bodyMedium, color = OnSurface)+ Text(text = value, style = MaterialTheme.typography.bodyMedium, color = OnBackground)+ }+ }+}++@Composable+private fun ClickableSettingsRow(label: String, value: String, onClick: () -> Unit) {+ Surface(+ onClick = onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.15f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()) {- Text(text = label, style = MaterialTheme.typography.bodyMedium, color = OnSurface)- Text(text = value, style = MaterialTheme.typography.bodyMedium, color = OnBackground)+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(text = label, style = MaterialTheme.typography.bodyMedium, color = OnSurface)+ Text(text = value, style = MaterialTheme.typography.bodyMedium, color = Primary)+ }}}@@ -1367,9 +1625,15 @@ private fun RecordingOverviewCard(scheduledCount: Int) {Surface(+ onClick = {},modifier = Modifier.fillMaxWidth(),- colors = SurfaceDefaults.colors(containerColor = SurfaceElevated),- shape = RoundedCornerShape(16.dp)+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = SurfaceElevated,+ focusedContentColor = OnBackground+ ),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1.02f)) {Column(modifier = Modifier.padding(20.dp),diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.ktindex d9c8b5ec..d2590c19 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt@@ -39,7 +39,8 @@ class SettingsViewModel @Inject constructor(private val backupManager: BackupManager,private val recordingManager: RecordingManager,private val syncManager: SyncManager,- private val syncMetadataRepository: SyncMetadataRepository+ private val syncMetadataRepository: SyncMetadataRepository,+ private val playbackHistoryRepository: com.streamvault.domain.repository.PlaybackHistoryRepository) : ViewModel() {private val _uiState = MutableStateFlow(SettingsUiState())@@ -51,9 +52,10 @@ class SettingsViewModel @Inject constructor(providerRepository.getProviders(),preferencesRepository.lastActiveProviderId,preferencesRepository.parentalControlLevel,- preferencesRepository.appLanguage- ) { providers, activeId, level, language ->- arrayOf(providers, activeId, level, language)+ preferencesRepository.appLanguage,+ preferencesRepository.isIncognitoMode+ ) { providers, activeId, level, language, incognito ->+ arrayOf(providers, activeId, level, language, incognito)}.collect { values ->@Suppress("UNCHECKED_CAST")_uiState.update {@@ -61,7 +63,8 @@ class SettingsViewModel @Inject constructor(providers = values[0] as List<Provider>,activeProviderId = values[1] as Long?,parentalControlLevel = values[2] as Int,- appLanguage = values[3] as String+ appLanguage = values[3] as String,+ isIncognitoMode = values[4] as Boolean)}}@@ -156,6 +159,22 @@ class SettingsViewModel @Inject constructor(}}+ fun toggleIncognitoMode() {+ viewModelScope.launch {+ val current = _uiState.value.isIncognitoMode+ preferencesRepository.setIncognitoMode(!current)+ }+ }++ fun clearHistory() {+ viewModelScope.launch {+ _uiState.update { it.copy(isSyncing = true) }+ playbackHistoryRepository.clearAllHistory()+ preferencesRepository.clearAllRecentData()+ _uiState.update { it.copy(isSyncing = false, userMessage = "Watch history and recents cleared") }+ }+ }+suspend fun verifyPin(pin: String): Boolean {return preferencesRepository.verifyParentalPin(pin)}@@ -415,5 +434,6 @@ data class SettingsUiState(val pendingBackupUri: String? = null,val backupImportPlan: BackupImportPlan = BackupImportPlan(),val recordingItems: List<RecordingItem> = emptyList(),- val recordingStorageState: RecordingStorageState = RecordingStorageState()+ val recordingStorageState: RecordingStorageState = RecordingStorageState(),+ val isIncognitoMode: Boolean = false)diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 7ebeb399..97ccb256 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -194,6 +194,10 @@<string name="library_saved_primary_hint">Return to the full library</string><string name="library_saved_manage_hint">Hold a saved group for options</string><string name="library_browse_all">Browse All</string>+ <string name="vod_category_picker_title">Browse categories</string>+ <string name="vod_category_picker_subtitle">Search by category name, then open the matching shelf.</string>+ <string name="vod_category_picker_search_placeholder">Search categories…</string>+ <string name="vod_category_picker_empty">No matching categories found.</string><string name="library_lens_title">Library Lens</string><string name="library_lens_favorites">Saved Favorites</string><string name="library_lens_continue">Continue Watching</string>@@ -218,6 +222,7 @@<string name="settings_no_providers">No providers configured</string><string name="settings_add_provider">Add Provider</string><string name="settings_providers_subtitle">Switch, sync, edit, and troubleshoot your IPTV sources.</string>+ <string name="settings_provider_selector_hint">Select a provider to view details and actions.</string><string name="settings_parental_control">Parental Control</string><string name="settings_parental_subtitle">Protect adult or sensitive content with TV-friendly controls.</string><string name="settings_parental_groups_title">Protected Groups</string>@@ -236,6 +241,8 @@<string name="settings_build_desc">StreamVault for Android TV</string><string name="settings_developed_by">Developed by</string><string name="settings_developer_name">David Nashash</string>+ <string name="settings_github">GitHub</string>+ <string name="settings_github_url">https://github.com/Davidona</string><string name="settings_syncing">Syncing data, please wait...</string><string name="settings_syncing_title">Syncing data...</string><string name="settings_syncing_subtitle">Please wait while your playlist is imported.</string>@@ -519,6 +526,7 @@<string name="player_stats">Stats</string><string name="player_minutes_remaining">%1$d min remaining</string><string name="player_action_playback">Playback</string>+ <string name="player_action_controls">Controls</string><string name="player_action_restart_short">Restart</string><string name="player_action_view">View</string><string name="player_action_group">Group</string>@@ -543,6 +551,12 @@<string name="player_diagnostics_last_failure">Last Failure</string><string name="player_diagnostics_recovery_actions">Recovery Actions</string><string name="player_diagnostics_troubleshooting">Troubleshooting</string>+ <string name="player_diagnostics_section_source">Source</string>+ <string name="player_diagnostics_section_playback">Playback</string>+ <string name="player_diagnostics_section_video">Video</string>+ <string name="player_diagnostics_section_audio">Audio</string>+ <string name="player_diagnostics_section_recovery">Recovery</string>+ <string name="player_no_guide_data">No guide data</string><string name="epg_loading">Loading TV guide...</string><string name="epg_error">Unable to load the TV guide right now.</string><string name="epg_no_provider">Add or activate a provider to view the TV guide.</string>@@ -699,4 +713,15 @@<string name="multiview_thermal_severe">Severe</string><string name="multiview_thermal_critical">Critical</string><string name="multiview_low_memory_warning">Memory pressure is high. Extra slots stay in standby until playback stabilizes.</string>++ <!-- Privacy -->+ <string name="settings_privacy">Privacy</string>+ <string name="settings_privacy_subtitle">Manage watch history and incognito mode.</string>+ <string name="settings_incognito_mode">Incognito Mode</string>+ <string name="settings_incognito_mode_subtitle">Don\'t save watch history or recently visited categories while active.</string>+ <string name="settings_clear_history">Clear Watch History</string>+ <string name="settings_clear_history_subtitle">Wipe all watch progress and recents for all providers.</string>+ <string name="settings_clear_history_confirm">Clear History</string>+ <string name="settings_clear_history_dialog_title">Clear Watch History?</string>+ <string name="settings_clear_history_dialog_body">This will permanently delete all watch history, continue watching progress, and last visited categories across all providers.</string></resources>diff --git a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.ktindex 42f42df7..53e1e4c7 100644--- a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt+++ b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt@@ -3,6 +3,7 @@ package com.streamvault.data.preferencesimport android.content.Contextimport androidx.datastore.core.DataStoreimport androidx.datastore.preferences.core.Preferences+import androidx.datastore.preferences.core.booleanPreferencesKeyimport androidx.datastore.preferences.core.editimport androidx.datastore.preferences.core.intPreferencesKeyimport androidx.datastore.preferences.core.longPreferencesKey@@ -49,6 +50,7 @@ class PreferencesRepository @Inject constructor(val MULTIVIEW_PRESET_2 = stringPreferencesKey("multiview_preset_2")val MULTIVIEW_PRESET_3 = stringPreferencesKey("multiview_preset_3")val MULTIVIEW_PERFORMANCE_MODE = stringPreferencesKey("multiview_performance_mode")+ val IS_INCOGNITO_MODE = booleanPreferencesKey("is_incognito_mode")}val lastActiveProviderId: Flow<Long?> = context.dataStore.data.map { preferences ->@@ -59,6 +61,10 @@ class PreferencesRepository @Inject constructor(preferences[PreferencesKeys.DEFAULT_VIEW_MODE]}+ val isIncognitoMode: Flow<Boolean> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.IS_INCOGNITO_MODE] ?: false+ }+val parentalControlLevel: Flow<Int> = context.dataStore.data.map { preferences ->preferences[PreferencesKeys.PARENTAL_CONTROL_LEVEL] ?: 1 // Default to 1 = LOCKED@@ -82,6 +88,12 @@ class PreferencesRepository @Inject constructor(}}+ suspend fun setIncognitoMode(enabled: Boolean) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.IS_INCOGNITO_MODE] = enabled+ }+ }+suspend fun setParentalPin(pin: String) {val salt = ByteArray(PIN_SALT_BYTES).also { SecureRandom().nextBytes(it) }val hash = hashPin(pin, salt)@@ -271,6 +283,19 @@ class PreferencesRepository @Inject constructor(}}+ suspend fun clearAllRecentData() {+ context.dataStore.edit { preferences ->+ val keysToRemove = preferences.asMap().keys.filter { key ->+ key.name.startsWith("last_live_category_id_") ||+ key.name.startsWith("aspect_ratio_") ||+ key.name == PreferencesKeys.DEFAULT_CATEGORY_ID.name+ }+ keysToRemove.forEach { key ->+ preferences.remove(key)+ }+ }+ }+private fun hashPin(pin: String, salt: ByteArray): String {val spec = PBEKeySpec(pin.toCharArray(), salt, PIN_HASH_ITERATIONS, PIN_HASH_KEY_BITS)val secret = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256").generateSecret(spec)diff --git a/data/src/main/java/com/streamvault/data/repository/PlaybackHistoryRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/PlaybackHistoryRepositoryImpl.ktindex bce18e4f..34d062cc 100644--- a/data/src/main/java/com/streamvault/data/repository/PlaybackHistoryRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/PlaybackHistoryRepositoryImpl.kt@@ -10,10 +10,13 @@ import kotlinx.coroutines.flow.Flowimport kotlinx.coroutines.flow.mapimport javax.inject.Injectimport javax.inject.Singleton+import kotlinx.coroutines.flow.first+import com.streamvault.data.preferences.PreferencesRepository@Singletonclass PlaybackHistoryRepositoryImpl @Inject constructor(- private val dao: PlaybackHistoryDao+ private val dao: PlaybackHistoryDao,+ private val preferencesRepository: PreferencesRepository) : PlaybackHistoryRepository {override fun getRecentlyWatched(limit: Int): Flow<List<PlaybackHistory>> {@@ -29,6 +32,8 @@ class PlaybackHistoryRepositoryImpl @Inject constructor(}override suspend fun recordPlayback(history: PlaybackHistory) {+ if (preferencesRepository.isIncognitoMode.first()) return+val existing = dao.get(history.contentId, history.contentType.name, history.providerId)val updatedHistory = history.copy(resumePositionMs = 0,@@ -40,6 +45,8 @@ class PlaybackHistoryRepositoryImpl @Inject constructor(}override suspend fun updateResumePosition(history: PlaybackHistory) {+ if (preferencesRepository.isIncognitoMode.first()) return+val existing = dao.get(history.contentId, history.contentType.name, history.providerId)// Resume ticks should not increment watch count on every update.diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex e720d1d2..feb577b6 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -127,6 +127,10 @@ class ProviderRepositoryImpl @Inject constructor(}is Result.Error -> {updateProviderSyncStatus(providerData.id, ProviderStatus.ERROR)+ if (existingProvider == null) {+ // Rollback: if this was a new provider and initial sync failed, don't leave it in the database+ providerDao.delete(providerData.id)+ }Result.error("Provider authenticated, but initial sync failed: ${syncResult.message}",syncResult.exception@@ -194,6 +198,10 @@ class ProviderRepositoryImpl @Inject constructor(}is Result.Error -> {updateProviderSyncStatus(providerData.id, ProviderStatus.ERROR)+ if (existingProvider == null) {+ // Rollback: if this was a new provider and initial sync failed, don't leave it in the database+ providerDao.delete(providerData.id)+ }Result.error("Playlist saved, but initial sync failed: ${syncResult.message}",syncResult.exception