StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Overhaul Android TV premium UI
Davidonad75bc329df5e
diff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 90d84bb8..4aa98da4 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -16,6 +16,7 @@ android {targetSdk = 35versionCode = 1versionName = "1.0.0"+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"}buildTypes {@@ -41,6 +42,10 @@ android {buildFeatures {compose = true}++ testOptions {+ animationsDisabled = true+ }}dependencies {@@ -55,6 +60,7 @@ dependencies {implementation(libs.compose.material3)implementation(libs.compose.ui.tooling.preview)debugImplementation(libs.compose.ui.tooling)+ debugImplementation("androidx.compose.ui:ui-test-manifest")// Compose TVimplementation(libs.compose.tv.foundation)@@ -106,4 +112,9 @@ dependencies {testImplementation(libs.truth)testImplementation(libs.coroutines.test)testImplementation(libs.mockito.kotlin)++ androidTestImplementation(composeBom)+ androidTestImplementation("androidx.compose.ui:ui-test-junit4")+ androidTestImplementation(libs.androidx.test.ext.junit)+ androidTestImplementation(libs.espresso.core)}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/PlayerSmokeTest.kt b/app/src/androidTest/java/com/streamvault/app/ui/PlayerSmokeTest.ktnew file mode 100644index 00000000..e598c892--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/PlayerSmokeTest.kt@@ -0,0 +1,130 @@+package com.streamvault.app.ui++import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.test.assertIsFocused+import androidx.compose.ui.test.hasSetTextAction+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithText+import androidx.compose.ui.test.performClick+import androidx.compose.ui.test.performTextInput+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.streamvault.app.ui.components.shell.CategoryRailPanel+import com.streamvault.app.ui.screens.player.overlay.PlayerControlsOverlay+import com.streamvault.app.ui.screens.player.overlay.PlayerTrackSelectionDialog+import com.streamvault.app.ui.test.TestFixtures+import com.streamvault.app.ui.theme.StreamVaultTheme+import com.streamvault.player.TrackType+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class PlayerSmokeTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun categoryRailPanel_searchField_acceptsInitialFocusAndInput() {+ val searchFocusRequester = FocusRequester()++ composeRule.setContent {+ val query = remember { mutableStateOf("") }+ StreamVaultTheme {+ CategoryRailPanel(+ title = "Guide",+ searchValue = query.value,+ onSearchValueChange = { query.value = it },+ searchPlaceholder = "Search categories",+ modifier = Modifier.fillMaxSize(),+ searchFocusRequester = searchFocusRequester+ ) {+ }+ LaunchedEffect(Unit) {+ searchFocusRequester.requestFocus()+ }+ }+ }++ composeRule.onNode(hasSetTextAction()).assertIsFocused()+ composeRule.onNode(hasSetTextAction()).performTextInput("Sports")+ composeRule.onNodeWithText("Sports").assertExists()+ }++ @Test+ fun playerControlsOverlay_playButton_canReceiveFocus() {+ val playButtonFocusRequester = FocusRequester()++ composeRule.setContent {+ StreamVaultTheme {+ PlayerControlsOverlay(+ visible = true,+ title = TestFixtures.vodTitle,+ contentType = "MOVIE",+ isPlaying = false,+ currentProgram = null,+ currentChannelName = null,+ displayChannelNumber = TestFixtures.displayChannelNumber,+ currentPosition = TestFixtures.currentPositionMs,+ duration = TestFixtures.durationMs,+ aspectRatioLabel = TestFixtures.aspectRatioLabel,+ subtitleTrackCount = 1,+ audioTrackCount = 2,+ videoQualityCount = 2,+ currentRecordingStatus = null,+ playButtonFocusRequester = playButtonFocusRequester,+ onClose = {},+ onTogglePlayPause = {},+ onSeekBackward = {},+ onSeekForward = {},+ onRestartProgram = {},+ onOpenArchive = {},+ onStartRecording = {},+ onStopRecording = {},+ onScheduleRecording = {},+ onToggleAspectRatio = {},+ onOpenSubtitleTracks = {},+ onOpenAudioTracks = {},+ onOpenVideoTracks = {},+ onOpenSplitScreen = {},+ clockLabelOverride = TestFixtures.fixedClock+ )+ LaunchedEffect(Unit) {+ playButtonFocusRequester.requestFocus()+ }+ }+ }++ composeRule.onNodeWithText(">").assertIsFocused()+ }++ @Test+ fun playerTrackSelectionDialog_selectsAudioTrack() {+ var selectedTrackId: String? = null++ composeRule.setContent {+ StreamVaultTheme {+ PlayerTrackSelectionDialog(+ trackType = TrackType.AUDIO,+ audioTracks = TestFixtures.audioTracks,+ subtitleTracks = TestFixtures.subtitleTracks,+ videoTracks = emptyList(),+ onDismiss = {},+ onSelectAudio = { selectedTrackId = it },+ onSelectVideo = {},+ onSelectSubtitle = {}+ )+ }+ }++ composeRule.onNodeWithText("Spanish Stereo").performClick()+ composeRule.runOnIdle {+ check(selectedTrackId == "audio-es")+ }+ }+}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt b/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.ktnew file mode 100644index 00000000..be2eefb6--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/PremiumRouteGoldenTest.kt@@ -0,0 +1,379 @@+package com.streamvault.app.ui++import androidx.compose.foundation.background+import androidx.compose.foundation.layout.*+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithTag+import androidx.compose.ui.unit.dp+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.streamvault.app.navigation.Routes+import com.streamvault.app.ui.components.SearchInput+import com.streamvault.app.ui.components.shell.AppHeroHeader+import com.streamvault.app.ui.components.shell.AppMessageState+import com.streamvault.app.ui.components.shell.AppScreenScaffold+import com.streamvault.app.ui.components.shell.AppSectionHeader+import com.streamvault.app.ui.components.shell.BrowseHeroPanel+import com.streamvault.app.ui.components.shell.BrowseSearchLaunchCard+import com.streamvault.app.ui.components.shell.CategoryRailPanel+import com.streamvault.app.ui.components.shell.ContentMetadataStrip+import com.streamvault.app.ui.components.shell.EpisodeRowCard+import com.streamvault.app.ui.components.shell.LibraryBrowseScaffold+import com.streamvault.app.ui.components.shell.LiveChannelRowSurface+import com.streamvault.app.ui.components.shell.LoadMoreCard+import com.streamvault.app.ui.components.shell.MoviePosterCard+import com.streamvault.app.ui.components.shell.SeriesPosterCard+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.test.TestFixtures+import com.streamvault.app.ui.test.assertAgainstGolden+import com.streamvault.app.ui.theme.StreamVaultTheme+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class PremiumRouteGoldenTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun dashboard_route_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ AppScreenScaffold(+ currentRoute = Routes.HOME,+ onNavigate = {},+ title = "Your Library, Ready",+ subtitle = "Pulse IPTV is active. Jump back into live, continue watching, or browse fresh additions."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(20.dp)) {+ AppHeroHeader(+ title = "Tonight's Premium Picks",+ subtitle = "One place for live shortcuts, recent progress, and provider health.",+ eyebrow = "Dashboard",+ actions = {+ StatusPill(label = "4K", containerColor = AppColors.Brand)+ StatusPill(label = "Saved", containerColor = AppColors.Warning, contentColor = AppColors.Canvas)+ },+ footer = {+ ContentMetadataStrip(values = listOf("126 live", "18 to resume", "2 alerts"))+ }+ )+ AppSectionHeader(+ title = "Continue Watching",+ subtitle = "Recent live channels, movies, and series kept within reach."+ )+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {+ MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))+ SeriesPosterCard(series = TestFixtures.series, modifier = Modifier.width(160.dp).height(240.dp))+ LiveChannelRowSurface(+ channel = TestFixtures.liveChannel,+ onClick = {},+ modifier = Modifier.weight(1f)+ )+ }+ }+ }+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_dashboard_default")+ }++ @Test+ fun live_route_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ LibraryBrowseScaffold(+ currentRoute = Routes.LIVE_TV,+ onNavigate = {},+ title = "Live TV",+ subtitle = "Browse categories, scan now playing, and jump into multiview-ready channels.",+ header = {+ AppHeroHeader(+ title = TestFixtures.liveChannelName,+ subtitle = "World Cup Qualifiers is live now. Scan dense rows optimized for large playlists.",+ eyebrow = "Guide-ready",+ footer = {+ ContentMetadataStrip(values = listOf("Sports", "Catch-up", "105"))+ }+ )+ },+ railContent = {+ CategoryRailPanel(+ title = "Live Groups",+ searchValue = "",+ onSearchValueChange = {},+ searchPlaceholder = "Search categories"+ ) {+ TestFixtures.liveCategories.forEach { category ->+ item {+ StatusPill(+ label = "${category.name} ${category.count}",+ modifier = Modifier.padding(bottom = 8.dp)+ )+ }+ }+ }+ },+ content = {+ Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {+ BrowseSearchLaunchCard(+ title = "Search Live TV",+ subtitle = "Find channels, categories, or program titles without leaving the live surface.",+ onClick = {}+ )+ LiveChannelRowSurface(channel = TestFixtures.liveChannel, onClick = {})+ LiveChannelRowSurface(+ channel = TestFixtures.liveChannel.copy(+ id = 8L,+ name = "Headline News HD",+ isFavorite = false,+ catchUpSupported = false,+ currentProgram = TestFixtures.currentProgram.copy(title = "Global Briefing")+ ),+ onClick = {}+ )+ }+ }+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_live_browse")+ }++ @Test+ fun movies_route_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ LibraryBrowseScaffold(+ currentRoute = Routes.MOVIES,+ onNavigate = {},+ title = "Movies",+ subtitle = "Curated shelves, fast category jumps, and large-library-safe browsing.",+ railContent = {+ CategoryRailPanel(+ title = "Movie Categories",+ searchValue = "",+ onSearchValueChange = {},+ searchPlaceholder = "Search movie categories"+ ) {+ item { StatusPill(label = "All Library 240", modifier = Modifier.padding(bottom = 8.dp)) }+ item { StatusPill(label = "Top Picks 48", modifier = Modifier.padding(bottom = 8.dp)) }+ item { StatusPill(label = "New Releases 32") }+ }+ },+ content = {+ Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {+ BrowseHeroPanel(+ title = TestFixtures.vodTitle,+ subtitle = "Prestige movie curation with shared focus styling and premium hierarchy.",+ eyebrow = "Top Picks",+ metadata = listOf("2026", "Thriller", "RTG 8.8"),+ actionLabel = "Play",+ onClick = {}+ )+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {+ MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))+ MoviePosterCard(+ movie = TestFixtures.movie.copy(id = 101L, name = "Coastline", year = "2025", rating = 8.1f),+ modifier = Modifier.width(160.dp).height(240.dp)+ )+ MoviePosterCard(+ movie = TestFixtures.movie.copy(id = 102L, name = "Northern Lights", year = "2024", rating = 7.9f),+ modifier = Modifier.width(160.dp).height(240.dp)+ )+ }+ LoadMoreCard(label = "Load more titles", onClick = {})+ }+ }+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_movies_landing")+ }++ @Test+ fun series_detail_route_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ AppScreenScaffold(+ currentRoute = Routes.SERIES,+ onNavigate = {},+ title = "Series Detail",+ subtitle = "Backdrop hero, metadata, and progress-aware episode rows."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {+ BrowseHeroPanel(+ title = TestFixtures.series.name,+ subtitle = "A premium detail surface with season browsing and editorial context.",+ eyebrow = "Trending Series",+ metadata = listOf("Drama", "2026", "RTG 8.5"),+ actionLabel = "Resume",+ onClick = {}+ )+ AppSectionHeader(+ title = "Season 1",+ subtitle = "8 episodes available"+ )+ EpisodeRowCard(episode = TestFixtures.episode)+ }+ }+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_series_detail")+ }++ @Test+ fun saved_guide_and_settings_routes_matchGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.Canvas)+ .testTag("golden")+ ) {+ Row(+ modifier = Modifier+ .fillMaxSize()+ .padding(16.dp),+ horizontalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ Column(modifier = Modifier.weight(1f)) {+ AppScreenScaffold(+ currentRoute = Routes.FAVORITES,+ onNavigate = {},+ title = "Saved",+ subtitle = "Manage favorite channels, movies, and series from one premium hub."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(14.dp)) {+ AppHeroHeader(+ title = "Saved Library",+ subtitle = "Live recall, movies, and series shelves stay aligned with the new shell."+ )+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = "Live Recall")+ StatusPill(label = "Movies")+ StatusPill(label = "Series")+ }+ SeriesPosterCard(series = TestFixtures.series, modifier = Modifier.width(160.dp).height(240.dp))+ }+ }+ }+ Column(modifier = Modifier.weight(1f)) {+ AppScreenScaffold(+ currentRoute = Routes.EPG,+ onNavigate = {},+ title = "Guide",+ subtitle = "Sticky summary header and focused program details."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(14.dp)) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = "All Channels")+ StatusPill(label = "Archive Ready", containerColor = AppColors.Brand)+ }+ AppMessageState(+ title = TestFixtures.currentProgram.title,+ subtitle = "21:00 - 22:00 · Focused details stay visible while the timeline scrolls."+ )+ }+ }+ }+ Column(modifier = Modifier.weight(1f)) {+ AppScreenScaffold(+ currentRoute = Routes.SETTINGS,+ onNavigate = {},+ title = "Settings",+ subtitle = "Provider health, parental controls, and backup tools in one refined hub."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(14.dp)) {+ AppHeroHeader(+ title = "Pulse IPTV",+ subtitle = "1 active provider · Locked groups enabled · System language"+ )+ AppMessageState(+ title = "Provider Sync Healthy",+ subtitle = "Last sync completed successfully. Diagnostics are available if playback degrades."+ )+ }+ }+ }+ }+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_saved_guide_settings")+ }++ @Test+ fun search_route_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ AppScreenScaffold(+ currentRoute = Routes.SEARCH,+ onNavigate = {},+ title = "Search",+ subtitle = "Unified results across live, movies, and series."+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {+ SearchInput(+ value = "night",+ onValueChange = {},+ placeholder = "Search everything"+ )+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = "Live 12")+ StatusPill(label = "Movies 8")+ StatusPill(label = "Series 4")+ }+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {+ MoviePosterCard(movie = TestFixtures.movie, modifier = Modifier.width(160.dp).height(240.dp))+ SeriesPosterCard(series = TestFixtures.series, modifier = Modifier.width(160.dp).height(240.dp))+ }+ }+ }+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("route_search_results")+ }+}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/components/shell/ShellGoldenTest.kt b/app/src/androidTest/java/com/streamvault/app/ui/components/shell/ShellGoldenTest.ktnew file mode 100644index 00000000..5192d689--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/components/shell/ShellGoldenTest.kt@@ -0,0 +1,103 @@+package com.streamvault.app.ui.components.shell++import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalLayoutDirection+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.unit.LayoutDirection+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithTag+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.streamvault.app.navigation.Routes+import com.streamvault.app.ui.test.assertAgainstGolden+import com.streamvault.app.ui.theme.StreamVaultTheme+import com.streamvault.domain.model.Channel+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class ShellGoldenTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun browseHeroPanel_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ BrowseHeroPanel(+ title = "Late Night Premiere",+ subtitle = "Premium hero layout for large-screen browse surfaces.",+ eyebrow = "Movies",+ metadata = listOf("2026", "RTG 8.8"),+ actionLabel = "Play",+ onClick = {},+ imageUrl = null+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("browse_hero_panel")+ }++ @Test+ fun liveChannelRowSurface_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ LiveChannelRowSurface(+ channel = Channel(+ id = 7L,+ name = "World Sports HD",+ streamUrl = "https://example.com/live",+ logoUrl = null,+ isFavorite = true,+ catchUpSupported = true+ ),+ onClick = {},+ onLongClick = {}+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("live_channel_row_surface")+ }++ @Test+ fun appScreenScaffold_rtl_matchesGolden() {+ composeRule.setContent {+ CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Rtl) {+ StreamVaultTheme {+ AppScreenScaffold(+ currentRoute = Routes.EPG,+ onNavigate = {},+ title = "Guide",+ subtitle = "RTL shell validation for premium TV surfaces."+ ) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ )+ }+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("app_screen_scaffold_rtl")+ }+}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlayGoldenTest.kt b/app/src/androidTest/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlayGoldenTest.ktnew file mode 100644index 00000000..51fe77ac--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlayGoldenTest.kt@@ -0,0 +1,184 @@+package com.streamvault.app.ui.screens.player.overlay++import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.platform.testTag+import androidx.compose.ui.test.junit4.createComposeRule+import androidx.compose.ui.test.onNodeWithTag+import androidx.test.ext.junit.runners.AndroidJUnit4+import com.streamvault.app.ui.test.TestFixtures+import com.streamvault.app.ui.test.assertAgainstGolden+import com.streamvault.app.ui.theme.StreamVaultTheme+import com.streamvault.player.PlayerError+import com.streamvault.player.TrackType+import org.junit.Rule+import org.junit.Test+import org.junit.runner.RunWith++@RunWith(AndroidJUnit4::class)+class PlayerOverlayGoldenTest {++ @get:Rule+ val composeRule = createComposeRule()++ @Test+ fun playerControlsOverlay_vod_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerControlsOverlay(+ visible = true,+ title = TestFixtures.vodTitle,+ contentType = "MOVIE",+ isPlaying = true,+ currentProgram = null,+ currentChannelName = null,+ displayChannelNumber = TestFixtures.displayChannelNumber,+ currentPosition = TestFixtures.currentPositionMs,+ duration = TestFixtures.durationMs,+ aspectRatioLabel = TestFixtures.aspectRatioLabel,+ subtitleTrackCount = 2,+ audioTrackCount = 2,+ videoQualityCount = 2,+ currentRecordingStatus = null,+ playButtonFocusRequester = FocusRequester(),+ onClose = {},+ onTogglePlayPause = {},+ onSeekBackward = {},+ onSeekForward = {},+ onRestartProgram = {},+ onOpenArchive = {},+ onStartRecording = {},+ onStopRecording = {},+ onScheduleRecording = {},+ onToggleAspectRatio = {},+ onOpenSubtitleTracks = {},+ onOpenAudioTracks = {},+ onOpenVideoTracks = {},+ onOpenSplitScreen = {},+ clockLabelOverride = TestFixtures.fixedClock+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_controls_overlay_vod")+ }++ @Test+ fun playerNoticeBanner_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerNoticeBanner(+ notice = TestFixtures.notice,+ onDismiss = {},+ onAction = {}+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_notice_banner")+ }++ @Test+ fun playerErrorOverlay_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerErrorOverlay(+ playerError = PlayerError.NetworkError("Timeout"),+ contentType = "LIVE",+ hasAlternateStream = true,+ hasLastChannel = true,+ onAction = {}+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_error_overlay")+ }++ @Test+ fun playerTrackSelectionDialog_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerTrackSelectionDialog(+ trackType = TrackType.AUDIO,+ audioTracks = TestFixtures.audioTracks,+ subtitleTracks = TestFixtures.subtitleTracks,+ videoTracks = emptyList(),+ onDismiss = {},+ onSelectAudio = {},+ onSelectVideo = {},+ onSelectSubtitle = {}+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_track_selection_dialog")+ }++ @Test+ fun playerResumePrompt_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerResumePrompt(+ title = TestFixtures.vodTitle,+ onStartOver = {},+ onResume = {}+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_resume_prompt")+ }++ @Test+ fun playerNumericInputOverlay_matchesGolden() {+ composeRule.setContent {+ StreamVaultTheme {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .testTag("golden")+ ) {+ PlayerNumericInputOverlay(+ state = TestFixtures.invalidNumericInputState,+ visible = true+ )+ }+ }+ }++ composeRule.onNodeWithTag("golden").assertAgainstGolden("player_numeric_input_overlay")+ }+}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.kt b/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.ktnew file mode 100644index 00000000..1bec7458--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/test/GoldenCapture.kt@@ -0,0 +1,42 @@+package com.streamvault.app.ui.test++import android.graphics.Bitmap+import androidx.compose.ui.graphics.asAndroidBitmap+import androidx.compose.ui.test.SemanticsNodeInteraction+import androidx.compose.ui.test.captureToImage+import androidx.test.platform.app.InstrumentationRegistry+import java.io.File+import org.junit.Assert.assertEquals+import org.junit.Assert.assertTrue++private const val RECORD_GOLDENS_ARGUMENT = "recordGoldens"++fun SemanticsNodeInteraction.assertAgainstGolden(goldenName: String) {+ val bitmap = captureToImage().asAndroidBitmap()+ val context = InstrumentationRegistry.getInstrumentation().targetContext+ val outputDir = File(context.filesDir, "ui-goldens").apply { mkdirs() }+ val goldenFile = File(outputDir, "$goldenName.png")+ val shouldRecord = InstrumentationRegistry.getArguments().getString(RECORD_GOLDENS_ARGUMENT) == "true"++ if (shouldRecord || !goldenFile.exists()) {+ goldenFile.outputStream().use { stream ->+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream)+ }+ assertTrue(goldenFile.exists())+ return+ }++ val expected = android.graphics.BitmapFactory.decodeFile(goldenFile.absolutePath)+ assertBitmapsEqual(expected, bitmap, goldenName)+}++private fun assertBitmapsEqual(expected: Bitmap, actual: Bitmap, goldenName: String) {+ assertEquals(expected.width, actual.width)+ assertEquals(expected.height, actual.height)++ for (y in 0 until expected.height) {+ for (x in 0 until expected.width) {+ assertEquals("$goldenName@$x,$y", expected.getPixel(x, y), actual.getPixel(x, y))+ }+ }+}diff --git a/app/src/androidTest/java/com/streamvault/app/ui/test/TestFixtures.kt b/app/src/androidTest/java/com/streamvault/app/ui/test/TestFixtures.ktnew file mode 100644index 00000000..b77ff038--- /dev/null+++ b/app/src/androidTest/java/com/streamvault/app/ui/test/TestFixtures.kt@@ -0,0 +1,126 @@+package com.streamvault.app.ui.test++import com.streamvault.app.ui.screens.player.NumericChannelInputState+import com.streamvault.app.ui.screens.player.PlayerNoticeAction+import com.streamvault.app.ui.screens.player.PlayerNoticeState+import com.streamvault.app.ui.screens.player.PlayerRecoveryType+import com.streamvault.domain.model.Category+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.Episode+import com.streamvault.domain.model.Movie+import com.streamvault.domain.model.Program+import com.streamvault.domain.model.RecordingStatus+import com.streamvault.domain.model.Series+import com.streamvault.player.PlayerTrack+import com.streamvault.player.TrackType++internal object TestFixtures {+ val currentProgram = Program(+ id = 42L,+ channelId = "7",+ title = "World Cup Qualifiers",+ description = "Late match coverage",+ startTime = 1_710_000_000_000L,+ endTime = 1_710_003_600_000L,+ hasArchive = true,+ isNowPlaying = true+ )++ val numericInputState = NumericChannelInputState(+ input = "105",+ matchedChannelName = "Cinema Select HD",+ invalid = false+ )++ val invalidNumericInputState = NumericChannelInputState(+ input = "999",+ matchedChannelName = null,+ invalid = true+ )++ val notice = PlayerNoticeState(+ message = "Playback recovered on the alternate stream.",+ recoveryType = PlayerRecoveryType.NETWORK,+ actions = listOf(PlayerNoticeAction.RETRY, PlayerNoticeAction.OPEN_GUIDE)+ )++ val audioTracks = listOf(+ PlayerTrack("audio-en", "English 5.1", "en", TrackType.AUDIO, true),+ PlayerTrack("audio-es", "Spanish Stereo", "es", TrackType.AUDIO, false)+ )++ val subtitleTracks = listOf(+ PlayerTrack("sub-en", "English CC", "en", TrackType.TEXT, true),+ PlayerTrack("sub-es", "Spanish", "es", TrackType.TEXT, false)+ )++ val liveCategories = listOf(+ Category(id = 1L, name = "All Channels", type = ContentType.LIVE, count = 4820),+ Category(id = 2L, name = "Sports", type = ContentType.LIVE, count = 326),+ Category(id = 3L, name = "News", type = ContentType.LIVE, count = 118)+ )++ val moviesCategory = Category(id = 11L, name = "Top Picks", type = ContentType.MOVIE, count = 240)+ val seriesCategory = Category(id = 21L, name = "Trending Series", type = ContentType.SERIES, count = 180)++ val liveChannel = Channel(+ id = 7L,+ name = liveChannelName,+ streamUrl = "https://example.com/live.m3u8",+ number = displayChannelNumber,+ isFavorite = true,+ catchUpSupported = true,+ categoryName = "Sports",+ currentProgram = currentProgram+ )++ val movie = Movie(+ id = 100L,+ name = vodTitle,+ posterUrl = null,+ backdropUrl = null,+ categoryId = moviesCategory.id,+ categoryName = moviesCategory.name,+ plot = "A prestige thriller staged for a premium TV browse surface.",+ genre = "Thriller",+ duration = "2h 05m",+ rating = 8.8f,+ year = "2026",+ isFavorite = true+ )++ val series = Series(+ id = 200L,+ name = "Signal Fires",+ posterUrl = null,+ backdropUrl = null,+ categoryId = seriesCategory.id,+ categoryName = seriesCategory.name,+ plot = "A serialized drama used for TV layout regression tests.",+ genre = "Drama",+ releaseDate = "2026",+ rating = 8.5f,+ isFavorite = true+ )++ val episode = Episode(+ id = 301L,+ title = "Episode One",+ episodeNumber = 1,+ seasonNumber = 1,+ duration = "48m",+ plot = "Pilot episode for the premium series detail state."+ )++ const val fixedClock = "21:47"+ const val vodTitle = "The Long Night"+ const val liveTitle = "World Sports HD"+ const val liveChannelName = "World Sports HD"+ const val resolutionLabel = "3840x2160"+ const val aspectRatioLabel = "Original"+ const val displayChannelNumber = 105+ const val currentPositionMs = 4_200_000L+ const val durationMs = 7_200_000L+ val recordingStatus = RecordingStatus.SCHEDULED+}diff --git a/app/src/main/java/com/streamvault/app/StreamVaultApp.kt b/app/src/main/java/com/streamvault/app/StreamVaultApp.ktindex 0c14dca8..e6ef435c 100644--- a/app/src/main/java/com/streamvault/app/StreamVaultApp.kt+++ b/app/src/main/java/com/streamvault/app/StreamVaultApp.kt@@ -49,7 +49,7 @@ class StreamVaultApp : Application(), SingletonImageLoader.Factory {// Limit concurrent decoding and fetching to 6 for TV hardware constraints.fetcherCoroutineContext(Dispatchers.IO.limitedParallelism(6)).decoderCoroutineContext(Dispatchers.Default.limitedParallelism(4))- .crossfade(true)+ .crossfade(false).build()}}diff --git a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.ktindex 53488d3f..2cc42780 100644--- a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt+++ b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt@@ -484,7 +484,15 @@ fun AppNavigation() {},onSeriesClick = { series ->navController.navigate(Routes.seriesDetail(series.id))- }+ },+ onNavigate = { route ->+ navController.navigate(route) {+ popUpTo(Routes.HOME) { saveState = true }+ launchSingleTop = true+ restoreState = true+ }+ },+ currentRoute = Routes.SEARCH)}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 4a2a7816..49e4b9fc 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@@ -1,6 +1,5 @@package com.streamvault.app.ui.components-import androidx.compose.animation.core.FastOutSlowInEasingimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.core.tweenimport androidx.compose.foundation.BorderStroke@@ -42,6 +41,8 @@ import androidx.tv.material3.Surfaceimport androidx.tv.material3.Textimport coil3.compose.AsyncImageimport com.streamvault.app.R+import com.streamvault.app.ui.components.shell.MoviePosterCard+import com.streamvault.app.ui.components.shell.SeriesPosterCardimport com.streamvault.app.ui.theme.AccentAmberimport com.streamvault.app.ui.theme.AccentCyanimport com.streamvault.app.ui.theme.AccentRed@@ -57,6 +58,7 @@ import com.streamvault.app.ui.theme.TextTertiaryimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Movieimport com.streamvault.domain.model.Series+import com.streamvault.app.ui.design.FocusSpec@Composablefun FocusableCard(@@ -73,20 +75,14 @@ fun FocusableCard(val scale by animateFloatAsState(targetValue = if (isFocused) {- if (isReorderMode && !isDragging) 1f else 1.1f+ if (isReorderMode && !isDragging) 1f else FocusSpec.FocusedScale} else {- if (isDragging) 1.1f else 1f+ if (isDragging) FocusSpec.FocusedScale else 1f},- animationSpec = tween(durationMillis = 200, easing = FastOutSlowInEasing),+ animationSpec = tween(durationMillis = 160),label = "cardScale")- val shadowElevation by animateFloatAsState(- targetValue = if (isDragging) 16f else if (isFocused) 8f else 0f,- animationSpec = tween(durationMillis = 200),- label = "cardElevation"- )-Surface(onClick = onClick,onLongClick = onLongClick,@@ -96,7 +92,6 @@ fun FocusableCard(.graphicsLayer {scaleX = scalescaleY = scale- this.shadowElevation = shadowElevationshape = RoundedCornerShape(12.dp)clip = false}@@ -113,7 +108,7 @@ fun FocusableCard(),focusedBorder = Border(border = BorderStroke(- width = if (isDragging) 4.dp else 3.dp,+ width = if (isDragging) 4.dp else FocusSpec.BorderWidth,color = if (isDragging) AccentAmber else FocusBorder),shape = RoundedCornerShape(12.dp)@@ -140,8 +135,8 @@ fun ChannelCard(onClick = onClick,onLongClick = onLongClick,modifier = modifier,- width = 280.dp,- height = 157.dp,+ width = 220.dp,+ height = 124.dp,isReorderMode = isReorderMode,isDragging = isDragging) { isFocused ->@@ -258,20 +253,15 @@ fun MovieCard(onClick = onClick,onLongClick = onLongClick,modifier = modifier,- width = 160.dp,- height = 240.dp,+ width = 136.dp,+ height = 204.dp,isReorderMode = isReorderMode,isDragging = isDragging) {- if (!movie.posterUrl.isNullOrBlank() && !isLocked) {- AsyncImage(- model = movie.posterUrl,- contentDescription = movie.name,- modifier = Modifier- .fillMaxSize()- .clip(RoundedCornerShape(12.dp))- .background(SurfaceElevated),- contentScale = ContentScale.Fit+ if (!isLocked) {+ MoviePosterCard(+ movie = movie,+ modifier = Modifier.fillMaxSize())} else {Box(@@ -287,42 +277,6 @@ fun MovieCard(}}- Box(- modifier = Modifier- .align(Alignment.BottomCenter)- .fillMaxWidth()- .fillMaxHeight(0.6f)- .background(- Brush.verticalGradient(- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.85f))- )- )- )-- Column(- modifier = Modifier- .align(Alignment.BottomStart)- .fillMaxWidth()- .padding(12.dp),- verticalArrangement = Arrangement.spacedBy(2.dp)- ) {- Text(- text = if (isLocked) stringResource(R.string.card_locked) else movie.name,- style = MaterialTheme.typography.titleSmall,- color = Color.White,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )-- if (!isLocked && movie.year != null) {- Text(- text = movie.year!!,- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.7f)- )- }- }-if (watchProgress > 0f && !isLocked) {LinearProgressIndicator(progress = { watchProgress.coerceIn(0f, 1f) },@@ -377,20 +331,15 @@ fun SeriesCard(onClick = onClick,onLongClick = onLongClick,modifier = modifier,- width = 160.dp,- height = 240.dp,+ width = 136.dp,+ height = 204.dp,isReorderMode = isReorderMode,isDragging = isDragging) {- if (!series.posterUrl.isNullOrBlank() && !isLocked) {- AsyncImage(- model = series.posterUrl,- contentDescription = series.name,- modifier = Modifier- .fillMaxSize()- .clip(RoundedCornerShape(12.dp))- .background(SurfaceElevated),- contentScale = ContentScale.Fit+ if (!isLocked) {+ SeriesPosterCard(+ series = series,+ modifier = Modifier.fillMaxSize())} else {Box(@@ -406,42 +355,6 @@ fun SeriesCard(}}- Box(- modifier = Modifier- .align(Alignment.BottomCenter)- .fillMaxWidth()- .fillMaxHeight(0.6f)- .background(- Brush.verticalGradient(- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.85f))- )- )- )-- Column(- modifier = Modifier- .align(Alignment.BottomStart)- .fillMaxWidth()- .padding(12.dp),- verticalArrangement = Arrangement.spacedBy(2.dp)- ) {- Text(- text = if (isLocked) stringResource(R.string.card_locked) else series.name,- style = MaterialTheme.typography.titleSmall,- color = Color.White,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )- if (!isLocked && !subtitle.isNullOrBlank()) {- Text(- text = subtitle,- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.7f),- maxLines = 1- )- }- }-if (watchProgress > 0f && !isLocked) {LinearProgressIndicator(progress = { watchProgress.coerceIn(0f, 1f) },diff --git a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.ktindex 3f7b1187..82c93514 100644--- a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt@@ -34,7 +34,7 @@ fun <T> CategoryRow(Row(modifier = Modifier.fillMaxWidth()- .padding(start = 48.dp, end = 48.dp, top = 24.dp, bottom = 8.dp),+ .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 6.dp),horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically) {@@ -55,16 +55,16 @@ fun <T> CategoryRow() {Text(text = stringResource(R.string.category_see_all),- style = MaterialTheme.typography.labelLarge,- modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp)+ style = MaterialTheme.typography.labelSmall,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp))}}}LazyRow(- contentPadding = PaddingValues(horizontal = 48.dp),- horizontalArrangement = Arrangement.spacedBy(12.dp)+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp)) {items(items = items,diff --git a/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt b/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.ktindex b54fea38..286f132b 100644--- a/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt@@ -1,10 +1,20 @@package com.streamvault.app.ui.componentsimport androidx.compose.foundation.background-import androidx.compose.foundation.layout.*+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.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.LinearProgressIndicatorimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -12,28 +22,22 @@ import androidx.compose.ui.draw.clipimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dp-import androidx.compose.material3.LinearProgressIndicatorimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.Textimport coil3.compose.AsyncImage-import com.streamvault.app.ui.theme.*+import com.streamvault.app.R+import com.streamvault.app.ui.theme.AccentCyan+import com.streamvault.app.ui.theme.GradientOverlayBottom+import com.streamvault.app.ui.theme.SurfaceElevated+import com.streamvault.app.ui.theme.TextPrimary+import com.streamvault.app.ui.theme.TextSecondary+import com.streamvault.app.ui.theme.TextTertiaryimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.PlaybackHistory-import androidx.compose.ui.res.stringResource-import com.streamvault.app.R-/**- * Netflix-style "Continue Watching" row backed by PlaybackHistoryRepository.- *- * Shows landscape tiles (280×157dp) with:- * - Poster/backdrop image- * - Bottom gradient overlay with title + episode info- * - AccentCyan resume progress bar at bottom edge- *- * Hidden automatically when [items] is empty.- */@Composablefun ContinueWatchingRow(items: List<PlaybackHistory>,@@ -43,11 +47,10 @@ fun ContinueWatchingRow(if (items.isEmpty()) returnColumn(modifier = modifier.fillMaxWidth()) {- // HeaderRow(modifier = Modifier.fillMaxWidth()- .padding(start = 48.dp, end = 48.dp, top = 24.dp, bottom = 8.dp),+ .padding(start = 20.dp, end = 20.dp, top = 14.dp, bottom = 6.dp),horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically) {@@ -59,8 +62,8 @@ fun ContinueWatchingRow(}LazyRow(- contentPadding = PaddingValues(horizontal = 48.dp),- horizontalArrangement = Arrangement.spacedBy(12.dp)+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp)) {items(items = items, key = { it.id }) { history ->ContinueWatchingTile(history = history, onClick = { onItemClick(history) })@@ -76,14 +79,15 @@ private fun ContinueWatchingTile() {val progress = if (history.totalDurationMs > 0) {(history.resumePositionMs.toFloat() / history.totalDurationMs).coerceIn(0f, 1f)- } else 0f+ } else {+ 0f+ }FocusableCard(onClick = onClick,- width = 280.dp,- height = 157.dp- ) { isFocused ->- // Artwork+ width = 208.dp,+ height = 117.dp+ ) {if (!history.posterUrl.isNullOrBlank()) {AsyncImage(model = history.posterUrl,@@ -95,21 +99,23 @@ private fun ContinueWatchingTile()} else {Box(- modifier = Modifier.fillMaxSize().background(SurfaceElevated),+ modifier = Modifier+ .fillMaxSize()+ .background(SurfaceElevated),contentAlignment = Alignment.Center) {Text(text = when (history.contentType) {- ContentType.LIVE -> "📡"- ContentType.MOVIE -> "🎬"- ContentType.SERIES, ContentType.SERIES_EPISODE -> "📺"+ ContentType.LIVE -> "LIVE"+ ContentType.MOVIE -> "MOVIE"+ ContentType.SERIES, ContentType.SERIES_EPISODE -> "SERIES"},- style = MaterialTheme.typography.headlineLarge+ style = MaterialTheme.typography.titleLarge,+ color = TextSecondary)}}- // Bottom gradientBox(modifier = Modifier.align(Alignment.BottomCenter)@@ -118,7 +124,6 @@ private fun ContinueWatchingTile(.background(Brush.verticalGradient(listOf(Color.Transparent, GradientOverlayBottom))))- // Title + subtitleColumn(modifier = Modifier.align(Alignment.BottomStart)@@ -133,11 +138,17 @@ private fun ContinueWatchingTile(maxLines = 1,overflow = TextOverflow.Ellipsis)- if (history.contentType == ContentType.SERIES_EPISODE &&- history.seasonNumber != null && history.episodeNumber != null+ if (+ history.contentType == ContentType.SERIES_EPISODE &&+ history.seasonNumber != null &&+ history.episodeNumber != null) {Text(- text = stringResource(R.string.continue_watching_season_episode, history.seasonNumber!!, history.episodeNumber!!),+ text = stringResource(+ R.string.continue_watching_season_episode,+ history.seasonNumber!!,+ history.episodeNumber!!+ ),style = MaterialTheme.typography.labelMedium,color = TextTertiary,maxLines = 1@@ -145,7 +156,6 @@ private fun ContinueWatchingTile(}}- // Resume progress bar at very bottomif (progress > 0f) {LinearProgressIndicator(progress = { progress },diff --git a/app/src/main/java/com/streamvault/app/ui/components/PlaylistSwitcher.kt b/app/src/main/java/com/streamvault/app/ui/components/PlaylistSwitcher.ktindex d442c20b..4ede8dd8 100644--- a/app/src/main/java/com/streamvault/app/ui/components/PlaylistSwitcher.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/PlaylistSwitcher.kt@@ -1,17 +1,34 @@package com.streamvault.app.ui.components-import androidx.compose.foundation.layout.*+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.runtime.*+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.onFocusChanged-import androidx.compose.ui.unit.dp-import androidx.tv.material3.*-import com.streamvault.app.ui.theme.*-import com.streamvault.domain.model.Providerimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.theme.OnBackground+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevated+import com.streamvault.domain.model.Provider@Composablefun PlaylistSwitcher(@@ -24,7 +41,6 @@ fun PlaylistSwitcher(var isFocused by remember { mutableStateOf(false) }Box(modifier = modifier) {- // Current provider buttonSurface(onClick = { showProviderList = !showProviderList },modifier = Modifier.onFocusChanged { isFocused = it.isFocused },@@ -40,8 +56,9 @@ fun PlaylistSwitcher(horizontalArrangement = Arrangement.spacedBy(8.dp)) {Text(- text = "📺",- style = MaterialTheme.typography.bodyMedium+ text = "PROVIDER",+ style = MaterialTheme.typography.labelSmall,+ color = if (isFocused) Primary else OnSurfaceDim)Text(text = currentProvider?.name ?: stringResource(R.string.playlist_no_provider),@@ -49,23 +66,20 @@ fun PlaylistSwitcher(color = if (isFocused) Primary else OnBackground)Text(- text = if (showProviderList) "▲" else "▼",+ text = if (showProviderList) "^" else "v",style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim)}}- // Provider list dropdownif (showProviderList && allProviders.isNotEmpty()) {Surface(modifier = Modifier.padding(top = 48.dp).width(250.dp),shape = RoundedCornerShape(8.dp),- colors = SurfaceDefaults.colors(- containerColor = SurfaceElevated- )+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)) {Column(modifier = Modifier.padding(8.dp)) {allProviders.forEach { provider ->@@ -115,8 +129,8 @@ private fun ProviderItem()if (isSelected) {Text(- text = "✓",- style = MaterialTheme.typography.bodyMedium,+ text = "Selected",+ style = MaterialTheme.typography.labelSmall,color = Primary)}diff --git a/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt b/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.ktindex 7453e11e..dcf99ee3 100644--- a/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/ReorderTopBar.kt@@ -3,58 +3,94 @@ package com.streamvault.app.ui.componentsimport androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.slideInVerticallyimport androidx.compose.animation.slideOutVertically+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.*+import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.unit.dpimport androidx.tv.material3.*import com.streamvault.app.ui.theme.OnSurfaceimport com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevated+import com.streamvault.app.ui.theme.TextPrimary+import com.streamvault.app.ui.theme.TextSecondary@Composablefun ReorderTopBar(categoryName: String,onSave: () -> Unit,onCancel: () -> Unit,+ subtitle: String? = null,modifier: Modifier = Modifier) {AnimatedVisibility(visible = true,enter = slideInVertically(initialOffsetY = { -it }),exit = slideOutVertically(targetOffsetY = { -it }),- modifier = modifier.fillMaxWidth().height(80.dp).padding(horizontal = 24.dp)+ modifier = modifier+ .fillMaxWidth()+ .padding(bottom = 20.dp)) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ Surface(+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)) {- Text(- "Reordering '$categoryName'",- style = MaterialTheme.typography.titleLarge,- color = Primary- )- Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {- Button(- onClick = onCancel,- colors = ButtonDefaults.colors(- containerColor = MaterialTheme.colorScheme.surfaceVariant,- contentColor = OnSurface+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .background(+ Brush.horizontalGradient(+ listOf(+ Primary.copy(alpha = 0.08f),+ Color.Transparent+ )+ ))+ .padding(horizontal = 24.dp, vertical = 18.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text("Cancel", modifier = Modifier.padding(horizontal = 8.dp))+ Text(+ text = "Reordering $categoryName",+ style = MaterialTheme.typography.titleLarge,+ color = TextPrimary+ )+ subtitle?.takeIf { it.isNotBlank() }?.let {+ Text(+ text = it,+ style = MaterialTheme.typography.bodySmall,+ color = TextSecondary+ )+ }}+ Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ Button(+ onClick = onCancel,+ colors = ButtonDefaults.colors(+ containerColor = MaterialTheme.colorScheme.surfaceVariant,+ contentColor = OnSurface+ )+ ) {+ Text("Cancel", modifier = Modifier.padding(horizontal = 8.dp))+ }- Button(- onClick = onSave,- colors = ButtonDefaults.colors(- containerColor = Primary,- contentColor = Color.White- )- ) {- Text("Save Order", modifier = Modifier.padding(horizontal = 8.dp))+ Button(+ onClick = onSave,+ colors = ButtonDefaults.colors(+ containerColor = Primary,+ contentColor = Color.White+ )+ ) {+ Text("Save Order", modifier = Modifier.padding(horizontal = 8.dp))+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.ktindex 2ff8e448..90185a33 100644--- a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryContextCard.kt@@ -1,14 +1,18 @@package com.streamvault.app.ui.components+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.heightimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.compose.ui.res.stringResource@@ -42,9 +46,17 @@ fun SavedCategoryContextCard(Row(modifier = Modifier.fillMaxWidth()- .padding(horizontal = 20.dp, vertical = 18.dp),+ .background(+ Brush.horizontalGradient(+ listOf(+ Primary.copy(alpha = 0.10f),+ Primary.copy(alpha = 0.02f)+ )+ )+ )+ .padding(horizontal = 18.dp, vertical = 14.dp),horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ verticalAlignment = Alignment.Top) {Column(modifier = Modifier.weight(1f),@@ -52,26 +64,32 @@ fun SavedCategoryContextCard() {Text(text = stringResource(R.string.library_saved_active_title),- style = MaterialTheme.typography.labelLarge,+ style = MaterialTheme.typography.labelSmall,color = Primary)Text(text = categoryName,- style = MaterialTheme.typography.titleLarge,+ style = MaterialTheme.typography.titleMedium,color = OnSurface,maxLines = 1,overflow = TextOverflow.Ellipsis)Text(text = stringResource(R.string.library_saved_active_summary, itemCount),- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim,maxLines = 1)+ Spacer(modifier = Modifier.height(2.dp))+ Text(+ text = stringResource(R.string.library_saved_manage_hint),+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim+ )}Row(- horizontalArrangement = Arrangement.spacedBy(12.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp),verticalAlignment = Alignment.CenterVertically) {Button(@@ -85,7 +103,7 @@ fun SavedCategoryContextCard(Button(onClick = onBrowseAllClick,colors = ButtonDefaults.colors(- containerColor = SurfaceElevated,+ containerColor = SurfaceElevated.copy(alpha = 0.78f),contentColor = OnSurface)) {diff --git a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.ktindex c46bd7be..ae216bfc 100644--- a/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/SavedCategoryShortcutsRow.kt@@ -50,7 +50,7 @@ fun SavedCategoryShortcutsRow(Row(modifier = Modifier.fillMaxWidth()- .padding(start = 48.dp, end = 48.dp, top = 16.dp, bottom = 8.dp),+ .padding(start = 20.dp, end = 20.dp, top = 12.dp, bottom = 6.dp),horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically) {@@ -81,7 +81,7 @@ fun SavedCategoryShortcutsRow(onClick = { },modifier = Modifier.fillMaxWidth()- .padding(horizontal = 48.dp),+ .padding(horizontal = 20.dp),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = SurfaceElevated@@ -89,23 +89,25 @@ fun SavedCategoryShortcutsRow() {Text(text = emptyHint,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim,- modifier = Modifier.padding(horizontal = 16.dp, vertical = 18.dp)+ maxLines = 2,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp))}return}LazyRow(- contentPadding = PaddingValues(horizontal = 48.dp),- horizontalArrangement = Arrangement.spacedBy(12.dp)+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp)) {if (primaryShortcutLabel != null && onPrimaryShortcutClick != null) {item(key = "primary_shortcut") {Surface(onClick = onPrimaryShortcutClick,- modifier = Modifier.width(220.dp),+ modifier = Modifier.width(192.dp),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = if (isPrimaryShortcutSelected) {@@ -117,7 +119,7 @@ fun SavedCategoryShortcutsRow()) {Column(- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp),verticalArrangement = Arrangement.spacedBy(4.dp)) {Text(@@ -144,7 +146,7 @@ fun SavedCategoryShortcutsRow(onLongClick = onShortcutLongClick?.let { handler ->{ handler(shortcut.name) }},- modifier = Modifier.width(220.dp),+ modifier = Modifier.width(192.dp),shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = if (isSelected) Primary.copy(alpha = 0.18f) else SurfaceElevated,@@ -152,7 +154,7 @@ fun SavedCategoryShortcutsRow()) {Column(- modifier = Modifier.padding(horizontal = 16.dp, vertical = 14.dp),+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 12.dp),verticalArrangement = Arrangement.spacedBy(4.dp)) {Text(diff --git a/app/src/main/java/com/streamvault/app/ui/components/SearchInput.kt b/app/src/main/java/com/streamvault/app/ui/components/SearchInput.ktindex ef54d2c3..70e45a81 100644--- a/app/src/main/java/com/streamvault/app/ui/components/SearchInput.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/SearchInput.kt@@ -1,24 +1,45 @@package com.streamvault.app.ui.components-import androidx.compose.runtime.*-import androidx.compose.ui.*-import androidx.compose.ui.focus.*+import androidx.compose.foundation.ExperimentalFoundationApiimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.borderimport androidx.compose.foundation.clickable-import androidx.compose.foundation.layout.*+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.foundation.text.BasicTextFieldimport androidx.compose.foundation.text.KeyboardActionsimport androidx.compose.foundation.text.KeyboardOptions+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Search+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.ExperimentalComposeUiApi+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusProperties+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.platform.LocalSoftwareKeyboardControllerimport androidx.compose.ui.text.input.ImeActionimport androidx.compose.ui.unit.dp-import androidx.tv.material3.*-import com.streamvault.app.ui.theme.*-import androidx.compose.ui.ExperimentalComposeUiApi-import androidx.compose.foundation.ExperimentalFoundationApi+import androidx.tv.material3.Icon+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Text+import com.streamvault.app.ui.theme.FocusBorder+import com.streamvault.app.ui.theme.OnSurface+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/*** A TV-optimized search input field.@@ -39,34 +60,37 @@ fun SearchInput(val keyboardController = LocalSoftwareKeyboardController.currentval borderColor = if (isFocused) FocusBorder else OnSurfaceDim.copy(alpha = 0.5f)- val bgColor = if (isFocused) SurfaceHighlight else SurfaceElevated+ val backgroundColor = if (isFocused) SurfaceHighlight else SurfaceElevatedval borderWidth = if (isFocused) 2.dp else 1.dpBox(modifier = modifier.fillMaxWidth()- .height(48.dp)- .background(bgColor, RoundedCornerShape(8.dp))+ .height(40.dp)+ .background(backgroundColor, RoundedCornerShape(8.dp)).border(borderWidth, borderColor, RoundedCornerShape(8.dp)).onFocusChanged { isFocused = it.hasFocus }- .focusProperties {- enter = { focusRequester }- }- .clickable {- focusRequester.requestFocus()+ .focusProperties { enter = { focusRequester } }+ .clickable {+ focusRequester.requestFocus()keyboardController?.show()}.padding(horizontal = 12.dp),contentAlignment = Alignment.CenterStart) {Row(verticalAlignment = Alignment.CenterVertically) {- Text("🔍", modifier = Modifier.padding(end = 8.dp))-+ Icon(+ imageVector = Icons.Default.Search,+ contentDescription = null,+ tint = if (isFocused) Primary else OnSurfaceDim,+ modifier = Modifier.padding(end = 6.dp)+ )+Box(modifier = Modifier.weight(1f)) {if (value.isEmpty() && !isFocused) {Text(- text = placeholder,- style = MaterialTheme.typography.bodyMedium,+ text = placeholder,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim)}@@ -77,9 +101,7 @@ fun SearchInput(modifier = Modifier.fillMaxWidth().focusRequester(focusRequester),- textStyle = MaterialTheme.typography.bodyMedium.copy(- color = OnSurface- ),+ textStyle = MaterialTheme.typography.bodySmall.copy(color = OnSurface),singleLine = true,cursorBrush = SolidColor(Primary),keyboardOptions = KeyboardOptions(imeAction = imeAction),diff --git a/app/src/main/java/com/streamvault/app/ui/components/TopNavBar.kt b/app/src/main/java/com/streamvault/app/ui/components/TopNavBar.ktindex cc83391c..4f7cbefb 100644--- a/app/src/main/java/com/streamvault/app/ui/components/TopNavBar.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/TopNavBar.kt@@ -1,6 +1,5 @@package com.streamvault.app.ui.components-import androidx.compose.animation.AnimatedVisibilityimport androidx.compose.animation.core.animateFloatAsStateimport androidx.compose.animation.core.tweenimport androidx.compose.foundation.BorderStroke@@ -36,6 +35,8 @@ import androidx.tv.material3.Surfaceimport androidx.tv.material3.Textimport com.streamvault.app.Rimport com.streamvault.app.navigation.Routes+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.design.FocusSpecimport com.streamvault.app.ui.theme.FocusBorderimport com.streamvault.app.ui.theme.LocalSpacingimport com.streamvault.app.ui.theme.Primary@@ -83,15 +84,15 @@ fun TopNavBar() {Column {Text(- text = stringResource(id = R.string.app_name),- style = MaterialTheme.typography.titleLarge,- color = TextPrimary- )+ text = stringResource(id = R.string.app_name),+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )Text(- text = subtitle,- style = MaterialTheme.typography.labelSmall,- color = TextTertiary- )+ text = subtitle,+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextTertiary+ )}Spacer(modifier = Modifier.width(LocalSpacing.current.md))@@ -124,15 +125,15 @@ private fun NavTabButton(var isFocused by remember { mutableStateOf(false) }val scale by animateFloatAsState(- targetValue = if (isFocused) 1.02f else 1f,- animationSpec = tween(durationMillis = 180),+ targetValue = if (isFocused) FocusSpec.FocusedScale else 1f,+ animationSpec = tween(durationMillis = 160),label = "tabScale")val textColor = when {- isSelected -> Primary- isFocused -> TextPrimary- else -> TextSecondary+ isSelected -> AppColors.Brand+ isFocused -> AppColors.TextPrimary+ else -> AppColors.TextSecondary}Surface(@@ -145,12 +146,12 @@ private fun NavTabButton(.onFocusChanged { isFocused = it.isFocused },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),colors = ClickableSurfaceDefaults.colors(- containerColor = if (isSelected) Primary.copy(alpha = 0.16f) else SurfaceElevated,- focusedContainerColor = SurfaceElevated+ containerColor = if (isSelected) AppColors.BrandMuted else SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis),border = ClickableSurfaceDefaults.border(border = Border(- border = BorderStroke(1.dp, SurfaceElevated),+ border = BorderStroke(1.dp, AppColors.Outline),shape = RoundedCornerShape(12.dp)),focusedBorder = Border(@@ -169,23 +170,15 @@ private fun NavTabButton(style = MaterialTheme.typography.titleSmall,color = textColor)- AnimatedVisibility(visible = isSelected || isFocused) {- Box(- modifier = Modifier- .width(28.dp)- .height(3.dp),- ) {- Box(- modifier = Modifier- .fillMaxWidth()- .height(3.dp)- .background(- color = if (isSelected) Primary else FocusBorder,- shape = RoundedCornerShape(999.dp)- )+ Box(+ modifier = Modifier+ .width(28.dp)+ .height(3.dp)+ .background(+ color = if (isSelected) Primary else if (isFocused) FocusBorder else AppColors.Outline,+ shape = RoundedCornerShape(999.dp))- }- }+ )}}}diff --git a/app/src/main/java/com/streamvault/app/ui/components/TvEmptyState.kt b/app/src/main/java/com/streamvault/app/ui/components/TvEmptyState.ktindex e0d071d3..60a7ff2b 100644--- a/app/src/main/java/com/streamvault/app/ui/components/TvEmptyState.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/TvEmptyState.kt@@ -1,6 +1,7 @@package com.streamvault.app.ui.componentsimport androidx.compose.foundation.background+import androidx.compose.foundation.borderimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Column@@ -11,6 +12,7 @@ import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.Composableimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp@@ -32,16 +34,29 @@ fun TvEmptyState(Box(modifier = Modifier.fillMaxWidth(0.62f)- .background(Color.White.copy(alpha = 0.04f), RoundedCornerShape(20.dp))+ .background(+ Brush.horizontalGradient(+ listOf(+ Color.White.copy(alpha = 0.05f),+ Color.White.copy(alpha = 0.02f)+ )+ ),+ RoundedCornerShape(24.dp)+ )+ .border(+ width = 1.dp,+ color = Color.White.copy(alpha = 0.08f),+ shape = RoundedCornerShape(24.dp)+ )) {Column(horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(10.dp),- modifier = Modifier.padding(horizontal = 28.dp, vertical = 24.dp)+ verticalArrangement = Arrangement.spacedBy(12.dp),+ modifier = Modifier.padding(horizontal = 32.dp, vertical = 28.dp)) {Text(text = title,- style = MaterialTheme.typography.titleLarge,+ style = MaterialTheme.typography.headlineMedium,color = OnSurface,textAlign = TextAlign.Center)diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.ktindex 43c4cf7a..7bb35b20 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt@@ -2,6 +2,7 @@ package com.streamvault.app.ui.components.dialogsimport androidx.compose.foundation.layout.*import androidx.compose.foundation.border+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape@@ -23,6 +24,7 @@ import com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Categoryimport androidx.compose.ui.res.stringResourceimport com.streamvault.app.R+import com.streamvault.app.ui.design.AppColorsimport androidx.compose.ui.input.key.*import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.foundation.shape.CircleShape@@ -95,7 +97,7 @@ fun AddToGroupDialog() {Surface(shape = RoundedCornerShape(16.dp),- color = MaterialTheme.colorScheme.surface,+ color = AppColors.SurfaceElevated,modifier = Modifier.width(400.dp).padding(16.dp)@@ -110,6 +112,7 @@ fun AddToGroupDialog(Text(text = stringResource(R.string.add_group_manage_title, contentTitle),style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary,modifier = Modifier.weight(1f))IconButton(@@ -132,25 +135,34 @@ fun AddToGroupDialog(modifier = Modifier.fillMaxWidth().onFocusChanged { isFocused = it.isFocused }+ .background(+ color = if (isFocused) AppColors.Focus else Color.Transparent,+ shape = CircleShape+ ).border(- if (isFocused) 2.dp else 0.dp,- if (isFocused) MaterialTheme.colorScheme.onSurface else Color.Transparent,+ if (isFocused) 3.dp else 0.dp,+ if (isFocused) AppColors.Focus else Color.Transparent,CircleShape),colors = ButtonDefaults.buttonColors(- containerColor = if (isFavorite) Color.Yellow else MaterialTheme.colorScheme.primary+ containerColor = when {+ isFocused -> AppColors.Focus+ isFavorite -> AppColors.Warning+ else -> AppColors.Brand+ },+ contentColor = Color.Black)) {Icon(imageVector = Icons.Default.Star,contentDescription = null,- tint = if (isFavorite) Color.Black else Color.White+ tint = Color.Black)Spacer(modifier = Modifier.width(8.dp))Text(text = if (isFavorite) stringResource(R.string.add_group_remove_favorites)else stringResource(R.string.add_group_add_favorites),- color = if (isFavorite) Color.Black else Color.White+ color = Color.Black)}}@@ -164,20 +176,33 @@ fun AddToGroupDialog(modifier = Modifier.fillMaxWidth().onFocusChanged { isFocused = it.isFocused }+ .background(+ color = if (isFocused) AppColors.Focus else Color.Transparent,+ shape = CircleShape+ ).border(- if (isFocused) 2.dp else 0.dp,- if (isFocused) MaterialTheme.colorScheme.onSurface else Color.Transparent,+ if (isFocused) 3.dp else 0.dp,+ if (isFocused) AppColors.Focus else Color.Transparent,CircleShape),colors = ButtonDefaults.buttonColors(- containerColor = if (isQueued) Color(0xFF1B5E20) else Color(0xFF2E7D32)+ containerColor = when {+ isFocused -> AppColors.Focus+ isQueued -> AppColors.Success.copy(alpha = 0.8f)+ else -> AppColors.Success+ }+ )+ ) {+ Icon(+ imageVector = Icons.Default.Add,+ contentDescription = null,+ tint = if (isFocused) Color.Black else Color.White)- ) {- Text("🔳 ", color = Color.White)+ Spacer(modifier = Modifier.width(8.dp))Text(text = if (isQueued) stringResource(R.string.multiview_queued)else stringResource(R.string.multiview_add_to_split),- color = Color.White+ color = if (isFocused) Color.Black else Color.White)}}@@ -189,6 +214,7 @@ fun AddToGroupDialog(Text(text = stringResource(R.string.add_group_custom_groups_title),style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,modifier = Modifier.padding(bottom = 8.dp))}@@ -206,6 +232,7 @@ fun AddToGroupDialog(Text(text = group.name,style = MaterialTheme.typography.bodyMedium,+ color = AppColors.TextPrimary,modifier = Modifier.weight(1f))Button(@@ -213,17 +240,23 @@ fun AddToGroupDialog(if (isMember) onRemoveFromGroup(group) else onAddToGroup(group)},modifier = Modifier+ .background(+ color = if (isFocused) AppColors.Focus else Color.Transparent,+ shape = CircleShape+ ).onFocusChanged { isFocused = it.isFocused }.border(- if (isFocused) 2.dp else 0.dp,- if (isFocused) MaterialTheme.colorScheme.onSurface else Color.Transparent,+ if (isFocused) 3.dp else 0.dp,+ if (isFocused) AppColors.Focus else Color.Transparent,CircleShape),colors = ButtonDefaults.buttonColors(- containerColor = if (isMember) MaterialTheme.colorScheme.errorContainer- else MaterialTheme.colorScheme.primaryContainer,- contentColor = if (isMember) MaterialTheme.colorScheme.onErrorContainer- else MaterialTheme.colorScheme.onPrimaryContainer+ containerColor = when {+ isFocused -> AppColors.Focus+ isMember -> AppColors.Live.copy(alpha = 0.2f)+ else -> AppColors.BrandMuted.copy(alpha = 0.4f)+ },+ contentColor = if (isFocused) Color.Black else AppColors.TextPrimary)) {Text(@@ -235,10 +268,26 @@ fun AddToGroupDialog(}item {+ var isFocused by remember { mutableStateOf(false) }Spacer(modifier = Modifier.height(8.dp))OutlinedButton(onClick = { showCreateGroup = true },- modifier = Modifier.fillMaxWidth()+ modifier = Modifier+ .fillMaxWidth()+ .onFocusChanged { isFocused = it.isFocused }+ .background(+ color = if (isFocused) AppColors.Focus else Color.Transparent,+ shape = CircleShape+ )+ .border(+ if (isFocused) 3.dp else 1.dp,+ if (isFocused) AppColors.Focus else AppColors.BrandMuted.copy(alpha = 0.55f),+ CircleShape+ ),+ colors = ButtonDefaults.outlinedButtonColors(+ containerColor = if (isFocused) AppColors.Focus else Color.Transparent,+ contentColor = if (isFocused) Color.Black else AppColors.TextPrimary+ )) {Icon(Icons.Default.Add, contentDescription = null)Spacer(modifier = Modifier.width(8.dp))diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.ktindex f1a4e52d..62b5d3ba 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CategoryOptionsDialog.kt@@ -1,10 +1,11 @@package com.streamvault.app.ui.components.dialogs+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangementimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.material3.AlertDialog-import androidx.compose.material3.TextButton+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValue@@ -12,9 +13,23 @@ import androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.setValueimport androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.theme.OnSurface+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevatedimport com.streamvault.domain.model.Categoryimport kotlinx.coroutines.delay@@ -34,85 +49,114 @@ fun CategoryOptionsDialog(canInteract = true}- val safeDismiss = {- if (canInteract) onDismissRequest()- }+ val safeDismiss = { if (canInteract) onDismissRequest() }- AlertDialog(+ Dialog(onDismissRequest = safeDismiss,- title = {- androidx.tv.material3.Text(- text = category.name,- style = androidx.tv.material3.MaterialTheme.typography.titleLarge- )- },- text = {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(0.38f),+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .background(+ Brush.verticalGradient(+ listOf(+ Primary.copy(alpha = 0.08f),+ Color.Transparent+ )+ )+ )+ .padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Text(+ text = category.name,+ style = MaterialTheme.typography.headlineMedium,+ color = OnSurface+ )+ Text(+ text = stringResource(R.string.library_saved_manage_hint),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+if (onSetAsDefault != null) {- androidx.tv.material3.Button(- onClick = { if (canInteract) onSetAsDefault() },- modifier = Modifier.fillMaxWidth()- ) {- androidx.tv.material3.Text(stringResource(R.string.category_options_set_default))- }+ PremiumDialogAction(+ label = stringResource(R.string.category_options_set_default),+ onClick = { if (canInteract) onSetAsDefault() }+ )}if (onRename != null) {- androidx.tv.material3.Button(- onClick = { if (canInteract) onRename() },- modifier = Modifier.fillMaxWidth()- ) {- androidx.tv.material3.Text(stringResource(R.string.category_options_rename))- }+ PremiumDialogAction(+ label = stringResource(R.string.category_options_rename),+ onClick = { if (canInteract) onRename() }+ )}if (onReorderChannels != null) {- androidx.tv.material3.Button(+ PremiumDialogAction(+ label = stringResource(R.string.category_options_reorder),onClick = {if (canInteract) {onReorderChannels()onDismissRequest()}- },- modifier = Modifier.fillMaxWidth()- ) {- androidx.tv.material3.Text(stringResource(R.string.category_options_reorder))- }+ }+ )}if (onToggleLock != null) {- val lockText = if (category.isUserProtected) {- stringResource(R.string.category_options_unlock)- } else {- stringResource(R.string.category_options_lock)- }- androidx.tv.material3.Button(- onClick = { if (canInteract) onToggleLock() },- modifier = Modifier.fillMaxWidth()- ) {- androidx.tv.material3.Text(lockText)- }+ PremiumDialogAction(+ label = if (category.isUserProtected) {+ stringResource(R.string.category_options_unlock)+ } else {+ stringResource(R.string.category_options_lock)+ },+ onClick = { if (canInteract) onToggleLock() }+ )}if (onDelete != null) {- androidx.tv.material3.Button(+ PremiumDialogAction(+ label = stringResource(R.string.category_options_delete),onClick = { if (canInteract) onDelete() },- modifier = Modifier.fillMaxWidth(),- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = androidx.tv.material3.MaterialTheme.colorScheme.errorContainer,- contentColor = androidx.tv.material3.MaterialTheme.colorScheme.onErrorContainer- )- ) {- androidx.tv.material3.Text(stringResource(R.string.category_options_delete))- }+ destructive = true+ )+ }++ Button(+ onClick = safeDismiss,+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) {+ Text(stringResource(R.string.category_options_cancel))}- }- },- confirmButton = {},- dismissButton = {- TextButton(onClick = safeDismiss) {- androidx.tv.material3.Text(stringResource(R.string.category_options_cancel))}}- )+ }+}++@Composable+private fun PremiumDialogAction(+ label: String,+ onClick: () -> Unit,+ destructive: Boolean = false+) {+ Button(+ onClick = onClick,+ modifier = Modifier.fillMaxWidth(),+ colors = ButtonDefaults.colors(+ containerColor = if (destructive) MaterialTheme.colorScheme.errorContainer else Color.White.copy(alpha = 0.08f),+ contentColor = if (destructive) MaterialTheme.colorScheme.onErrorContainer else OnSurface+ )+ ) {+ Text(label)+ }}diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CreateGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CreateGroupDialog.ktindex 0cef79a9..f38c774f 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/CreateGroupDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/CreateGroupDialog.kt@@ -1,11 +1,16 @@package com.streamvault.app.ui.components.dialogs+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.foundation.text.KeyboardActionsimport androidx.compose.foundation.text.KeyboardOptions-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.OutlinedTextField-import androidx.compose.material3.TextButton+import androidx.compose.material3.OutlinedTextFieldDefaultsimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffectimport androidx.compose.runtime.getValue@@ -16,11 +21,25 @@ import androidx.compose.runtime.setValueimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.platform.LocalSoftwareKeyboardControllerimport androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.input.ImeAction+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialogimport androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.theme.OnSurface+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevated@Composablefun CreateGroupDialog(@@ -36,59 +55,105 @@ fun CreateGroupDialog(keyboardController?.show()}- AlertDialog(+ Dialog(onDismissRequest = {keyboardController?.hide()onDismissRequest()},- properties = DialogProperties(usePlatformDefaultWidth = false),- title = {- androidx.tv.material3.Text(stringResource(R.string.add_group_create_new_btn))- },- text = {- OutlinedTextField(- value = value,- onValueChange = { value = it },+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(0.42f),+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(modifier = Modifier- .fillMaxWidth()- .focusRequester(focusRequester),- singleLine = true,- label = {- androidx.tv.material3.Text(stringResource(R.string.add_group_name_hint))- },- keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),- keyboardActions = KeyboardActions(- onDone = {- val normalized = value.trim()- if (normalized.isNotEmpty()) {- keyboardController?.hide()- onConfirm(normalized)+ .background(+ Brush.verticalGradient(+ listOf(+ Primary.copy(alpha = 0.08f),+ Color.Transparent+ )+ )+ )+ .padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ Text(+ text = stringResource(R.string.add_group_create_new_btn),+ style = MaterialTheme.typography.headlineMedium,+ color = OnSurface+ )+ Text(+ text = stringResource(R.string.library_saved_manage_hint),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+ OutlinedTextField(+ value = value,+ onValueChange = { value = it },+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focusRequester),+ singleLine = true,+ label = { Text(stringResource(R.string.add_group_name_hint)) },+ colors = OutlinedTextFieldDefaults.colors(+ focusedTextColor = OnSurface,+ unfocusedTextColor = OnSurface,+ cursorColor = Primary,+ focusedBorderColor = Primary,+ unfocusedBorderColor = Primary.copy(alpha = 0.55f),+ focusedLabelColor = Primary,+ unfocusedLabelColor = OnSurfaceDim,+ focusedContainerColor = Color.Transparent,+ unfocusedContainerColor = Color.Transparent+ ),+ keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),+ keyboardActions = KeyboardActions(+ onDone = {+ val normalized = value.trim()+ if (normalized.isNotEmpty()) {+ keyboardController?.hide()+ onConfirm(normalized)+ }}- }+ ))- )- },- confirmButton = {- TextButton(- onClick = {- val normalized = value.trim()- if (normalized.isNotEmpty()) {- keyboardController?.hide()- onConfirm(normalized)+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Button(+ onClick = {+ keyboardController?.hide()+ onDismissRequest()+ },+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) {+ Text(stringResource(R.string.add_group_cancel))}- },- enabled = value.trim().isNotEmpty()- ) {- androidx.tv.material3.Text(stringResource(R.string.add_group_create))- }- },- dismissButton = {- TextButton(onClick = {- keyboardController?.hide()- onDismissRequest()- }) {- androidx.tv.material3.Text(stringResource(R.string.add_group_cancel))+ Button(+ onClick = {+ val normalized = value.trim()+ if (normalized.isNotEmpty()) {+ keyboardController?.hide()+ onConfirm(normalized)+ }+ },+ enabled = value.trim().isNotEmpty(),+ colors = ButtonDefaults.colors(+ containerColor = Primary,+ contentColor = Color.White+ )+ ) {+ Text(stringResource(R.string.add_group_create))+ }+ }}}- )+ }}diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/DeleteGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/DeleteGroupDialog.ktindex 4eb5a00f..ce61b13d 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/DeleteGroupDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/DeleteGroupDialog.kt@@ -1,13 +1,37 @@package com.streamvault.app.ui.components.dialogs-import androidx.compose.material3.AlertDialog-import androidx.compose.material3.MaterialTheme-import androidx.compose.material3.Text-import androidx.compose.material3.TextButton-import androidx.compose.runtime.*+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.theme.ErrorColor+import com.streamvault.app.ui.theme.OnSurface+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.SurfaceElevated+import kotlinx.coroutines.delay@Composablefun DeleteGroupDialog(@@ -15,30 +39,70 @@ fun DeleteGroupDialog(onDismissRequest: () -> Unit,onConfirmDelete: () -> Unit) {- // Fix for ghost clicks: Debounce interaction for 500ms to ignore long-press releasevar canInteract by remember { mutableStateOf(false) }LaunchedEffect(Unit) {- kotlinx.coroutines.delay(500)+ delay(500)canInteract = true}- val safeDismiss = {- if (canInteract) onDismissRequest()- }+ val safeDismiss = { if (canInteract) onDismissRequest() }- AlertDialog(+ Dialog(onDismissRequest = safeDismiss,- title = { Text(stringResource(R.string.home_delete_group_title)) },- text = { Text(stringResource(R.string.home_delete_group_body, groupName)) },- confirmButton = {- TextButton(onClick = { if (canInteract) onConfirmDelete() }) {- Text(stringResource(R.string.home_delete_group_confirm), color = Color.Red)- }- },- dismissButton = {- TextButton(onClick = safeDismiss) {- Text(stringResource(R.string.home_delete_group_cancel))+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(0.38f),+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .background(+ Brush.verticalGradient(+ listOf(+ ErrorColor.copy(alpha = 0.10f),+ Color.Transparent+ )+ )+ )+ .padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ Text(+ text = stringResource(R.string.home_delete_group_title),+ style = MaterialTheme.typography.headlineMedium,+ color = OnSurface+ )+ Text(+ text = stringResource(R.string.home_delete_group_body, groupName),+ style = MaterialTheme.typography.bodyLarge,+ color = OnSurfaceDim+ )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Button(+ onClick = safeDismiss,+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) {+ Text(stringResource(R.string.home_delete_group_cancel))+ }+ Button(+ onClick = { if (canInteract) onConfirmDelete() },+ colors = ButtonDefaults.colors(+ containerColor = ErrorColor,+ contentColor = Color.White+ )+ ) {+ Text(stringResource(R.string.home_delete_group_confirm))+ }+ }}}- )+ }}diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/PremiumDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/PremiumDialog.ktnew file mode 100644index 00000000..8438e9ce--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/PremiumDialog.kt@@ -0,0 +1,170 @@+package com.streamvault.app.ui.components.dialogs++import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ColumnScope+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.RowScope+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.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.design.FocusSpec++@Composable+fun PremiumDialog(+ title: String,+ subtitle: String? = null,+ onDismissRequest: () -> Unit,+ modifier: Modifier = Modifier,+ widthFraction: Float = 0.42f,+ content: @Composable ColumnScope.() -> Unit,+ footer: @Composable RowScope.() -> Unit = {}+) {+ Dialog(+ onDismissRequest = onDismissRequest,+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = modifier.fillMaxWidth(widthFraction),+ shape = RoundedCornerShape(28.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.BrandMuted.copy(alpha = 0.18f),+ AppColors.SurfaceElevated,+ AppColors.Surface+ )+ )+ )+ .padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(18.dp)+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ Text(+ text = title,+ style = MaterialTheme.typography.headlineMedium,+ color = AppColors.TextPrimary+ )+ if (!subtitle.isNullOrBlank()) {+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodyMedium,+ color = AppColors.TextSecondary+ )+ }+ }++ Column(verticalArrangement = Arrangement.spacedBy(12.dp), content = content)++ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(10.dp, androidx.compose.ui.Alignment.End),+ content = footer+ )+ }+ }+ }+}++@Composable+fun PremiumDialogActionButton(+ label: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+ enabled: Boolean = true,+ destructive: Boolean = false,+ emphasized: Boolean = false+) {+ val containerColor = when {+ destructive -> AppColors.Live.copy(alpha = 0.22f)+ emphasized -> AppColors.Brand+ else -> Color.White.copy(alpha = 0.08f)+ }+ val contentColor = when {+ destructive -> AppColors.TextPrimary+ emphasized -> Color.Black+ else -> AppColors.TextPrimary+ }++ Button(+ onClick = onClick,+ enabled = enabled,+ modifier = modifier.fillMaxWidth(),+ colors = ButtonDefaults.colors(+ containerColor = containerColor,+ contentColor = contentColor,+ focusedContainerColor = if (destructive) AppColors.Live else AppColors.SurfaceEmphasis,+ focusedContentColor = AppColors.Focus,+ disabledContainerColor = AppColors.Surface.copy(alpha = 0.85f),+ disabledContentColor = AppColors.TextDisabled+ ),+ border = ButtonDefaults.border(+ focusedBorder = androidx.tv.material3.Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus)+ )+ ),+ scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelLarge+ )+ }+}++@Composable+fun PremiumDialogFooterButton(+ label: String,+ onClick: () -> Unit,+ enabled: Boolean = true,+ destructive: Boolean = false,+ emphasized: Boolean = false+) {+ val containerColor = when {+ destructive -> AppColors.Live.copy(alpha = 0.18f)+ emphasized -> AppColors.Brand+ else -> Color.White.copy(alpha = 0.08f)+ }+ val contentColor = if (emphasized) Color.Black else AppColors.TextPrimary++ Button(+ onClick = onClick,+ enabled = enabled,+ colors = ButtonDefaults.colors(+ containerColor = containerColor,+ contentColor = contentColor,+ focusedContainerColor = if (destructive) AppColors.Live else AppColors.SurfaceEmphasis,+ focusedContentColor = AppColors.Focus,+ disabledContainerColor = AppColors.Surface.copy(alpha = 0.85f),+ disabledContentColor = AppColors.TextDisabled+ ),+ border = ButtonDefaults.border(+ focusedBorder = androidx.tv.material3.Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus)+ )+ ),+ scale = ButtonDefaults.scale(focusedScale = FocusSpec.FocusedScale)+ ) {+ Text(text = label, style = MaterialTheme.typography.labelLarge)+ }+}diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/ProgramHistoryDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/ProgramHistoryDialog.ktindex 6f11dacb..0a48984e 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/ProgramHistoryDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/ProgramHistoryDialog.kt@@ -2,29 +2,46 @@ package com.streamvault.app.ui.components.dialogsimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border-import androidx.compose.foundation.layout.*+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.heightIn+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.filled.Close-import androidx.compose.material3.*-import androidx.compose.runtime.*+import androidx.compose.material3.Icon+import androidx.compose.material3.IconButton+import androidx.compose.material3.MaterialTheme+import androidx.compose.material3.Surface+import androidx.compose.material3.Text+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.compose.ui.window.Dialog+import com.streamvault.app.Rimport com.streamvault.domain.model.Programimport java.text.SimpleDateFormat-import java.util.*-import androidx.compose.ui.res.stringResource-import com.streamvault.app.R+import java.util.Locale@Composablefun ProgramHistoryDialog(@@ -51,7 +68,9 @@ fun ProgramHistoryDialog() {Column(modifier = Modifier.padding(24.dp)) {Row(- modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),+ modifier = Modifier+ .fillMaxWidth()+ .padding(bottom = 16.dp),horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically) {@@ -61,16 +80,24 @@ fun ProgramHistoryDialog(fontWeight = FontWeight.Bold)IconButton(onClick = onDismiss) {- Icon(Icons.Default.Close, contentDescription = "Close")+ Icon(+ imageVector = Icons.Default.Close,+ contentDescription = stringResource(R.string.add_group_close_cd)+ )}}if (programs.isEmpty()) {Box(- modifier = Modifier.fillMaxWidth().height(200.dp),+ modifier = Modifier+ .fillMaxWidth()+ .height(200.dp),contentAlignment = Alignment.Center) {- Text(stringResource(R.string.player_no_archive), color = MaterialTheme.colorScheme.onSurfaceVariant)+ Text(+ text = stringResource(R.string.player_no_archive),+ color = MaterialTheme.colorScheme.onSurfaceVariant+ )}} else {LazyColumn(@@ -79,16 +106,22 @@ fun ProgramHistoryDialog() {items(programs) { program ->var isFocused by remember { mutableStateOf(false) }-+Surface(onClick = { onProgramSelect(program) },modifier = Modifier.fillMaxWidth().onFocusChanged { isFocused = it.isFocused }- .focusRequester(if (program == programs.first()) focusRequester else FocusRequester())+ .focusRequester(+ if (program == programs.first()) focusRequester else FocusRequester()+ ).border(width = if (isFocused) 2.dp else 1.dp,- color = if (isFocused) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outlineVariant,+ color = if (isFocused) {+ MaterialTheme.colorScheme.primary+ } else {+ MaterialTheme.colorScheme.outlineVariant+ },shape = RoundedCornerShape(8.dp)),shape = RoundedCornerShape(8.dp),@@ -113,7 +146,12 @@ fun ProgramHistoryDialog()}if (program.hasArchive) {- Text("📼", modifier = Modifier.padding(start = 8.dp))+ Text(+ text = stringResource(R.string.player_archive_badge),+ color = MaterialTheme.colorScheme.primary,+ style = MaterialTheme.typography.labelMedium,+ modifier = Modifier.padding(start = 8.dp)+ )}}}diff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/RenameGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/RenameGroupDialog.ktindex f658cfa3..9a3c33c0 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/RenameGroupDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/RenameGroupDialog.kt@@ -1,18 +1,36 @@package com.streamvault.app.ui.components.dialogs+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Rowimport androidx.compose.foundation.layout.fillMaxWidth-import androidx.compose.material3.AlertDialog+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.OutlinedTextField-import androidx.compose.material3.TextButtonimport androidx.compose.runtime.Composableimport androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.rememberimport androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Colorimport androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.theme.OnSurface+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceElevated@Composablefun RenameGroupDialog(@@ -23,36 +41,72 @@ fun RenameGroupDialog() {var value by rememberSaveable(initialName) { mutableStateOf(initialName) }- AlertDialog(+ Dialog(onDismissRequest = onDismissRequest,- title = {- androidx.tv.material3.Text(stringResource(R.string.category_options_rename))- },- text = {- OutlinedTextField(- value = value,- onValueChange = { value = it },- modifier = Modifier.fillMaxWidth(),- singleLine = true,- label = {- androidx.tv.material3.Text(stringResource(R.string.add_group_name_hint))- },- supportingText = errorMessage?.let { message ->- {- androidx.tv.material3.Text(message)+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(0.42f),+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .background(+ Brush.verticalGradient(+ listOf(+ Primary.copy(alpha = 0.08f),+ Color.Transparent+ )+ )+ )+ .padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ Text(+ text = stringResource(R.string.category_options_rename),+ style = MaterialTheme.typography.headlineMedium,+ color = OnSurface+ )+ Text(+ text = stringResource(R.string.library_saved_manage_hint),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+ OutlinedTextField(+ value = value,+ onValueChange = { value = it },+ modifier = Modifier.fillMaxWidth(),+ singleLine = true,+ label = { Text(stringResource(R.string.add_group_name_hint)) },+ supportingText = errorMessage?.let { message ->+ { Text(message) }+ }+ )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Button(+ onClick = onDismissRequest,+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) {+ Text(stringResource(R.string.add_group_cancel))+ }+ Button(+ onClick = { onConfirm(value) },+ colors = ButtonDefaults.colors(+ containerColor = Primary,+ contentColor = Color.White+ )+ ) {+ Text(stringResource(R.string.add_group_rename))}}- )- },- confirmButton = {- TextButton(onClick = { onConfirm(value) }) {- androidx.tv.material3.Text(stringResource(R.string.add_group_rename))- }- },- dismissButton = {- TextButton(onClick = onDismissRequest) {- androidx.tv.material3.Text(stringResource(R.string.add_group_cancel))}}- )+ }}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.ktnew file mode 100644index 00000000..d14a0cf4--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppMediaCards.kt@@ -0,0 +1,375 @@+package com.streamvault.app.ui.components.shell++import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+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.shape.RoundedCornerShape+import androidx.compose.material3.LinearProgressIndicator+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.draw.clip+import androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.tv.material3.Border+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import coil3.compose.AsyncImage+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.design.AppMotion+import com.streamvault.app.ui.design.FocusSpec+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.Episode+import com.streamvault.domain.model.Movie+import com.streamvault.domain.model.Series++@Composable+fun LiveChannelRowCard(+ channel: Channel,+ modifier: Modifier = Modifier+) {+ Box(+ modifier = modifier+ .clip(RoundedCornerShape(18.dp))+ .background(AppColors.SurfaceElevated)+ .fillMaxWidth()+ .height(92.dp)+ ) {+ Row(+ modifier = Modifier+ .fillMaxSize()+ .padding(horizontal = 12.dp, vertical = 8.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Box(+ modifier = Modifier+ .width(64.dp)+ .fillMaxHeight()+ .clip(RoundedCornerShape(12.dp))+ .background(AppColors.SurfaceEmphasis),+ contentAlignment = Alignment.Center+ ) {+ if (!channel.logoUrl.isNullOrBlank()) {+ AsyncImage(+ model = channel.logoUrl,+ contentDescription = null,+ modifier = Modifier+ .fillMaxSize()+ .padding(10.dp),+ contentScale = ContentScale.Fit+ )+ } else {+ Text(+ text = channel.name.take(2).uppercase(),+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextSecondary+ )+ }+ }+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(3.dp)+ ) {+ Row(+ horizontalArrangement = Arrangement.spacedBy(6.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ StatusPill(label = "LIVE", containerColor = AppColors.Live)+ if (channel.isFavorite) {+ StatusPill(label = "SAVED", containerColor = AppColors.Warning, contentColor = Color.Black)+ }+ if (channel.catchUpSupported) {+ StatusPill(label = "CATCH UP", containerColor = AppColors.Brand)+ }+ }+ Text(+ text = buildString {+ val numberLabel = channel.number.takeIf { it > 0 }?.toString()?.padStart(2, '0') ?: "--"+ append(numberLabel)+ append(" ")+ append(channel.name)+ },+ style = MaterialTheme.typography.titleSmall,+ color = AppColors.TextPrimary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ val program = channel.currentProgram+ if (program != null) {+ Text(+ text = program.title,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ val totalDuration = (program.endTime - program.startTime).coerceAtLeast(1L)+ val elapsed = (System.currentTimeMillis() - program.startTime).coerceAtLeast(0L)+ LinearProgressIndicator(+ progress = { (elapsed.toFloat() / totalDuration.toFloat()).coerceIn(0f, 1f) },+ modifier = Modifier+ .fillMaxWidth()+ .height(2.dp)+ .clip(RoundedCornerShape(999.dp)),+ color = AppColors.Info,+ trackColor = AppColors.SurfaceEmphasis+ )+ } else {+ Text(+ text = "No schedule information",+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextTertiary+ )+ }+ }+ }+ }+}++@Composable+fun LiveChannelRowSurface(+ channel: Channel,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+ onLongClick: (() -> Unit)? = null,+ isLocked: Boolean = false,+ isReorderMode: Boolean = false,+ isDragging: Boolean = false+) {+ var isFocused by remember { mutableStateOf(false) }+ val scale by animateFloatAsState(+ targetValue = if (isDragging) FocusSpec.FocusedScale else 1f,+ animationSpec = AppMotion.FocusSpec,+ label = "liveRowScale"+ )++ Surface(+ onClick = onClick,+ onLongClick = onLongClick,+ modifier = modifier+ .fillMaxWidth()+ .graphicsLayer {+ scaleX = scale+ scaleY = scale+ }+ .onFocusChanged { isFocused = it.isFocused },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(+ width = if (isDragging) 4.dp else FocusSpec.BorderWidth,+ color = if (isDragging) AppColors.Warning else AppColors.Focus+ ),+ shape = RoundedCornerShape(16.dp)+ )+ )+ ) {+ Box {+ LiveChannelRowCard(channel = channel, modifier = Modifier.fillMaxWidth())+ if (isLocked) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.HeroBottom.copy(alpha = 0.82f)),+ contentAlignment = Alignment.Center+ ) {+ StatusPill(+ label = "LOCKED",+ containerColor = AppColors.SurfaceEmphasis,+ contentColor = AppColors.TextPrimary+ )+ }+ }+ if (isReorderMode && isDragging) {+ Box(+ modifier = Modifier+ .align(Alignment.TopEnd)+ .padding(12.dp)+ ) {+ StatusPill(+ label = "MOVING",+ containerColor = AppColors.Warning,+ contentColor = Color.Black+ )+ }+ }+ }+ }+}++@Composable+fun MoviePosterCard(movie: Movie, modifier: Modifier = Modifier) {+ PosterCard(+ imageUrl = movie.posterUrl,+ title = movie.name,+ subtitle = movie.year,+ modifier = modifier+ )+}++@Composable+fun SeriesPosterCard(series: Series, modifier: Modifier = Modifier) {+ PosterCard(+ imageUrl = series.posterUrl,+ title = series.name,+ subtitle = series.releaseDate ?: series.genre,+ modifier = modifier+ )+}++@Composable+fun EpisodeRowCard(episode: Episode, modifier: Modifier = Modifier) {+ Box(+ modifier = modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(18.dp))+ .background(AppColors.SurfaceElevated)+ .padding(16.dp)+ ) {+ Row(horizontalArrangement = Arrangement.spacedBy(14.dp), verticalAlignment = Alignment.CenterVertically) {+ Box(+ modifier = Modifier+ .width(164.dp)+ .aspectRatio(16f / 9f)+ .clip(RoundedCornerShape(12.dp))+ .background(AppColors.SurfaceEmphasis),+ contentAlignment = Alignment.Center+ ) {+ if (!episode.coverUrl.isNullOrBlank()) {+ AsyncImage(+ model = episode.coverUrl,+ contentDescription = null,+ modifier = Modifier.fillMaxSize(),+ contentScale = ContentScale.Crop+ )+ } else {+ Text(+ text = "E${episode.episodeNumber}",+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextSecondary+ )+ }+ }+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Text(+ text = episode.title,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ ContentMetadataStrip(+ values = listOf("Episode ${episode.episodeNumber}", episode.duration ?: "")+ )+ episode.plot?.takeIf { it.isNotBlank() }?.let { plot ->+ Text(+ text = plot,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+ }+}++@Composable+private fun PosterCard(+ imageUrl: String?,+ title: String,+ subtitle: String?,+ modifier: Modifier = Modifier+) {+ Box(+ modifier = modifier+ .clip(RoundedCornerShape(20.dp))+ .background(AppColors.SurfaceElevated)+ ) {+ if (!imageUrl.isNullOrBlank()) {+ AsyncImage(+ model = imageUrl,+ contentDescription = title,+ modifier = Modifier.fillMaxSize(),+ contentScale = ContentScale.Crop+ )+ } else {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.SurfaceEmphasis),+ contentAlignment = Alignment.Center+ ) {+ Text(+ text = title.take(1).uppercase(),+ style = MaterialTheme.typography.displaySmall,+ color = AppColors.TextSecondary+ )+ }+ }++ Box(+ modifier = Modifier+ .fillMaxWidth()+ .fillMaxHeight(0.52f)+ .align(Alignment.BottomCenter)+ .background(+ Brush.verticalGradient(+ colors = listOf(Color.Transparent, AppColors.HeroBottom)+ )+ )+ )++ Column(+ modifier = Modifier+ .align(Alignment.BottomStart)+ .padding(14.dp),+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleSmall,+ color = AppColors.TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ subtitle?.takeIf { it.isNotBlank() }?.let {+ Text(+ text = it,+ style = MaterialTheme.typography.labelMedium,+ color = AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+}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.ktnew file mode 100644index 00000000..122f81c6--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/AppShell.kt@@ -0,0 +1,661 @@+package com.streamvault.app.ui.components.shell++import androidx.annotation.StringRes+import androidx.compose.animation.core.animateFloatAsState+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ColumnScope+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.wrapContentWidth+import androidx.compose.foundation.layout.RowScope+import androidx.compose.foundation.rememberScrollState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.foundation.horizontalScroll+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Favorite+import androidx.compose.material.icons.filled.Home+import androidx.compose.material.icons.filled.Info+import androidx.compose.material.icons.filled.Menu+import androidx.compose.material.icons.filled.Search+import androidx.compose.material.icons.filled.Settings+import androidx.compose.material.icons.filled.PlayArrow+import androidx.compose.material.icons.filled.Star+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.draw.clip+import androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.graphics.graphicsLayer+import androidx.compose.ui.graphics.vector.ImageVector+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.tv.material3.Border+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.Icon+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.navigation.Routes+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.design.AppMotion+import com.streamvault.app.ui.design.FocusSpec+import com.streamvault.app.ui.design.LocalAppSpacing++enum class AppNavigationChrome {+ Rail,+ TopBar+}++@Composable+fun AppScreenScaffold(+ currentRoute: String,+ onNavigate: (String) -> Unit,+ title: String,+ subtitle: String? = null,+ modifier: Modifier = Modifier,+ navigationChrome: AppNavigationChrome = AppNavigationChrome.Rail,+ compactHeader: Boolean = false,+ showScreenHeader: Boolean = true,+ header: (@Composable ColumnScope.() -> Unit)? = null,+ contentPadding: PaddingValues = PaddingValues(),+ content: @Composable ColumnScope.() -> Unit+) {+ val spacing = LocalAppSpacing.current++ Box(+ modifier = modifier+ .fillMaxSize()+ .background(+ Brush.linearGradient(+ colors = listOf(+ AppColors.Canvas,+ AppColors.CanvasElevated,+ AppColors.Surface+ )+ )+ )+ ) {+ if (navigationChrome == AppNavigationChrome.Rail) {+ Row(modifier = Modifier.fillMaxSize()) {+ DestinationRail(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ modifier = Modifier+ .fillMaxHeight()+ .width(spacing.railWidth)+ )++ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(+ start = spacing.lg,+ end = spacing.screenGutter,+ top = spacing.safeTop,+ bottom = spacing.safeBottom+ )+ ) {+ if (showScreenHeader) {+ AppScreenHeader(+ title = title,+ subtitle = subtitle,+ modifier = Modifier.fillMaxWidth(),+ compact = compactHeader+ )+ if (header != null) {+ Spacer(modifier = Modifier.height(spacing.lg))+ header()+ }+ Spacer(modifier = Modifier.height(spacing.lg))+ } else if (header != null) {+ header()+ }+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(contentPadding)+ ) {+ content()+ }+ }+ }+ } else {+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(+ horizontal = 14.dp,+ vertical = 10.dp+ )+ ) {+ TopNavigationBar(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ modifier = Modifier.fillMaxWidth()+ )+ Spacer(modifier = Modifier.height(10.dp))+ if (showScreenHeader) {+ AppScreenHeader(+ title = title,+ subtitle = subtitle,+ modifier = Modifier.fillMaxWidth(),+ compact = true+ )+ if (header != null) {+ Spacer(modifier = Modifier.height(8.dp))+ header()+ }+ Spacer(modifier = Modifier.height(8.dp))+ } else if (header != null) {+ header()+ }+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(contentPadding)+ ) {+ content()+ }+ }+ }+ }+}++@Composable+fun AppScreenHeader(+ title: String,+ subtitle: String? = null,+ modifier: Modifier = Modifier,+ eyebrow: String? = null,+ compact: Boolean = false+) {+ Column(+ modifier = modifier,+ verticalArrangement = Arrangement.spacedBy(6.dp)+ ) {+ if (!eyebrow.isNullOrBlank()) {+ Text(+ text = eyebrow,+ style = MaterialTheme.typography.labelMedium,+ color = AppColors.Brand+ )+ }+ Text(+ text = title,+ style = if (compact) MaterialTheme.typography.titleMedium else MaterialTheme.typography.displaySmall,+ color = AppColors.TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ if (!subtitle.isNullOrBlank()) {+ Text(+ text = subtitle,+ style = if (compact) MaterialTheme.typography.bodySmall else MaterialTheme.typography.bodyLarge,+ color = AppColors.TextSecondary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+}++@Composable+private fun TopNavigationBar(+ currentRoute: String,+ onNavigate: (String) -> Unit,+ modifier: Modifier = Modifier+) {+ val items = buildDestinationItems()+ val scrollState = rememberScrollState()++ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(18.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.Surface.copy(alpha = 0.9f))+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .height(56.dp)+ .padding(horizontal = 10.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ Text(+ text = stringResource(R.string.app_name),+ style = MaterialTheme.typography.titleSmall,+ color = AppColors.TextPrimary,+ modifier = Modifier+ .width(190.dp)+ .wrapContentWidth(Alignment.Start)+ )+ Spacer(modifier = Modifier.width(8.dp))+ Row(+ modifier = Modifier+ .weight(1f)+ .horizontalScroll(scrollState),+ horizontalArrangement = Arrangement.spacedBy(6.dp)+ ) {+ items.forEach { item ->+ TopNavigationButton(+ label = stringResource(item.labelRes),+ icon = item.icon,+ selected = currentRoute == item.route,+ onClick = {+ if (currentRoute != item.route) {+ onNavigate(item.route)+ }+ }+ )+ }+ }+ }+ }+}++@Composable+private fun TopNavigationButton(+ label: String,+ icon: ImageVector,+ selected: Boolean,+ onClick: () -> Unit+) {+ var isFocused by remember { mutableStateOf(false) }+ val scale by animateFloatAsState(+ targetValue = if (isFocused) FocusSpec.FocusedScale else 1f,+ animationSpec = AppMotion.FocusSpec,+ label = "topNavScale"+ )++ Surface(+ onClick = onClick,+ modifier = Modifier+ .graphicsLayer {+ scaleX = scale+ scaleY = scale+ }+ .onFocusChanged { isFocused = it.isFocused },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(14.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (selected) AppColors.BrandMuted else Color.Transparent,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),+ shape = RoundedCornerShape(14.dp)+ )+ )+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 6.dp),+ horizontalArrangement = Arrangement.spacedBy(6.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Icon(+ imageVector = icon,+ contentDescription = null,+ tint = if (selected) AppColors.Brand else AppColors.TextSecondary,+ modifier = Modifier.size(14.dp)+ )+ Text(+ text = label,+ style = MaterialTheme.typography.labelSmall,+ color = if (selected) AppColors.TextPrimary else AppColors.TextSecondary+ )+ }+ }+}++@Composable+fun AppHeroHeader(+ title: String,+ subtitle: String,+ modifier: Modifier = Modifier,+ eyebrow: String? = null,+ actions: (@Composable RowScope.() -> Unit)? = null,+ footer: (@Composable ColumnScope.() -> Unit)? = null+) {+ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(28.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ ) {+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .clip(RoundedCornerShape(28.dp))+ .background(+ Brush.horizontalGradient(+ colors = listOf(+ Color(0xFF081624),+ Color(0xFF10223A),+ Color(0xFF18314E)+ )+ )+ )+ .padding(32.dp)+ ) {+ Column(verticalArrangement = Arrangement.spacedBy(18.dp)) {+ AppScreenHeader(+ title = title,+ subtitle = subtitle,+ eyebrow = eyebrow+ )+ if (actions != null) {+ Row(+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically,+ content = actions+ )+ }+ if (footer != null) {+ footer()+ }+ }+ }+ }+}++@Composable+fun AppSectionHeader(+ title: String,+ subtitle: String? = null,+ modifier: Modifier = Modifier+) {+ Column(+ modifier = modifier,+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary+ )+ if (!subtitle.isNullOrBlank()) {+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextTertiary+ )+ }+ }+}++@Composable+fun StatusPill(+ label: String,+ modifier: Modifier = Modifier,+ containerColor: Color = AppColors.SurfaceEmphasis,+ contentColor: Color = AppColors.TextPrimary+) {+ Box(+ modifier = modifier+ .clip(RoundedCornerShape(999.dp))+ .background(containerColor)+ .padding(horizontal = 10.dp, vertical = 4.dp)+ ) {+ Text(+ text = label,+ style = MaterialTheme.typography.labelSmall,+ color = contentColor+ )+ }+}++@Composable+fun AppMessageState(+ title: String,+ subtitle: String,+ modifier: Modifier = Modifier,+ action: (@Composable () -> Unit)? = null+) {+ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(24.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 16.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary+ )+ if (action != null) {+ Spacer(modifier = Modifier.height(8.dp))+ action()+ }+ }+ }+}++@Composable+fun LoadMoreCard(+ label: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier+) {+ Surface(+ onClick = onClick,+ modifier = modifier,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),+ shape = RoundedCornerShape(18.dp)+ )+ )+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp),+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Icon(+ imageVector = Icons.Default.Info,+ contentDescription = null,+ tint = AppColors.Brand,+ modifier = Modifier.size(18.dp)+ )+ Text(+ text = label,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary+ )+ }+ }+}++@Composable+fun ContentMetadataStrip(+ values: List<String>,+ modifier: Modifier = Modifier+) {+ val filteredValues = values.filter { it.isNotBlank() }+ Row(+ modifier = modifier,+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ filteredValues.forEachIndexed { index, value ->+ Text(+ text = value,+ style = MaterialTheme.typography.labelMedium,+ color = AppColors.TextSecondary+ )+ if (index < filteredValues.lastIndex) {+ Box(+ modifier = Modifier+ .size(4.dp)+ .clip(RoundedCornerShape(999.dp))+ .background(AppColors.TextTertiary)+ )+ }+ }+ }+}++@Composable+private fun DestinationRail(+ currentRoute: String,+ onNavigate: (String) -> Unit,+ modifier: Modifier = Modifier+) {+ val spacing = LocalAppSpacing.current+ val items = buildDestinationItems()++ Box(+ modifier = modifier+ .padding(start = spacing.lg, top = spacing.safeTop, bottom = spacing.safeBottom)+ .clip(RoundedCornerShape(28.dp))+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.SurfaceElevated,+ AppColors.Surface+ )+ )+ )+ ) {+ Column(+ modifier = Modifier+ .fillMaxSize()+ .padding(horizontal = 12.dp, vertical = 20.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Text(+ text = stringResource(R.string.app_name),+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary+ )+ Text(+ text = "TV",+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.TextTertiary+ )+ Spacer(modifier = Modifier.height(10.dp))+ items.forEach { item ->+ RailButton(+ label = stringResource(item.labelRes),+ icon = item.icon,+ selected = currentRoute == item.route,+ onClick = {+ if (currentRoute != item.route) {+ onNavigate(item.route)+ }+ }+ )+ }+ }+ }+}++@Composable+private fun RailButton(+ label: String,+ icon: ImageVector,+ selected: Boolean,+ onClick: () -> Unit+) {+ var isFocused by remember { mutableStateOf(false) }+ val scale by animateFloatAsState(+ targetValue = if (isFocused) FocusSpec.FocusedScale else 1f,+ animationSpec = AppMotion.FocusSpec,+ label = "railButtonScale"+ )++ Surface(+ onClick = onClick,+ modifier = Modifier+ .fillMaxWidth()+ .graphicsLayer {+ scaleX = scale+ scaleY = scale+ }+ .onFocusChanged { isFocused = it.isFocused },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (selected) AppColors.BrandMuted else Color.Transparent,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),+ shape = RoundedCornerShape(18.dp)+ )+ )+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 14.dp, vertical = 14.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Icon(+ imageVector = icon,+ contentDescription = null,+ tint = if (selected) AppColors.Brand else AppColors.TextSecondary,+ modifier = Modifier.size(20.dp)+ )+ Text(+ text = label,+ style = MaterialTheme.typography.titleSmall,+ color = if (selected) AppColors.TextPrimary else AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+}++private data class DestinationItem(+ val route: String,+ @StringRes val labelRes: Int,+ val icon: ImageVector+)++@Composable+private fun buildDestinationItems(): List<DestinationItem> = listOf(+ DestinationItem(Routes.HOME, R.string.nav_home, Icons.Default.Home),+ DestinationItem(Routes.LIVE_TV, R.string.nav_live_tv, Icons.Default.PlayArrow),+ DestinationItem(Routes.MOVIES, R.string.nav_movies, Icons.Default.Star),+ DestinationItem(Routes.SERIES, R.string.nav_series, Icons.Default.Menu),+ DestinationItem(Routes.FAVORITES, R.string.favorites_title, Icons.Default.Favorite),+ DestinationItem(Routes.EPG, R.string.nav_epg, Icons.Default.Info),+ DestinationItem(Routes.SEARCH, R.string.search_title, Icons.Default.Search),+ DestinationItem(Routes.SETTINGS, R.string.nav_settings, Icons.Default.Settings)+)diff --git a/app/src/main/java/com/streamvault/app/ui/components/shell/LibraryBrowseScaffold.kt b/app/src/main/java/com/streamvault/app/ui/components/shell/LibraryBrowseScaffold.ktnew file mode 100644index 00000000..d8fd33c3--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/components/shell/LibraryBrowseScaffold.kt@@ -0,0 +1,290 @@+package com.streamvault.app.ui.components.shell++import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ColumnScope+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxSize+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.LazyListScope+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.layout.ContentScale+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.tv.material3.Border+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import coil3.compose.AsyncImage+import com.streamvault.app.ui.components.SearchInput+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.design.FocusSpec+import com.streamvault.app.ui.design.LocalAppSpacing++@Composable+fun LibraryBrowseScaffold(+ currentRoute: String,+ onNavigate: (String) -> Unit,+ title: String,+ subtitle: String,+ modifier: Modifier = Modifier,+ header: (@Composable ColumnScope.() -> Unit)? = null,+ railContent: @Composable ColumnScope.() -> Unit,+ content: @Composable ColumnScope.() -> Unit+) {+ val spacing = LocalAppSpacing.current+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = title,+ subtitle = subtitle,+ modifier = modifier,+ header = header+ ) {+ Row(modifier = Modifier.fillMaxSize()) {+ Column(+ modifier = Modifier+ .width(312.dp)+ .fillMaxHeight()+ ) {+ railContent()+ }+ Spacer(modifier = Modifier.width(spacing.lg))+ Column(+ modifier = Modifier+ .weight(1f)+ .fillMaxHeight(),+ verticalArrangement = Arrangement.spacedBy(spacing.lg)+ ) {+ content()+ }+ }+ }+}++@Composable+fun CategoryRailPanel(+ title: String,+ searchValue: String,+ onSearchValueChange: (String) -> Unit,+ searchPlaceholder: String,+ modifier: Modifier = Modifier,+ searchFocusRequester: FocusRequester = FocusRequester(),+ headerContent: (@Composable ColumnScope.() -> Unit)? = null,+ contentPadding: PaddingValues = PaddingValues(bottom = 16.dp),+ content: LazyListScope.() -> Unit+) {+ val spacing = LocalAppSpacing.current+ Surface(+ modifier = modifier.fillMaxSize(),+ shape = RoundedCornerShape(28.dp),+ colors = androidx.tv.material3.SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.SurfaceElevated,+ AppColors.Surface+ )+ )+ )+ .padding(horizontal = spacing.md, vertical = spacing.md)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )+ Spacer(modifier = Modifier.height(spacing.sm))+ SearchInput(+ value = searchValue,+ onValueChange = onSearchValueChange,+ placeholder = searchPlaceholder,+ focusRequester = searchFocusRequester+ )+ if (headerContent != null) {+ Spacer(modifier = Modifier.height(spacing.sm))+ headerContent()+ }+ Spacer(modifier = Modifier.height(spacing.sm))+ LazyColumn(+ modifier = Modifier.fillMaxSize(),+ verticalArrangement = Arrangement.spacedBy(4.dp),+ contentPadding = contentPadding,+ content = content+ )+ }+ }+}++@Composable+fun BrowseSearchLaunchCard(+ title: String,+ subtitle: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier+) {+ Surface(+ onClick = onClick,+ modifier = modifier.fillMaxWidth(),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(22.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),+ shape = RoundedCornerShape(22.dp)+ )+ )+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 20.dp, vertical = 18.dp),+ verticalArrangement = Arrangement.spacedBy(6.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodyMedium,+ color = AppColors.TextSecondary+ )+ }+ }+}++@Composable+fun BrowseHeroPanel(+ title: String,+ subtitle: String,+ onClick: () -> Unit,+ modifier: Modifier = Modifier,+ eyebrow: String? = null,+ imageUrl: String? = null,+ metadata: List<String> = emptyList(),+ actionLabel: String+) {+ Surface(+ onClick = onClick,+ modifier = modifier+ .fillMaxWidth()+ .height(240.dp),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(28.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus),+ shape = RoundedCornerShape(28.dp)+ )+ )+ ) {+ Box(modifier = Modifier.fillMaxSize()) {+ if (!imageUrl.isNullOrBlank()) {+ AsyncImage(+ model = imageUrl,+ contentDescription = null,+ modifier = Modifier.fillMaxSize(),+ contentScale = ContentScale.Crop+ )+ } else {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(+ Brush.horizontalGradient(+ colors = listOf(+ AppColors.Canvas,+ AppColors.CanvasElevated,+ AppColors.SurfaceEmphasis+ )+ )+ )+ )+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.HeroTop,+ Color.Transparent,+ AppColors.HeroBottom+ )+ )+ )+ )++ Column(+ modifier = Modifier+ .align(Alignment.BottomStart)+ .padding(22.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ eyebrow?.takeIf { it.isNotBlank() }?.let {+ Text(+ text = it,+ style = MaterialTheme.typography.labelMedium,+ color = AppColors.BrandStrong+ )+ }+ Text(+ text = title,+ style = MaterialTheme.typography.displaySmall,+ color = AppColors.TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ Text(+ text = subtitle,+ style = MaterialTheme.typography.bodyLarge,+ color = AppColors.TextSecondary,+ maxLines = 3,+ overflow = TextOverflow.Ellipsis+ )+ if (metadata.isNotEmpty()) {+ ContentMetadataStrip(values = metadata)+ }+ Button(+ onClick = onClick,+ colors = ButtonDefaults.colors(+ containerColor = AppColors.Brand,+ contentColor = Color.Black+ )+ ) {+ Text(actionLabel)+ }+ }+ }+ }+}diff --git a/app/src/main/java/com/streamvault/app/ui/design/AppColors.kt b/app/src/main/java/com/streamvault/app/ui/design/AppColors.ktnew file mode 100644index 00000000..337f4cf5--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/AppColors.kt@@ -0,0 +1,33 @@+package com.streamvault.app.ui.design++import androidx.compose.ui.graphics.Color++object AppColors {+ val Canvas = Color(0xFF07111B)+ val CanvasElevated = Color(0xFF0B1622)+ val Surface = Color(0xFF0F1B29)+ val SurfaceElevated = Color(0xFF162338)+ val SurfaceEmphasis = Color(0xFF1D2E46)+ val SurfaceAccent = Color(0xFF223754)++ val Brand = Color(0xFF69A8FF)+ val BrandMuted = Color(0x335FA4FF)+ val BrandStrong = Color(0xFF8BBCFF)+ val Focus = Color(0xFFF4F8FF)++ val TextPrimary = Color(0xFFF5F7FB)+ val TextSecondary = Color(0xFFBBC6D8)+ val TextTertiary = Color(0xFF7F8DA5)+ val TextDisabled = Color(0xFF566173)++ val Live = Color(0xFFFF5C61)+ val Success = Color(0xFF4FD39A)+ val Warning = Color(0xFFFFC766)+ val Info = Color(0xFF57C9FF)++ val Divider = Color(0x1AF4F8FF)+ val Outline = Color(0x264C6D95)++ val HeroTop = Color(0xCC07111B)+ val HeroBottom = Color(0xF207111B)+}diff --git a/app/src/main/java/com/streamvault/app/ui/design/AppMotion.kt b/app/src/main/java/com/streamvault/app/ui/design/AppMotion.ktnew file mode 100644index 00000000..f96ed6b7--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/AppMotion.kt@@ -0,0 +1,16 @@+package com.streamvault.app.ui.design++import androidx.compose.animation.core.FiniteAnimationSpec+import androidx.compose.animation.core.LinearOutSlowInEasing+import androidx.compose.animation.core.tween++object AppMotion {+ const val Fast = 120+ const val Standard = 160+ const val Emphasis = 180++ val FocusSpec: FiniteAnimationSpec<Float> = tween(+ durationMillis = Standard,+ easing = LinearOutSlowInEasing+ )+}diff --git a/app/src/main/java/com/streamvault/app/ui/design/AppShapes.kt b/app/src/main/java/com/streamvault/app/ui/design/AppShapes.ktnew file mode 100644index 00000000..29b2d497--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/AppShapes.kt@@ -0,0 +1,14 @@+package com.streamvault.app.ui.design++import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.staticCompositionLocalOf+import androidx.compose.ui.unit.dp++data class AppShapes(+ val small: RoundedCornerShape = RoundedCornerShape(12.dp),+ val medium: RoundedCornerShape = RoundedCornerShape(18.dp),+ val large: RoundedCornerShape = RoundedCornerShape(24.dp),+ val pill: RoundedCornerShape = RoundedCornerShape(999.dp)+)++val LocalAppShapes = staticCompositionLocalOf { AppShapes() }diff --git a/app/src/main/java/com/streamvault/app/ui/design/AppSpacing.kt b/app/src/main/java/com/streamvault/app/ui/design/AppSpacing.ktnew file mode 100644index 00000000..2257fed7--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/AppSpacing.kt@@ -0,0 +1,23 @@+package com.streamvault.app.ui.design++import androidx.compose.runtime.staticCompositionLocalOf+import androidx.compose.ui.unit.Dp+import androidx.compose.ui.unit.dp++data class AppSpacing(+ val xs: Dp = 8.dp,+ val sm: Dp = 12.dp,+ val md: Dp = 16.dp,+ val lg: Dp = 24.dp,+ val xl: Dp = 32.dp,+ val xxl: Dp = 40.dp,+ val screenGutter: Dp = 56.dp,+ val railWidth: Dp = 124.dp,+ val sectionGap: Dp = 32.dp,+ val cardGap: Dp = 16.dp,+ val chipGap: Dp = 10.dp,+ val safeTop: Dp = 32.dp,+ val safeBottom: Dp = 32.dp+)++val LocalAppSpacing = staticCompositionLocalOf { AppSpacing() }diff --git a/app/src/main/java/com/streamvault/app/ui/design/AppTypography.kt b/app/src/main/java/com/streamvault/app/ui/design/AppTypography.ktnew file mode 100644index 00000000..bdfd0931--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/AppTypography.kt@@ -0,0 +1,109 @@+package com.streamvault.app.ui.design++import androidx.compose.ui.text.TextStyle+import androidx.compose.ui.text.font.Font+import androidx.compose.ui.text.font.FontFamily+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.unit.sp+import androidx.tv.material3.Typography+import com.streamvault.app.R++val InterFamily = FontFamily(+ Font(R.font.inter_regular, FontWeight.Normal),+ Font(R.font.inter_medium, FontWeight.Medium),+ Font(R.font.inter_semibold, FontWeight.SemiBold),+ Font(R.font.inter_bold, FontWeight.Bold)+)++val AppTypography = Typography(+ displayLarge = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Bold,+ fontSize = 34.sp,+ lineHeight = 40.sp+ ),+ displayMedium = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Bold,+ fontSize = 30.sp,+ lineHeight = 36.sp+ ),+ displaySmall = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Bold,+ fontSize = 24.sp,+ lineHeight = 30.sp+ ),+ headlineLarge = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.SemiBold,+ fontSize = 24.sp,+ lineHeight = 30.sp+ ),+ headlineMedium = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.SemiBold,+ fontSize = 20.sp,+ lineHeight = 26.sp+ ),+ headlineSmall = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.SemiBold,+ fontSize = 18.sp,+ lineHeight = 24.sp+ ),+ titleLarge = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.SemiBold,+ fontSize = 18.sp,+ lineHeight = 24.sp+ ),+ titleMedium = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.SemiBold,+ fontSize = 16.sp,+ lineHeight = 22.sp+ ),+ titleSmall = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Medium,+ fontSize = 14.sp,+ lineHeight = 20.sp+ ),+ bodyLarge = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Normal,+ fontSize = 15.sp,+ lineHeight = 20.sp+ ),+ bodyMedium = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Normal,+ fontSize = 14.sp,+ lineHeight = 18.sp+ ),+ bodySmall = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Normal,+ fontSize = 12.sp,+ lineHeight = 16.sp+ ),+ labelLarge = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Medium,+ fontSize = 13.sp,+ lineHeight = 16.sp+ ),+ labelMedium = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Medium,+ fontSize = 12.sp,+ lineHeight = 14.sp+ ),+ labelSmall = TextStyle(+ fontFamily = InterFamily,+ fontWeight = FontWeight.Medium,+ fontSize = 11.sp,+ lineHeight = 13.sp+ )+)diff --git a/app/src/main/java/com/streamvault/app/ui/design/FocusHelpers.kt b/app/src/main/java/com/streamvault/app/ui/design/FocusHelpers.ktnew file mode 100644index 00000000..7d6e6fa6--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/FocusHelpers.kt@@ -0,0 +1,33 @@+package com.streamvault.app.ui.design++import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.remember+import androidx.compose.ui.focus.FocusRequester++data class FocusMemoryKey(+ val screen: String,+ val slot: String+)++@Composable+fun rememberFocusMemoryKey(screen: String, slot: String): FocusMemoryKey {+ return remember(screen, slot) { FocusMemoryKey(screen = screen, slot = slot) }+}++@Composable+fun TvInitialFocus(+ focusRequester: FocusRequester,+ enabled: Boolean = true+) {+ LaunchedEffect(focusRequester, enabled) {+ if (enabled) {+ runCatching { focusRequester.requestFocus() }+ }+ }+}++@Composable+fun FocusRestoreHost(content: @Composable () -> Unit) {+ content()+}diff --git a/app/src/main/java/com/streamvault/app/ui/design/FocusSpec.kt b/app/src/main/java/com/streamvault/app/ui/design/FocusSpec.ktnew file mode 100644index 00000000..75f380aa--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/design/FocusSpec.kt@@ -0,0 +1,9 @@+package com.streamvault.app.ui.design++import androidx.compose.ui.unit.dp++object FocusSpec {+ const val FocusedScale = 1.015f+ const val PressedScale = 0.98f+ val BorderWidth = 2.dp+}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.ktindex bf77f431..8e470568 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/dashboard/DashboardScreen.kt@@ -1,4 +1,4 @@-package com.streamvault.app.ui.screens.dashboard+package com.streamvault.app.ui.screens.dashboardimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Arrangement@@ -45,7 +45,11 @@ import com.streamvault.app.ui.components.ChannelCardimport com.streamvault.app.ui.components.ContinueWatchingRowimport com.streamvault.app.ui.components.MovieCardimport com.streamvault.app.ui.components.SeriesCard-import com.streamvault.app.ui.components.TopNavBar+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppHeroHeader+import com.streamvault.app.ui.components.shell.AppScreenScaffold+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.app.ui.theme.FocusBorderimport com.streamvault.app.ui.theme.OnBackgroundimport com.streamvault.app.ui.theme.OnSurfaceDim@@ -76,65 +80,30 @@ fun DashboardScreen(viewModel: DashboardViewModel = hiltViewModel()) {val uiState by viewModel.uiState.collectAsState()-- Column(modifier = Modifier.fillMaxSize()) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = onNavigate,- modifier = Modifier.fillMaxWidth()- )-- val provider = uiState.provider+ val provider = uiState.provider++ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_home),+ subtitle = provider?.name,+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false+ ) {if (provider == null) {EmptyDashboard(onAddProvider = onAddProvider,onOpenSettings = { onNavigate(Routes.SETTINGS) })- return@Column+ return@AppScreenScaffold}val orderedSections = rememberDashboardSections(uiState)androidx.compose.foundation.lazy.LazyColumn(modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(bottom = 40.dp)+ contentPadding = PaddingValues(bottom = 28.dp)) {- item {- DashboardHero(- providerName = provider.name,- feature = uiState.feature,- stats = uiState.stats,- onOpenLiveTv = { onNavigate(Routes.LIVE_TV) },- onOpenGuide = { onNavigate(Routes.EPG) },- onOpenSearch = { onNavigate(Routes.SEARCH) },- onOpenSavedLibrary = { onNavigate(Routes.FAVORITES) },- onFeatureAction = {- when (uiState.feature.actionType) {- DashboardFeatureAction.LIVE -> onNavigate(Routes.LIVE_TV)- DashboardFeatureAction.CONTINUE_WATCHING -> uiState.continueWatching.firstOrNull()?.let(onPlaybackHistoryClick)- DashboardFeatureAction.MOVIES -> onNavigate(Routes.MOVIES)- DashboardFeatureAction.SERIES -> onNavigate(Routes.SERIES)- }- }- )- }-- item {- DashboardProviderHealthCard(- providerName = provider.name,- health = uiState.providerHealth,- onOpenDiagnostics = { onNavigate(Routes.SETTINGS) }- )- }-- if (uiState.providerWarnings.isNotEmpty()) {- item {- DashboardProviderWarningCard(- warnings = uiState.providerWarnings,- onOpenSettings = { onNavigate(Routes.SETTINGS) }- )- }- }-items(orderedSections, key = { it.name }) { section ->when (section) {DashboardHomeSection.LIVE_SHORTCUTS -> DashboardShortcutRow(@@ -148,16 +117,12 @@ fun DashboardScreen(})- DashboardHomeSection.FAVORITE_CHANNELS -> CategoryRow(+ DashboardHomeSection.FAVORITE_CHANNELS -> FavoriteChannelsRow(title = stringResource(R.string.dashboard_favorite_channels),- items = uiState.favoriteChannels,- onSeeAll = { onNavigate(Routes.liveTv(com.streamvault.domain.model.VirtualCategoryIds.FAVORITES)) }- ) { channel ->- ChannelCard(- channel = channel,- onClick = { onChannelClick(channel) }- )- }+ channels = uiState.favoriteChannels,+ onSeeAll = { onNavigate(Routes.liveTv(com.streamvault.domain.model.VirtualCategoryIds.FAVORITES)) },+ onChannelClick = onChannelClick+ )DashboardHomeSection.RECENT_CHANNELS -> CategoryRow(title = stringResource(R.string.dashboard_recent_channels),@@ -199,6 +164,7 @@ fun DashboardScreen(}}}+}}}@@ -214,121 +180,68 @@ private fun DashboardHero(onOpenSavedLibrary: () -> Unit,onFeatureAction: () -> Unit) {- Surface(+ Box(modifier = Modifier.fillMaxWidth()- .padding(horizontal = 48.dp, vertical = 24.dp),- shape = RoundedCornerShape(28.dp),- colors = SurfaceDefaults.colors(- containerColor = SurfaceElevated- )+ .padding(horizontal = 24.dp, vertical = 8.dp)) {- Box(- modifier = Modifier- .fillMaxWidth()- .height(380.dp)- .background(- Brush.linearGradient(- colors = listOf(- Color(0xFF07111F),- Color(0xFF0B2240),- Color(0xFF111827)- )- )- )- ) {- if (!feature.artworkUrl.isNullOrBlank()) {- AsyncImage(- model = feature.artworkUrl,- contentDescription = null,- contentScale = ContentScale.Crop,- modifier = Modifier- .fillMaxSize()- .clip(RoundedCornerShape(28.dp))- )- Box(- modifier = Modifier- .fillMaxSize()- .background(- Brush.horizontalGradient(- colors = listOf(- Color.Black.copy(alpha = 0.84f),- Color.Black.copy(alpha = 0.68f),- Color.Black.copy(alpha = 0.28f)- )+ if (!feature.artworkUrl.isNullOrBlank()) {+ AsyncImage(+ model = feature.artworkUrl,+ contentDescription = null,+ contentScale = ContentScale.Crop,+ modifier = Modifier+ .fillMaxWidth()+ .height(220.dp)+ .clip(RoundedCornerShape(28.dp))+ )+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .height(220.dp)+ .clip(RoundedCornerShape(28.dp))+ .background(+ Brush.horizontalGradient(+ colors = listOf(+ Color.Black.copy(alpha = 0.88f),+ Color.Black.copy(alpha = 0.72f),+ Color.Black.copy(alpha = 0.34f)))- )- }+ )+ )+ }- Column(- modifier = Modifier- .fillMaxSize()- .padding(horizontal = 32.dp, vertical = 28.dp),- verticalArrangement = Arrangement.SpaceBetween- ) {- Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- Text(- text = stringResource(R.string.dashboard_title),- style = MaterialTheme.typography.displaySmall,- color = TextPrimary- )- Text(- text = stringResource(R.string.dashboard_subtitle, providerName),- style = MaterialTheme.typography.titleMedium,- color = OnSurfaceDim- )+ AppHeroHeader(+ eyebrow = providerName,+ title = feature.title.ifBlank { stringResource(R.string.dashboard_title) },+ subtitle = feature.summary.ifBlank { stringResource(R.string.dashboard_subtitle, providerName) },+ modifier = Modifier+ .fillMaxWidth()+ .height(220.dp),+ footer = {+ Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = stringResource(R.string.nav_live_tv), containerColor = AppColors.BrandMuted)+ StatusPill(label = stringResource(R.string.nav_epg), containerColor = AppColors.SurfaceEmphasis)+ StatusPill(label = stringResource(R.string.favorites_title), containerColor = AppColors.Warning, contentColor = Color.Black)}-DashboardStatRow(stats = stats)}-- Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {- Text(- text = feature.title,- style = MaterialTheme.typography.headlineLarge,- color = TextPrimary,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )- Text(- text = feature.summary,- style = MaterialTheme.typography.titleMedium,- color = TextTertiary,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )- }-- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {- DashboardActionButton(- label = stringResource(R.string.nav_live_tv),- onClick = onOpenLiveTv- )- DashboardActionButton(- label = stringResource(R.string.nav_epg),- onClick = onOpenGuide- )- DashboardActionButton(- label = stringResource(R.string.dashboard_search_library),- onClick = onOpenSearch- )- DashboardActionButton(- label = stringResource(R.string.favorites_title),- onClick = onOpenSavedLibrary- )- if (feature.actionLabel.isNotBlank()) {- DashboardActionButton(- label = feature.actionLabel,- onClick = onFeatureAction- )- }- }+ },+ actions = {+ DashboardActionButton(label = stringResource(R.string.nav_live_tv), onClick = onOpenLiveTv)+ DashboardActionButton(label = stringResource(R.string.nav_epg), onClick = onOpenGuide)+ DashboardActionButton(label = stringResource(R.string.dashboard_search_library), onClick = onOpenSearch)+ DashboardActionButton(label = stringResource(R.string.favorites_title), onClick = onOpenSavedLibrary)+ if (feature.actionLabel.isNotBlank()) {+ DashboardActionButton(+ label = feature.actionLabel,+ onClick = onFeatureAction+ )}}- }+ )}}@@ -350,7 +263,7 @@ private fun DashboardStatRow(Surface(shape = RoundedCornerShape(999.dp),colors = SurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.08f)+ containerColor = AppColors.Surface.copy(alpha = 0.64f))) {Text(@@ -374,27 +287,27 @@ private fun DashboardShortcutRow(Column(modifier = Modifier.fillMaxWidth()- .padding(top = 8.dp)+ .padding(top = 4.dp)) {Column(- modifier = Modifier.padding(horizontal = 48.dp, vertical = 8.dp),+ modifier = Modifier.padding(horizontal = 24.dp, vertical = 6.dp),verticalArrangement = Arrangement.spacedBy(4.dp)) {Text(text = title,- style = MaterialTheme.typography.titleMedium,+ style = MaterialTheme.typography.titleSmall,color = TextPrimary)Text(text = subtitle,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim)}LazyRow(- contentPadding = PaddingValues(horizontal = 48.dp),- horizontalArrangement = Arrangement.spacedBy(14.dp)+ contentPadding = PaddingValues(horizontal = 24.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp)) {items(shortcuts, key = { "${it.type}:${it.categoryId}:${it.label}" }) { shortcut ->DashboardShortcutCard(@@ -421,9 +334,9 @@ private fun DashboardShortcutCard(Surface(onClick = onClick,modifier = Modifier- .width(220.dp)- .height(108.dp),- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),+ .width(170.dp)+ .height(76.dp),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = SurfaceElevated,focusedContainerColor = SurfaceHighlight@@ -431,18 +344,18 @@ private fun DashboardShortcutCard(border = ClickableSurfaceDefaults.border(border = Border(border = BorderStroke(1.dp, accentColor.copy(alpha = 0.28f)),- shape = RoundedCornerShape(18.dp)+ shape = RoundedCornerShape(16.dp)),focusedBorder = Border(border = BorderStroke(2.dp, FocusBorder),- shape = RoundedCornerShape(18.dp)+ shape = RoundedCornerShape(16.dp)))) {Column(modifier = Modifier.fillMaxSize()- .padding(horizontal = 16.dp, vertical = 14.dp),+ .padding(horizontal = 12.dp, vertical = 10.dp),verticalArrangement = Arrangement.SpaceBetween) {Row(@@ -457,7 +370,7 @@ private fun DashboardShortcutCard()Text(text = shortcut.label,- style = MaterialTheme.typography.titleSmall,+ style = MaterialTheme.typography.bodyLarge,color = TextPrimary,maxLines = 1,overflow = TextOverflow.Ellipsis@@ -465,7 +378,7 @@ private fun DashboardShortcutCard(}Text(text = shortcut.detail,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim,maxLines = 2,overflow = TextOverflow.Ellipsis@@ -497,19 +410,20 @@ private fun DashboardProviderHealthCard(health: DashboardProviderHealth,onOpenDiagnostics: () -> Unit) {+ val context = androidx.compose.ui.platform.LocalContext.currentval syncLabel = remember(health.lastSyncedAt) {if (health.lastSyncedAt <= 0L) {- "No recent sync"+ context.getString(R.string.dashboard_provider_no_sync)} else {val format = SimpleDateFormat("MMM d, HH:mm", Locale.getDefault())- "Synced ${format.format(Date(health.lastSyncedAt))}"+ context.getString(R.string.dashboard_provider_synced_at, format.format(Date(health.lastSyncedAt)))}}val expiryLabel = remember(health.expirationDate) {health.expirationDate?.let {val format = SimpleDateFormat("MMM d, yyyy", Locale.getDefault())- "Expires ${format.format(Date(it))}"- } ?: "No expiry reported"+ context.getString(R.string.dashboard_provider_expires_at, format.format(Date(it)))+ } ?: context.getString(R.string.dashboard_provider_no_expiry)}val statusLabel = when (health.status) {com.streamvault.domain.model.ProviderStatus.ACTIVE -> stringResource(R.string.settings_status_active)@@ -553,7 +467,7 @@ private fun DashboardProviderHealthCard(color = OnSurfaceDim)Text(- text = "$syncLabel • $expiryLabel",+ text = "$syncLabel | $expiryLabel",style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim)@@ -722,40 +636,14 @@ private fun rememberDashboardSections(uiState.recentMovies,uiState.recentSeries) {- val preferred = when (uiState.feature.actionType) {- DashboardFeatureAction.CONTINUE_WATCHING -> listOf(- DashboardHomeSection.CONTINUE_WATCHING,- DashboardHomeSection.RECENT_CHANNELS,- DashboardHomeSection.FAVORITE_CHANNELS,- DashboardHomeSection.RECENT_MOVIES,- DashboardHomeSection.RECENT_SERIES,- DashboardHomeSection.LIVE_SHORTCUTS- )- DashboardFeatureAction.MOVIES -> listOf(- DashboardHomeSection.RECENT_MOVIES,- DashboardHomeSection.CONTINUE_WATCHING,- DashboardHomeSection.RECENT_SERIES,- DashboardHomeSection.RECENT_CHANNELS,- DashboardHomeSection.FAVORITE_CHANNELS,- DashboardHomeSection.LIVE_SHORTCUTS- )- DashboardFeatureAction.SERIES -> listOf(- DashboardHomeSection.RECENT_SERIES,- DashboardHomeSection.CONTINUE_WATCHING,- DashboardHomeSection.RECENT_MOVIES,- DashboardHomeSection.RECENT_CHANNELS,- DashboardHomeSection.FAVORITE_CHANNELS,- DashboardHomeSection.LIVE_SHORTCUTS- )- DashboardFeatureAction.LIVE -> listOf(- DashboardHomeSection.RECENT_CHANNELS,- DashboardHomeSection.FAVORITE_CHANNELS,- DashboardHomeSection.LIVE_SHORTCUTS,- DashboardHomeSection.CONTINUE_WATCHING,- DashboardHomeSection.RECENT_MOVIES,- DashboardHomeSection.RECENT_SERIES- )- }+ val preferred = listOf(+ DashboardHomeSection.FAVORITE_CHANNELS,+ DashboardHomeSection.CONTINUE_WATCHING,+ DashboardHomeSection.RECENT_MOVIES,+ DashboardHomeSection.RECENT_SERIES,+ DashboardHomeSection.LIVE_SHORTCUTS,+ DashboardHomeSection.RECENT_CHANNELS+ )preferred.filter { section ->when (section) {@@ -778,3 +666,118 @@ private enum class DashboardHomeSection {RECENT_MOVIES,RECENT_SERIES}++@Composable+private fun FavoriteChannelsRow(+ title: String,+ channels: List<Channel>,+ onSeeAll: () -> Unit,+ onChannelClick: (Channel) -> Unit+) {+ Column(modifier = Modifier.fillMaxWidth()) {+ 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+ )+ 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 = TextTertiary+ )+ ) {+ Text(+ text = stringResource(R.string.category_see_all),+ style = MaterialTheme.typography.labelSmall,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)+ )+ }+ }++ LazyRow(+ contentPadding = PaddingValues(horizontal = 20.dp),+ horizontalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ items(channels, key = { it.id }) { channel ->+ FavoriteChannelLogoCard(+ channel = channel,+ onClick = { onChannelClick(channel) }+ )+ }+ }+ }+}++@Composable+private fun FavoriteChannelLogoCard(+ channel: Channel,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ modifier = Modifier.width(86.dp),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = SurfaceHighlight+ ),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(2.dp, FocusBorder),+ shape = RoundedCornerShape(18.dp)+ )+ )+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 8.dp),+ verticalArrangement = Arrangement.spacedBy(6.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Box(+ modifier = Modifier+ .size(54.dp)+ .clip(RoundedCornerShape(999.dp))+ .background(AppColors.SurfaceEmphasis),+ contentAlignment = Alignment.Center+ ) {+ if (!channel.logoUrl.isNullOrBlank()) {+ AsyncImage(+ model = channel.logoUrl,+ contentDescription = null,+ contentScale = ContentScale.Fit,+ modifier = Modifier+ .fillMaxSize()+ .padding(8.dp)+ )+ } else {+ Text(+ text = channel.name.take(2).uppercase(),+ style = MaterialTheme.typography.labelLarge,+ color = TextPrimary+ )+ }+ }++ Text(+ text = channel.name,+ style = MaterialTheme.typography.bodySmall,+ color = TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+}+diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.ktindex 26f017ee..0e7edbb1 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt@@ -32,6 +32,7 @@ import androidx.compose.runtime.getValueimport androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.produceStateimport androidx.compose.runtime.remember+import androidx.compose.runtime.saveable.rememberSaveableimport androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -54,7 +55,8 @@ import com.streamvault.app.Rimport com.streamvault.app.navigation.Routesimport com.streamvault.app.ui.components.SelectionChipimport com.streamvault.app.ui.components.SelectionChipRow-import com.streamvault.app.ui.components.TopNavBar+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppScreenScaffoldimport com.streamvault.app.ui.theme.FocusBorderimport com.streamvault.app.ui.theme.OnBackgroundimport com.streamvault.app.ui.theme.OnSurface@@ -89,6 +91,7 @@ fun FullEpgScreen() {val uiState by viewModel.uiState.collectAsState()var selectedProgram by remember { mutableStateOf<Pair<Channel, Program>?>(null) }+ var showAdvancedOptions by rememberSaveable { mutableStateOf(false) }val now = rememberGuideNow()val returnRoute = remember(uiState.selectedCategoryId, uiState.guideAnchorTime, uiState.showFavoritesOnly) {Routes.epg(@@ -106,127 +109,136 @@ fun FullEpgScreen()}- Column(- modifier = Modifier- .fillMaxSize()- .background(MaterialTheme.colorScheme.background)+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_epg),+ subtitle = stringResource(R.string.guide_shell_subtitle),+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = onNavigate,+ Column(modifier = Modifier- .fillMaxWidth()- .padding(top = 16.dp, bottom = 12.dp)- )+ .fillMaxSize()+ .background(MaterialTheme.colorScheme.background)+ ) {+ if (uiState.error == null) {+ GuideFilterRow(+ categories = uiState.categories,+ selectedCategoryId = uiState.selectedCategoryId,+ onCategorySelected = viewModel::selectCategory+ )- if (uiState.error == null) {- GuideFilterRow(- categories = uiState.categories,- selectedCategoryId = uiState.selectedCategoryId,- onCategorySelected = viewModel::selectCategory- )+ GuideTimeControlsRow(+ onJumpToPreviousDay = viewModel::jumpToPreviousDay,+ onPageBackward = viewModel::pageBackward,+ onJumpBackwardHalfHour = viewModel::jumpBackwardHalfHour,+ onJumpBackward = viewModel::jumpBackward,+ onJumpToNow = viewModel::jumpToNow,+ onJumpForwardHalfHour = viewModel::jumpForwardHalfHour,+ onJumpForward = viewModel::jumpForward,+ onPageForward = viewModel::pageForward,+ onJumpToPrimeTime = viewModel::jumpToPrimeTime,+ onJumpToTomorrow = viewModel::jumpToTomorrow,+ onJumpToNextDay = viewModel::jumpToNextDay+ )- GuideTimeControlsRow(- onJumpToPreviousDay = viewModel::jumpToPreviousDay,- onPageBackward = viewModel::pageBackward,- onJumpBackwardHalfHour = viewModel::jumpBackwardHalfHour,- onJumpBackward = viewModel::jumpBackward,- onJumpToNow = viewModel::jumpToNow,- onJumpForwardHalfHour = viewModel::jumpForwardHalfHour,- onJumpForward = viewModel::jumpForward,- onPageForward = viewModel::pageForward,- onJumpToPrimeTime = viewModel::jumpToPrimeTime,- onJumpToTomorrow = viewModel::jumpToTomorrow,- onJumpToNextDay = viewModel::jumpToNextDay- )+ GuideDayRow(+ selectedDayStart = startOfDay(uiState.guideWindowStart + EpgViewModel.LOOKBACK_MS),+ onDaySelected = viewModel::jumpToDay+ )- GuideDayRow(- selectedDayStart = startOfDay(uiState.guideWindowStart + EpgViewModel.LOOKBACK_MS),- onDaySelected = viewModel::jumpToDay- )+ GuideOptionsToggleRow(+ expanded = showAdvancedOptions,+ onToggle = { showAdvancedOptions = !showAdvancedOptions }+ )- GuideModeRow(- selectedMode = uiState.selectedChannelMode,- onModeSelected = viewModel::selectChannelMode- )+ if (showAdvancedOptions) {+ GuideModeRow(+ selectedMode = uiState.selectedChannelMode,+ onModeSelected = viewModel::selectChannelMode+ )- GuideDensityRow(- selectedDensity = uiState.selectedDensity,- onDensitySelected = viewModel::selectDensity- )+ GuideDensityRow(+ selectedDensity = uiState.selectedDensity,+ onDensitySelected = viewModel::selectDensity+ )- GuideViewOptionsRow(- showScheduledOnly = uiState.showScheduledOnly,- onToggleScheduledOnly = viewModel::toggleScheduledOnly- )+ GuideViewOptionsRow(+ showScheduledOnly = uiState.showScheduledOnly,+ onToggleScheduledOnly = viewModel::toggleScheduledOnly+ )- GuideFavoritesRow(- showFavoritesOnly = uiState.showFavoritesOnly,- onToggleFavoritesOnly = viewModel::toggleFavoritesOnly- )+ GuideFavoritesRow(+ showFavoritesOnly = uiState.showFavoritesOnly,+ onToggleFavoritesOnly = viewModel::toggleFavoritesOnly+ )+ }- GuideSummaryCard(uiState = uiState)- }+ GuideSummaryCard(uiState = uiState)+ }- when {- uiState.isLoading -> {- Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Text(stringResource(R.string.epg_loading), color = OnBackground)+ when {+ uiState.isLoading -> {+ Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {+ Text(stringResource(R.string.epg_loading), color = OnBackground)+ }}- }- uiState.error != null -> {- GuideMessageState(- title = when (uiState.error) {- EpgViewModel.NO_ACTIVE_PROVIDER -> stringResource(R.string.epg_no_provider)- else -> stringResource(R.string.epg_error)- },- subtitle = when (uiState.error) {- EpgViewModel.NO_ACTIVE_PROVIDER -> null- else -> stringResource(R.string.epg_retry_hint)- },- actionLabel = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else stringResource(R.string.epg_retry),- onAction = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else viewModel::refresh- )- }+ uiState.error != null -> {+ GuideMessageState(+ title = when (uiState.error) {+ EpgViewModel.NO_ACTIVE_PROVIDER -> stringResource(R.string.epg_no_provider)+ else -> stringResource(R.string.epg_error)+ },+ subtitle = when (uiState.error) {+ EpgViewModel.NO_ACTIVE_PROVIDER -> null+ else -> stringResource(R.string.epg_retry_hint)+ },+ actionLabel = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else stringResource(R.string.epg_retry),+ onAction = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else viewModel::refresh+ )+ }- uiState.channels.isEmpty() -> {- GuideMessageState(- title = if (uiState.selectedCategoryId == ChannelRepository.ALL_CHANNELS_ID) {- if (uiState.showScheduledOnly) {- stringResource(R.string.epg_no_scheduled_channels)+ uiState.channels.isEmpty() -> {+ GuideMessageState(+ title = if (uiState.selectedCategoryId == ChannelRepository.ALL_CHANNELS_ID) {+ if (uiState.showScheduledOnly) {+ stringResource(R.string.epg_no_scheduled_channels)+ } else {+ stringResource(R.string.epg_no_data)+ }} else {- stringResource(R.string.epg_no_data)- }- } else {- if (uiState.showScheduledOnly) {- stringResource(R.string.epg_no_scheduled_channels)+ if (uiState.showScheduledOnly) {+ stringResource(R.string.epg_no_scheduled_channels)+ } else {+ stringResource(R.string.epg_no_channels_in_category)+ }+ },+ subtitle = if (uiState.showScheduledOnly) {+ stringResource(R.string.epg_scheduled_only_hint)} else {- stringResource(R.string.epg_no_channels_in_category)- }- },- subtitle = if (uiState.showScheduledOnly) {- stringResource(R.string.epg_scheduled_only_hint)- } else {- stringResource(R.string.epg_filter_hint)- },- actionLabel = stringResource(R.string.epg_retry),- onAction = viewModel::refresh- )- }+ stringResource(R.string.epg_filter_hint)+ },+ actionLabel = stringResource(R.string.epg_retry),+ onAction = viewModel::refresh+ )+ }- else -> {- EpgGrid(- channels = uiState.channels,- favoriteChannelIds = uiState.favoriteChannelIds,- programsByChannel = uiState.programsByChannel,- guideWindowStart = uiState.guideWindowStart,- guideWindowEnd = uiState.guideWindowEnd,- density = uiState.selectedDensity,- now = now,- onChannelClick = { channel -> onPlayChannel(channel, returnRoute) },- onProgramClick = { channel, program -> selectedProgram = channel to program }- )+ else -> {+ EpgGrid(+ channels = uiState.channels,+ favoriteChannelIds = uiState.favoriteChannelIds,+ programsByChannel = uiState.programsByChannel,+ guideWindowStart = uiState.guideWindowStart,+ guideWindowEnd = uiState.guideWindowEnd,+ density = uiState.selectedDensity,+ now = now,+ onChannelClick = { channel -> onPlayChannel(channel, returnRoute) },+ onProgramClick = { channel, program -> selectedProgram = channel to program }+ )+ }}}}@@ -962,6 +974,41 @@ private fun GuideShortcutChip(}}+@Composable+private fun GuideOptionsToggleRow(+ expanded: Boolean,+ onToggle: () -> Unit+) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 24.dp, vertical = 4.dp)+ ) {+ Surface(+ onClick = onToggle,+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceElevated,+ focusedContainerColor = SurfaceHighlight,+ contentColor = OnSurface,+ focusedContentColor = OnSurface+ ),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ border = ClickableSurfaceDefaults.border(+ focusedBorder = Border(+ border = BorderStroke(2.dp, FocusBorder),+ shape = RoundedCornerShape(999.dp)+ )+ )+ ) {+ Text(+ text = stringResource(if (expanded) R.string.epg_hide_options else R.string.epg_show_options),+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp),+ style = MaterialTheme.typography.labelLarge+ )+ }+ }+}+@Composableprivate fun GuideSummaryCard(uiState: EpgUiState) {val lastUpdatedLabel = uiState.lastUpdatedAt?.let { timestamp ->diff --git a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesScreen.ktindex ed8f1b1d..8903f492 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesScreen.kt@@ -51,7 +51,14 @@ import androidx.tv.material3.Textimport com.streamvault.app.Rimport com.streamvault.app.ui.components.SelectionChipimport com.streamvault.app.ui.components.SelectionChipRow-import com.streamvault.app.ui.components.TopNavBar+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogActionButton+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButton+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppHeroHeader+import com.streamvault.app.ui.components.shell.AppScreenScaffold+import com.streamvault.app.ui.components.shell.AppSectionHeader+import com.streamvault.app.ui.components.shell.StatusPillimport com.streamvault.app.ui.theme.CardBackgroundimport com.streamvault.app.ui.theme.OnBackgroundimport com.streamvault.app.ui.theme.OnPrimary@@ -341,46 +348,53 @@ fun FavoritesScreen())- Column(modifier = Modifier.fillMaxSize()) {- TopNavBar(currentRoute = currentRoute, onNavigate = onNavigate)-- when {- uiState.isLoading -> {- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Text(- text = stringResource(R.string.favorites_loading),- style = MaterialTheme.typography.bodyLarge,- color = OnSurface- )- }- }-- uiState.sections.isEmpty() -> {- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Box(modifier = Modifier.fillMaxSize()) {+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.favorites_title),+ subtitle = stringResource(R.string.saved_shell_subtitle),+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false+ ) {+ when {+ uiState.isLoading -> {+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {Text(- text = stringResource(R.string.favorites_no_favorites),- style = MaterialTheme.typography.titleLarge,+ text = stringResource(R.string.favorites_loading),+ style = MaterialTheme.typography.bodyLarge,color = OnSurface)- Spacer(Modifier.height(8.dp))- Text(- text = stringResource(R.string.favorites_empty_hint),- style = MaterialTheme.typography.bodyMedium,- color = OnSurfaceDim- )}}- }- else -> {- Box(modifier = Modifier.fillMaxSize()) {- LazyColumn(- state = listState,- modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(32.dp),- verticalArrangement = Arrangement.spacedBy(10.dp)- ) {+ uiState.sections.isEmpty() -> {+ Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {+ Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Text(+ text = stringResource(R.string.favorites_no_favorites),+ style = MaterialTheme.typography.titleLarge,+ color = OnSurface+ )+ Spacer(Modifier.height(8.dp))+ Text(+ text = stringResource(R.string.favorites_empty_hint),+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+ }+ }+ }++ else -> {+ Box(modifier = Modifier.fillMaxSize()) {+ LazyColumn(+ state = listState,+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(bottom = 32.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {item(key = "summary") {SavedLibrarySummaryCard(summary = providerScopedSummary,@@ -578,31 +592,32 @@ fun FavoritesScreen()}}- }+ }- androidx.compose.animation.AnimatedVisibility(- visible = uiState.isReorderMode && activeReorderSection != null,- enter = slideInHorizontally(initialOffsetX = { it }) + fadeIn(),- exit = slideOutHorizontally(targetOffsetX = { it }) + fadeOut(),- modifier = Modifier- .align(Alignment.TopEnd)- .padding(top = 24.dp)- ) {- ReorderPanel(- section = activeReorderSection,- movingFavoriteId = uiState.reorderItem?.id- )+ androidx.compose.animation.AnimatedVisibility(+ visible = uiState.isReorderMode && activeReorderSection != null,+ enter = slideInHorizontally(initialOffsetX = { it }) + fadeIn(),+ exit = slideOutHorizontally(targetOffsetX = { it }) + fadeOut(),+ modifier = Modifier+ .align(Alignment.TopEnd)+ .padding(top = 24.dp)+ ) {+ ReorderPanel(+ section = activeReorderSection,+ movingFavoriteId = uiState.reorderItem?.id+ )+ }}-- SnackbarHost(- hostState = snackbarHostState,- modifier = Modifier- .align(Alignment.BottomCenter)- .padding(bottom = 18.dp)- )}}}++ SnackbarHost(+ hostState = snackbarHostState,+ modifier = Modifier+ .align(Alignment.BottomCenter)+ .padding(bottom = 18.dp)+ )}androidx.compose.runtime.LaunchedEffect(uiState.userMessage) {@@ -665,29 +680,24 @@ private fun SavedLibrarySummaryCard(currentFilter: SavedLibraryFilter) {Surface(- modifier = Modifier.fillMaxWidth(),shape = RoundedCornerShape(18.dp),- colors = androidx.tv.material3.SurfaceDefaults.colors(containerColor = SurfaceElevated)+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)) {Column(- modifier = Modifier.padding(horizontal = 24.dp, vertical = 20.dp),- verticalArrangement = Arrangement.spacedBy(8.dp)+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 18.dp, vertical = 16.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)) {- Text(- text = stringResource(R.string.favorites_overview_title),- style = MaterialTheme.typography.titleLarge,- color = OnSurface- )- Text(- text = stringResource(+ AppSectionHeader(+ title = stringResource(R.string.favorites_overview_title),+ subtitle = stringResource(R.string.favorites_overview_subtitle,summary.totalItems,summary.customGroupCount- ),- style = MaterialTheme.typography.bodyMedium,- color = OnSurfaceDim+ ))- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {SavedLibraryStatPill(label = stringResource(R.string.search_live_tv),value = summary.liveCount,@@ -704,17 +714,9 @@ private fun SavedLibrarySummaryCard(highlighted = currentFilter == SavedLibraryFilter.SERIES)}- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {- SavedLibraryStatPill(- label = stringResource(R.string.favorites_continue_short),- value = summary.continueWatchingCount,- highlighted = false- )- SavedLibraryStatPill(- label = stringResource(R.string.favorites_recent_short),- value = summary.recentLiveCount,- highlighted = false- )+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = stringResource(R.string.favorites_continue_short) + " ${summary.continueWatchingCount}")+ StatusPill(label = stringResource(R.string.favorites_recent_short) + " ${summary.recentLiveCount}")}}}@@ -734,8 +736,8 @@ private fun SavedLibraryStatPill() {Text(text = "$label $value",- modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),- style = MaterialTheme.typography.labelLarge,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 8.dp),+ style = MaterialTheme.typography.labelMedium,color = if (highlighted) Primary else OnSurface)}@@ -890,40 +892,32 @@ private fun SavedItemOptionsDialog(onRemove: () -> Unit,onMoveToGroup: (FavoriteUiModel, Long) -> Unit) {- androidx.compose.material3.AlertDialog(+ PremiumDialog(+ title = item.title,+ subtitle = stringResource(R.string.library_saved_manage_hint),onDismissRequest = onDismiss,- title = { androidx.compose.material3.Text(item.title) },- text = {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- androidx.tv.material3.Button(- onClick = onRemove,- modifier = Modifier.fillMaxWidth()- ) {- Text(- text = if (item.favorite.groupId == null) {- stringResource(R.string.saved_item_remove_saved)- } else {- stringResource(R.string.saved_item_remove_group)- }- )- }- moveTargets.forEach { target ->- androidx.tv.material3.Button(- onClick = { onMoveToGroup(item, target.group.id) },- modifier = Modifier.fillMaxWidth()- ) {- Text(- text = stringResource(R.string.saved_item_move_to, target.group.name)- )- }- }+ content = {+ PremiumDialogActionButton(+ label = if (item.favorite.groupId == null) {+ stringResource(R.string.saved_item_remove_saved)+ } else {+ stringResource(R.string.saved_item_remove_group)+ },+ onClick = onRemove,+ destructive = true+ )+ moveTargets.forEach { target ->+ PremiumDialogActionButton(+ label = stringResource(R.string.saved_item_move_to, target.group.name),+ onClick = { onMoveToGroup(item, target.group.id) }+ )}},- confirmButton = {},- dismissButton = {- androidx.compose.material3.TextButton(onClick = onDismiss) {- androidx.compose.material3.Text(stringResource(R.string.settings_cancel))- }+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )})}@@ -938,64 +932,48 @@ private fun SavedGroupOptionsDialog(onMerge: () -> Unit,onDelete: () -> Unit) {- androidx.compose.material3.AlertDialog(+ PremiumDialog(+ title = group.group.name,+ subtitle = stringResource(R.string.saved_group_manage_subtitle),onDismissRequest = onDismiss,- title = { androidx.compose.material3.Text(group.group.name) },- text = {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- if (group.itemCount > 1) {- androidx.tv.material3.Button(- onClick = onReorder,- modifier = Modifier.fillMaxWidth()- ) {- Text(stringResource(R.string.category_options_reorder))- }- }- onTogglePromotion?.let { toggle ->- androidx.tv.material3.Button(- onClick = toggle,- modifier = Modifier.fillMaxWidth()- ) {- Text(- text = if (group.isPromotedOnHome) {- stringResource(R.string.saved_group_demote_home)- } else {- stringResource(R.string.saved_group_promote_home)- }- )- }- }- if (canMerge) {- androidx.tv.material3.Button(- onClick = onMerge,- modifier = Modifier.fillMaxWidth()- ) {- Text(stringResource(R.string.saved_group_merge))- }- }- androidx.tv.material3.Button(- onClick = onDelete,- modifier = Modifier.fillMaxWidth(),- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Color(0x44D32F2F),- contentColor = Color.White- )- ) {- Text(- text = if (group.itemCount == 0) {- stringResource(R.string.saved_group_delete_empty)- } else {- stringResource(R.string.category_options_delete)- }- )- }+ content = {+ if (group.itemCount > 1) {+ PremiumDialogActionButton(+ label = stringResource(R.string.category_options_reorder),+ onClick = onReorder+ )}- },- confirmButton = {},- dismissButton = {- androidx.compose.material3.TextButton(onClick = onDismiss) {- androidx.compose.material3.Text(stringResource(R.string.settings_cancel))+ onTogglePromotion?.let { toggle ->+ PremiumDialogActionButton(+ label = if (group.isPromotedOnHome) {+ stringResource(R.string.saved_group_demote_home)+ } else {+ stringResource(R.string.saved_group_promote_home)+ },+ onClick = toggle+ )+ }+ if (canMerge) {+ PremiumDialogActionButton(+ label = stringResource(R.string.saved_group_merge),+ onClick = onMerge+ )}+ PremiumDialogActionButton(+ label = if (group.itemCount == 0) {+ stringResource(R.string.saved_group_delete_empty)+ } else {+ stringResource(R.string.category_options_delete)+ },+ onClick = onDelete,+ destructive = true+ )+ },+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )})}@@ -1007,26 +985,23 @@ private fun MergeSavedGroupDialog(onDismiss: () -> Unit,onTargetSelected: (Long) -> Unit) {- androidx.compose.material3.AlertDialog(+ PremiumDialog(+ title = stringResource(R.string.saved_group_merge_title, source.group.name),+ subtitle = stringResource(R.string.saved_group_manage_subtitle),onDismissRequest = onDismiss,- title = { androidx.compose.material3.Text(stringResource(R.string.saved_group_merge_title, source.group.name)) },- text = {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- targets.forEach { target ->- androidx.tv.material3.Button(- onClick = { onTargetSelected(target.group.id) },- modifier = Modifier.fillMaxWidth()- ) {- Text(text = target.group.name)- }- }+ content = {+ targets.forEach { target ->+ PremiumDialogActionButton(+ label = target.group.name,+ onClick = { onTargetSelected(target.group.id) }+ )}},- confirmButton = {},- dismissButton = {- androidx.compose.material3.TextButton(onClick = onDismiss) {- androidx.compose.material3.Text(stringResource(R.string.settings_cancel))- }+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )})}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.ktindex d2c89aa9..d5bfbab1 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt@@ -275,16 +275,12 @@ class FavoritesViewModel @Inject constructor(providerId = entry.providerId)},- recentLive = recentLiveHistory.mapNotNull { entry ->- val channel = liveById[entry.contentId] ?: return@mapNotNull null+ recentLive = recentLiveHistory.mapIndexedNotNull { index, entry ->+ val channel = liveById[entry.contentId] ?: return@mapIndexedNotNull nullSavedHistoryUiModel(history = entry,title = channel.name,- subtitle = if (channel.number > 0) {- "Channel ${channel.number}"- } else {- "Recent live channel"- },+ subtitle = "Channel ${index + 1}",providerId = channel.providerId,categoryId = channel.categoryId,epgChannelId = channel.epgChannelId,@@ -613,13 +609,13 @@ class FavoritesViewModel @Inject constructor(val moviesById = movies.associateBy { it.id }val seriesById = series.associateBy { it.id }- orderedFavorites.mapNotNull { favorite ->+ orderedFavorites.mapIndexedNotNull { index, favorite ->when (favorite.contentType) {ContentType.LIVE -> channelsById[favorite.contentId]?.let { channel ->FavoriteUiModel(favorite = favorite,title = channel.name,- subtitle = if (channel.number > 0) "Channel ${channel.number}" else "Live channel",+ subtitle = "Channel ${index + 1}",lastWatchedAt = historyMap[Triple(favorite.contentType, favorite.contentId, channel.providerId)]?.lastWatchedAt ?: 0L,streamUrl = channel.streamUrl,providerId = channel.providerId,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.ktindex 1e1b8237..54bf81b9 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt@@ -5,6 +5,7 @@ import androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.items+import androidx.compose.foundation.lazy.rememberLazyListStateimport androidx.compose.foundation.lazy.grid.LazyVerticalGridimport androidx.compose.foundation.lazy.grid.GridCellsimport androidx.compose.foundation.lazy.grid.items@@ -37,17 +38,25 @@ import androidx.compose.material3.SnackbarHostStateimport androidx.compose.material3.TextButtonimport com.streamvault.app.ui.components.CategoryRowimport com.streamvault.app.ui.components.ChannelCard+import com.streamvault.app.ui.components.shell.ContentMetadataStrip+import com.streamvault.app.ui.components.shell.LiveChannelRowSurface+import com.streamvault.app.ui.components.shell.StatusPillimport com.streamvault.app.ui.components.dialogs.CategoryOptionsDialogimport com.streamvault.app.ui.components.dialogs.PinDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButtonimport com.streamvault.app.ui.components.dialogs.RenameGroupDialog-import com.streamvault.app.ui.components.TopNavBar+import com.streamvault.app.ui.components.ReorderTopBarimport com.streamvault.app.ui.components.SkeletonCardimport com.streamvault.app.ui.components.shimmerEffect+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppScreenScaffoldimport com.streamvault.app.ui.theme.*import com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Providerimport kotlinx.coroutines.launch+import kotlinx.coroutines.flow.distinctUntilChangedimport androidx.compose.ui.res.stringResourceimport com.streamvault.app.Rimport com.streamvault.app.ui.screens.multiview.MultiViewViewModel@@ -173,63 +182,22 @@ fun HomeScreen(}Box(modifier = Modifier.fillMaxSize()) {- Column(modifier = Modifier.fillMaxSize()) {- Row(- modifier = Modifier.fillMaxWidth().height(80.dp),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- if (uiState.isChannelReorderMode) {- androidx.compose.animation.AnimatedVisibility(- visible = true,- enter = androidx.compose.animation.slideInVertically(initialOffsetY = { -it }),- exit = androidx.compose.animation.slideOutVertically(targetOffsetY = { -it }),- modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp)- ) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- Text(- "Reordering '${uiState.reorderCategory?.name ?: uiState.selectedCategory?.name ?: "Channels"}'",- style = MaterialTheme.typography.titleLarge,- color = Primary- )- Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {- androidx.tv.material3.Button(- onClick = { viewModel.exitChannelReorderMode() },- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = MaterialTheme.colorScheme.surfaceVariant,- contentColor = OnSurface- )- ) { Text("Cancel", modifier = Modifier.padding(horizontal = 8.dp)) }-- androidx.tv.material3.Button(- onClick = { viewModel.saveChannelReorder() },- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Primary,- contentColor = Color.White- )- ) { Text("Save Order", modifier = Modifier.padding(horizontal = 8.dp)) }- }- }- }- } else {- androidx.compose.animation.AnimatedVisibility(- visible = true,- enter = androidx.compose.animation.slideInVertically(initialOffsetY = { -it }),- exit = androidx.compose.animation.slideOutVertically(targetOffsetY = { -it })- ) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = onNavigate,- modifier = Modifier.fillMaxWidth()- )- }- }-- // Playlist Switcher - REMOVED (Moved to Settings)+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_live_tv),+ subtitle = uiState.provider?.name,+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false+ ) {+ if (uiState.isChannelReorderMode) {+ ReorderTopBar(+ categoryName = uiState.reorderCategory?.name ?: uiState.selectedCategory?.name ?: "Channels",+ onSave = { viewModel.saveChannelReorder() },+ onCancel = { viewModel.exitChannelReorderMode() },+ subtitle = stringResource(R.string.live_reorder_subtitle)+ )}if (uiState.isLoading && uiState.categories.isEmpty()) {@@ -349,25 +317,25 @@ fun HomeScreen(Column(modifier = Modifier- .width(280.dp)+ .width(272.dp).fillMaxHeight()- .background(SurfaceElevated)- .padding(top = 16.dp)+ .background(SurfaceElevated.copy(alpha = 0.88f), RoundedCornerShape(20.dp))+ .padding(top = 10.dp)) {// Sticky Header Part- Column(modifier = Modifier.padding(horizontal = 24.dp)) {+ Column(modifier = Modifier.padding(horizontal = 10.dp)) {Text(text = stringResource(R.string.home_categories_title),style = MaterialTheme.typography.titleMedium,color = OnSurface,- modifier = Modifier.padding(bottom = 8.dp, start = 8.dp)+ modifier = Modifier.padding(bottom = 8.dp, start = 4.dp))SearchInput(value = uiState.categorySearchQuery,onValueChange = { viewModel.updateCategorySearchQuery(it) },placeholder = stringResource(R.string.home_search_categories),focusRequester = categorySearchFocusRequester,- modifier = Modifier.padding(bottom = 16.dp)+ modifier = Modifier.padding(bottom = 10.dp))}@@ -408,7 +376,7 @@ fun HomeScreen(horizontalArrangement = Arrangement.spacedBy(8.dp)) {Text(- text = "🔳",+ text = "SPLIT",fontSize = 14.sp)Column(modifier = Modifier.weight(1f)) {@@ -483,18 +451,26 @@ fun HomeScreen(.fillMaxHeight()) {// Category Title Header and Search- Row(+ Column(modifier = Modifier.fillMaxWidth()- .padding(start = 24.dp, top = 24.dp, bottom = 16.dp, end = 24.dp),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ .padding(start = 8.dp, top = 2.dp, bottom = 8.dp, end = 8.dp),+ verticalArrangement = Arrangement.spacedBy(6.dp)) {Text(text = uiState.selectedCategory?.name ?: stringResource(R.string.home_all_channels),- style = MaterialTheme.typography.headlineSmall,+ style = MaterialTheme.typography.titleLarge,color = OnBackground)+ ContentMetadataStrip(+ values = buildList {+ add("${stringResource(R.string.live_shell_provider)}: ${uiState.provider?.name ?: stringResource(R.string.playlist_no_provider)}")+ add(stringResource(R.string.live_channel_results, uiState.filteredChannels.size))+ uiState.lastVisitedCategory?.name?.let {+ add("${stringResource(R.string.live_shell_last_group)}: $it")+ }+ }+ )Row(horizontalArrangement = Arrangement.spacedBy(12.dp),verticalAlignment = Alignment.CenterVertically@@ -505,8 +481,13 @@ fun HomeScreen(placeholder = stringResource(R.string.home_search_channels),onSearch = { focusManager.clearFocus() },focusRequester = channelSearchFocusRequester,- modifier = Modifier.width(300.dp)+ modifier = Modifier.width(340.dp))+ if (hasSplitChannels) {+ StatusPill(+ label = "${stringResource(R.string.live_shell_split)} ${splitSlots.count { it != null }}/4"+ )+ }}}@@ -533,31 +514,32 @@ fun HomeScreen(modifier = Modifier.fillMaxSize(),contentAlignment = Alignment.Center) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Column(+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(6.dp)+ ) {Text(- text = "📺",- style = MaterialTheme.typography.displayLarge+ text = stringResource(R.string.home_no_channels_found),+ style = MaterialTheme.typography.titleLarge,+ color = OnBackground)- Spacer(modifier = Modifier.height(8.dp))Text(- text = stringResource(R.string.home_no_channels_found),- style = MaterialTheme.typography.bodyLarge,- color = OnSurface+ text = stringResource(R.string.home_no_channels_found_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim)val selectedCategory = uiState.selectedCategoryif (selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.FAVORITES) {Text(text = stringResource(R.string.home_add_favorites_hint),style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim,- modifier = Modifier.padding(top = 4.dp)+ color = OnSurfaceDim)} else if (selectedCategory?.isVirtual == true && selectedCategory.id == VirtualCategoryIds.RECENT) {Text(text = stringResource(R.string.home_recent_channels_hint),style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim,- modifier = Modifier.padding(top = 4.dp)+ color = OnSurfaceDim)}}@@ -565,6 +547,7 @@ fun HomeScreen(} else {// Shared lock state for all itemsvar ignoreNextClick by remember { mutableStateOf(false) }+ val channelListState = rememberLazyListState()// Auto-reset lock if click never comes (e.g. user drags away)LaunchedEffect(ignoreNextClick) {@@ -584,8 +567,26 @@ fun HomeScreen(}}- LazyVerticalGrid(- columns = GridCells.Adaptive(minSize = 180.dp),+ LaunchedEffect(channelListState, uiState.filteredChannels, lastFocusedChannelId) {+ snapshotFlow {+ channelListState.layoutInfo.visibleItemsInfo.mapNotNull { item ->+ uiState.filteredChannels.getOrNull(item.index)?.id+ } to lastFocusedChannelId+ }+ .distinctUntilChanged()+ .collect { (visibleIds, focusedId) ->+ viewModel.updateVisibleChannelWindow(visibleIds, focusedId)+ }+ }++ DisposableEffect(Unit) {+ onDispose {+ viewModel.updateVisibleChannelWindow(emptyList(), null)+ }+ }++ LazyColumn(+ state = channelListState,modifier = Modifier.fillMaxSize()// Handle BACK key to cancel reorder mode@@ -603,12 +604,11 @@ fun HomeScreen(} else false},contentPadding = PaddingValues(- start = LocalSpacing.current.safeHoriz,- end = LocalSpacing.current.safeHoriz,- bottom = LocalSpacing.current.safeBottom+ start = 10.dp,+ end = 10.dp,+ bottom = 16.dp),- verticalArrangement = Arrangement.spacedBy(LocalSpacing.current.sm),- horizontalArrangement = Arrangement.spacedBy(LocalSpacing.current.sm)+ verticalArrangement = Arrangement.spacedBy(8.dp)) {items(items = uiState.filteredChannels,@@ -618,7 +618,7 @@ fun HomeScreen(val isDraggingThis = draggingChannel == channelval channelFocusRequester = channelFocusRequesters.getOrPut(channel.id) { FocusRequester() }- ChannelCard(+ LiveChannelRowSurface(channel = channel,isLocked = isLocked,isReorderMode = uiState.isChannelReorderMode,@@ -646,7 +646,7 @@ fun HomeScreen(}},modifier = Modifier- .aspectRatio(16f/9f)+ .fillMaxWidth().focusRequester(channelFocusRequester).onFocusChanged { focusState ->if (focusState.isFocused) {@@ -737,19 +737,22 @@ fun HomeScreen(if (canInteract) viewModel.cancelDeleteGroup()}- androidx.compose.material3.AlertDialog(+ PremiumDialog(+ title = stringResource(R.string.home_delete_group_title),+ subtitle = stringResource(R.string.home_delete_group_body, group.name),onDismissRequest = safeDismiss,- title = { Text(stringResource(R.string.home_delete_group_title)) },- text = { Text(stringResource(R.string.home_delete_group_body, group.name)) },- confirmButton = {- TextButton(onClick = { if (canInteract) viewModel.confirmDeleteGroup() }) {- Text(stringResource(R.string.home_delete_group_confirm), color = MaterialTheme.colorScheme.error)- }- },- dismissButton = {- TextButton(onClick = safeDismiss) {- Text(stringResource(R.string.home_delete_group_cancel))- }+ widthFraction = 0.36f,+ content = {},+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.home_delete_group_cancel),+ onClick = safeDismiss+ )+ PremiumDialogFooterButton(+ label = stringResource(R.string.home_delete_group_confirm),+ onClick = { if (canInteract) viewModel.confirmDeleteGroup() },+ destructive = true+ )})}@@ -774,7 +777,7 @@ private fun CategoryItem(onLongClick = onLongClick,modifier = Modifier.fillMaxWidth()- .padding(vertical = 4.dp)+ .padding(vertical = 2.dp).focusRequester(focusRequester).onFocusChanged {isFocused = it.isFocused@@ -795,7 +798,7 @@ private fun CategoryItem(}} else false},- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = if (isSelected) Primary.copy(alpha = 0.15f) else Color.Transparent,focusedContainerColor = SurfaceHighlight,@@ -803,28 +806,37 @@ private fun CategoryItem(),border = ClickableSurfaceDefaults.border(focusedBorder = Border(- border = BorderStroke(3.dp, Color.White), // More pronounced border- shape = RoundedCornerShape(8.dp)+ border = BorderStroke(2.dp, Color.White),+ shape = RoundedCornerShape(10.dp)))) {Row(- modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.SpaceBetween) {Text(- text = "${category.name} (${category.count})",- style = if (isSelected) MaterialTheme.typography.titleSmall else MaterialTheme.typography.bodyMedium,+ text = category.name,+ style = MaterialTheme.typography.bodyMedium,maxLines = 1,+ overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,color = if (isFocused) OnBackground else if (isSelected) Primary else OnSurface,modifier = Modifier.weight(1f))-++ Text(+ text = category.count.toString(),+ style = MaterialTheme.typography.labelMedium,+ color = if (isFocused) OnBackground else OnSurfaceDim,+ modifier = Modifier.padding(start = 10.dp)+ )+if (isLocked) {Text(- text = "🔒",- style = MaterialTheme.typography.bodySmall,+ text = stringResource(R.string.home_locked_short),+ style = MaterialTheme.typography.labelSmall,+ color = if (isFocused) OnBackground else OnSurfaceDim,modifier = Modifier.padding(start = 8.dp))}@@ -952,7 +964,7 @@ fun ReorderSidePanel(verticalAlignment = Alignment.CenterVertically) {if (isDraggingThis) {- Text("↕", color = Color.White, modifier = Modifier.padding(end = 8.dp))+ Text("MOVE", color = Color.White, modifier = Modifier.padding(end = 8.dp))}Text("${index + 1}. ${channel.name}",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 d8b5cc22..56f4f0ea 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@@ -8,6 +8,7 @@ import com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.PlaybackHistory+import com.streamvault.domain.model.Programimport com.streamvault.domain.model.Providerimport com.streamvault.domain.model.VirtualCategoryIdsimport com.streamvault.domain.repository.CategoryRepository@@ -20,6 +21,7 @@ import com.streamvault.domain.usecase.GetCustomCategoriesimport dagger.hilt.android.lifecycle.HiltViewModelimport com.streamvault.app.Rimport kotlinx.coroutines.ExperimentalCoroutinesApi+import kotlinx.coroutines.FlowPreviewimport kotlinx.coroutines.Jobimport kotlinx.coroutines.flow.*import kotlinx.coroutines.launch@@ -27,7 +29,7 @@ import javax.inject.Injectimport android.app.Application@HiltViewModel-@OptIn(ExperimentalCoroutinesApi::class)+@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)class HomeViewModel @Inject constructor(application: Application,private val providerRepository: ProviderRepository,@@ -47,6 +49,8 @@ class HomeViewModel @Inject constructor(private val _localChannels = MutableStateFlow<List<Channel>>(emptyList())private val _preferredInitialCategoryId = MutableStateFlow<Long?>(null)+ private val _visibleChannelWindow = MutableStateFlow<Set<Long>>(emptySet())+ private val _epgProgramMap = MutableStateFlow<Map<String, Program>>(emptyMap())private var epgJob: Job? = nullprivate var loadChannelsJob: Job? = nullprivate var categoriesJob: Job? = null@@ -80,12 +84,43 @@ class HomeViewModel @Inject constructor(else channels.filter { it.name.contains(query, ignoreCase = true) }val markedChannels = filtered.map { channel ->- if (favoriteIds.contains(channel.id)) channel.copy(isFavorite = true)- else channel.copy(isFavorite = false)+ val program = channel.epgChannelId?.let { epgId -> _epgProgramMap.value[epgId] }+ if (favoriteIds.contains(channel.id)) {+ channel.copy(isFavorite = true, currentProgram = program)+ } else {+ channel.copy(isFavorite = false, currentProgram = program)+ }}_uiState.update { it.copy(filteredChannels = markedChannels, isLoading = false) }- fetchEpgForChannels(markedChannels)+ }+ }++ viewModelScope.launch {+ combine(+ _uiState.map { it.provider?.id }.distinctUntilChanged(),+ _uiState.map { it.filteredChannels }.distinctUntilChanged(),+ _visibleChannelWindow.debounce(120)+ ) { providerId, channels, visibleIds ->+ Triple(providerId, channels, visibleIds)+ }.collectLatest { (providerId, channels, visibleIds) ->+ val resolvedProviderId = providerId ?: return@collectLatest+ if (channels.isEmpty()) {+ epgJob?.cancel()+ _epgProgramMap.value = emptyMap()+ return@collectLatest+ }++ val candidateIds = if (visibleIds.isEmpty()) {+ channels.take(12).map { it.id }.toSet()+ } else {+ visibleIds+ }++ fetchEpgForChannels(+ providerId = resolvedProviderId,+ channels = channels.filter { it.id in candidateIds }+ )}}@@ -247,8 +282,11 @@ class HomeViewModel @Inject constructor(}channelsFlow.collect { channels ->- _uiState.update { it.copy(hasChannels = channels.isNotEmpty(), isLoading = false) } // Force isLoading = false here- _localChannels.value = channels+ val numberedChannels = channels.mapIndexed { index, channel ->+ channel.copy(number = index + 1)+ }+ _uiState.update { it.copy(hasChannels = numberedChannels.isNotEmpty(), isLoading = false) }+ _localChannels.value = numberedChannels}}}@@ -261,25 +299,54 @@ class HomeViewModel @Inject constructor(_uiState.update { it.copy(channelSearchQuery = query) }}- private fun fetchEpgForChannels(channels: List<Channel>) {+ private fun fetchEpgForChannels(providerId: Long, channels: List<Channel>) {epgJob?.cancel()- val providerId = _uiState.value.provider?.id ?: returnval epgIds = channels.mapNotNull { it.epgChannelId }.distinct()epgJob = viewModelScope.launch {- val programMap = if (epgIds.isNotEmpty()) {- epgRepository.getNowPlayingForChannels(providerId, epgIds).firstOrNull() ?: emptyMap()+ val freshProgramMap = if (epgIds.isNotEmpty()) {+ epgRepository.getNowPlayingForChannels(providerId, epgIds)+ .firstOrNull()+ ?.mapValues { (_, programs) -> programs.firstOrNull() }+ ?.mapNotNull { (epgId, program) -> program?.let { epgId to it } }+ ?.toMap()+ ?: emptyMap()} else {emptyMap()}- val enrichedChannels = channels.map { channel ->- val programList = channel.epgChannelId?.let { programMap[it] }- val program = programList?.firstOrNull()- if (program != null) channel.copy(currentProgram = program) else channel+ val channelEpgIds = channels.mapNotNull { it.epgChannelId }.toSet()+ _epgProgramMap.update { existing ->+ buildMap {+ putAll(existing)+ channelEpgIds.forEach { epgId ->+ if (freshProgramMap.containsKey(epgId)) {+ put(epgId, freshProgramMap.getValue(epgId))+ } else {+ remove(epgId)+ }+ }+ }+ }++ _uiState.update { state ->+ state.copy(+ filteredChannels = state.filteredChannels.map { channel ->+ val program = channel.epgChannelId?.let { epgId -> _epgProgramMap.value[epgId] }+ channel.copy(currentProgram = program)+ }+ )}+ }+ }- _uiState.update { it.copy(filteredChannels = enrichedChannels) }+ fun updateVisibleChannelWindow(channelIds: List<Long>, focusedChannelId: Long? = null) {+ val combinedIds = buildSet {+ addAll(channelIds)+ focusedChannelId?.let(::add)+ }+ if (_visibleChannelWindow.value != combinedIds) {+ _visibleChannelWindow.value = combinedIds}}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 875fa774..73e4fdf1 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@@ -1,5 +1,6 @@package com.streamvault.app.ui.screens.movies+import androidx.activity.compose.BackHandlerimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.items@@ -42,7 +43,6 @@ import com.streamvault.app.ui.components.SavedCategoryContextCardimport com.streamvault.app.ui.components.SavedCategoryShortcutimport com.streamvault.app.ui.components.SavedCategoryShortcutsRowimport com.streamvault.app.ui.components.SkeletonRow-import com.streamvault.app.ui.components.TopNavBarimport com.streamvault.app.ui.theme.*import com.streamvault.domain.model.Movieimport kotlinx.coroutines.launch@@ -56,6 +56,11 @@ import com.streamvault.app.ui.components.dialogs.DeleteGroupDialogimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.SnackbarHostimport androidx.compose.material3.SnackbarHostState+import com.streamvault.app.ui.components.shell.BrowseSearchLaunchCard+import com.streamvault.app.ui.components.shell.LoadMoreCard+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppMessageState+import com.streamvault.app.ui.components.shell.AppScreenScaffoldimport androidx.tv.material3.Borderimport com.streamvault.app.ui.components.dialogs.RenameGroupDialog@@ -85,6 +90,10 @@ fun MoviesScreen(}}+ BackHandler(enabled = uiState.selectedCategory != null && !uiState.isReorderMode) {+ viewModel.selectCategory(null)+ }+if (showPinDialog) {com.streamvault.app.ui.components.dialogs.PinDialog(onDismissRequest = {@@ -109,15 +118,22 @@ fun MoviesScreen(}Box(modifier = Modifier.fillMaxSize()) {- Column(modifier = Modifier.fillMaxSize()) {+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_movies),+ subtitle = null,+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false+ ) {if (uiState.isReorderMode && uiState.reorderCategory != null) {ReorderTopBar(categoryName = uiState.reorderCategory!!.name,onSave = { viewModel.saveReorder() },- onCancel = { viewModel.exitCategoryReorderMode() }+ onCancel = { viewModel.exitCategoryReorderMode() },+ subtitle = stringResource(R.string.movies_reorder_subtitle))- } else {- TopNavBar(currentRoute = currentRoute, onNavigate = onNavigate)}if (uiState.isLoading) {@@ -133,11 +149,10 @@ fun MoviesScreen(}} else if (uiState.moviesByCategory.isEmpty()) {Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text("🎬", style = MaterialTheme.typography.displayLarge)- Spacer(Modifier.height(8.dp))- Text(stringResource(R.string.movies_no_found), style = MaterialTheme.typography.bodyLarge, color = OnSurface)- }+ AppMessageState(+ title = stringResource(R.string.movies_no_found),+ subtitle = stringResource(R.string.movies_no_found_subtitle)+ )}} else {Row(modifier = Modifier.fillMaxSize()) {@@ -147,13 +162,6 @@ fun MoviesScreen(var lastFocusedCategoryName by rememberSaveable { mutableStateOf<String?>(null) }var shouldRestoreCategoryFocus by remember { mutableStateOf(false) }var preferCategoryRestore by rememberSaveable { mutableStateOf(false) }- val heroMovie = remember(uiState.categoryNames, uiState.moviesByCategory) {- uiState.categoryNames- .asSequence()- .mapNotNull { categoryName -> uiState.moviesByCategory[categoryName]?.firstOrNull() }- .firstOrNull()- }-LaunchedEffect(uiState.selectedCategoryForOptions,uiState.showRenameGroupDialog,@@ -183,16 +191,16 @@ fun MoviesScreen(Column(modifier = Modifier- .width(220.dp)+ .width(188.dp).fillMaxHeight()- .background(SurfaceElevated.copy(alpha = 0.5f))+ .background(SurfaceElevated.copy(alpha = 0.72f), RoundedCornerShape(20.dp)).padding(top = 8.dp)) {// Sticky Header- Column(modifier = Modifier.padding(horizontal = 16.dp)) {+ Column(modifier = Modifier.padding(horizontal = 12.dp)) {Text(text = stringResource(R.string.movies_categories_title),- style = MaterialTheme.typography.titleMedium,+ style = MaterialTheme.typography.titleSmall,color = Primary,modifier = Modifier.padding(vertical = 8.dp))@@ -367,43 +375,12 @@ fun MoviesScreen()) {item {- Surface(+ BrowseSearchLaunchCard(+ title = stringResource(R.string.movies_search_launch_title),+ subtitle = stringResource(R.string.movies_search_launch_subtitle),onClick = { onNavigate(Routes.SEARCH) },- modifier = Modifier- .fillMaxWidth()- .padding(vertical = LocalSpacing.current.md),- shape = ClickableSurfaceDefaults.shape(androidx.compose.foundation.shape.RoundedCornerShape(12.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = SurfaceElevated,- focusedContainerColor = Primary.copy(alpha = 0.2f)- )- ) {- Row(- modifier = Modifier.padding(16.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Text("🔍", style = MaterialTheme.typography.titleMedium)- Spacer(Modifier.width(16.dp))- Text(stringResource(R.string.search_hint), color = OnSurfaceDim, style = MaterialTheme.typography.bodyLarge)- }- }- }-- if (heroMovie != null) {- item {- HeroBanner(- movie = heroMovie,- onClick = {- val isLocked = (heroMovie.isAdult || heroMovie.isUserProtected) && uiState.parentalControlLevel == 1- if (isLocked) {- pendingMovie = heroMovie- showPinDialog = true- } else {- onMovieClick(heroMovie)- }- }- )- }+ modifier = Modifier.padding(vertical = LocalSpacing.current.md)+ )}item(key = "saved_shortcuts") {@@ -643,7 +620,7 @@ fun MoviesScreen(}LazyVerticalGrid(- columns = GridCells.Adaptive(minSize = 160.dp),+ columns = GridCells.Adaptive(minSize = 138.dp),modifier = Modifier.fillMaxSize().onPreviewKeyEvent { event ->@@ -659,9 +636,9 @@ fun MoviesScreen(} else false} else false},- contentPadding = PaddingValues(16.dp),- horizontalArrangement = Arrangement.spacedBy(16.dp),- verticalArrangement = Arrangement.spacedBy(16.dp)+ contentPadding = PaddingValues(12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)) {item(span = { GridItemSpan(maxLineSpan) }) {Column(modifier = Modifier.padding(bottom = 16.dp)) {@@ -670,7 +647,7 @@ fun MoviesScreen(uiState.fullLibraryCategoryName -> stringResource(R.string.library_full_browse_title_movies)else -> uiState.selectedCategory ?: ""},- style = MaterialTheme.typography.headlineSmall,+ style = MaterialTheme.typography.titleLarge,color = Primary,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold)@@ -749,26 +726,15 @@ fun MoviesScreen(if (!uiState.isReorderMode && uiState.canLoadMoreSelectedCategory) {item(span = { GridItemSpan(maxLineSpan) }) {- Surface(- onClick = viewModel::loadMoreSelectedCategory,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.06f),- focusedContainerColor = Primary+ LoadMoreCard(+ label = stringResource(+ R.string.library_load_more,+ uiState.selectedCategoryLoadedCount,+ uiState.selectedCategoryTotalCount),+ onClick = viewModel::loadMoreSelectedCategory,modifier = Modifier.padding(top = 8.dp, bottom = 24.dp)- ) {- Text(- text = stringResource(- R.string.library_load_more,- uiState.selectedCategoryLoadedCount,- uiState.selectedCategoryTotalCount- ),- style = MaterialTheme.typography.bodyMedium,- color = Color.White,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp)- )- }+ )}}}@@ -839,90 +805,6 @@ fun MoviesScreen(}}-@Composable-fun HeroBanner(- movie: Movie,- onClick: () -> Unit-) {- var isFocused by remember { mutableStateOf(false) }-- Surface(- onClick = onClick,- modifier = Modifier- .fillMaxWidth()- .height(400.dp)- .padding(horizontal = 32.dp, vertical = 16.dp)- .onFocusChanged { isFocused = it.isFocused },- shape = ClickableSurfaceDefaults.shape(androidx.compose.foundation.shape.RoundedCornerShape(16.dp)),- border = ClickableSurfaceDefaults.border(- focusedBorder = Border(- border = BorderStroke(3.dp, Color.White),- shape = RoundedCornerShape(8.dp)- )- )- ) {- Box(modifier = Modifier.fillMaxSize()) {- AsyncImage(- model = movie.posterUrl ?: movie.backdropUrl,- contentDescription = null,- contentScale = ContentScale.Crop,- modifier = Modifier.fillMaxSize()- )-- // Gradient- Box(- modifier = Modifier- .fillMaxSize()- .background(- Brush.verticalGradient(- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.9f)),- startY = 200f- )- )- )-- // Content- Column(- modifier = Modifier- .align(Alignment.BottomStart)- .padding(32.dp)- ) {- Text(- text = movie.name,- style = MaterialTheme.typography.displayMedium,- color = Color.White,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- Spacer(Modifier.height(8.dp))- if (!movie.plot.isNullOrEmpty()) {- Text(- text = movie.plot!!,- style = MaterialTheme.typography.bodyLarge,- color = TextSecondary,- maxLines = 3,- overflow = TextOverflow.Ellipsis,- modifier = Modifier.fillMaxWidth(0.6f)- )- Spacer(Modifier.height(16.dp))- }-- // Play Button- Row(- verticalAlignment = Alignment.CenterVertically,- modifier = Modifier- .background(if (isFocused) Primary else Color.White, androidx.compose.foundation.shape.RoundedCornerShape(4.dp))- .padding(horizontal = 24.dp, vertical = 8.dp)- ) {- Text("▶", color = if (isFocused) Color.White else Color.Black)- Spacer(Modifier.width(8.dp))- Text(stringResource(R.string.player_resume).substringBefore(" "), color = if (isFocused) Color.White else Color.Black, style = MaterialTheme.typography.titleMedium) // "Play" fallback- }- }- }- }-}-private enum class MovieLibraryFacet {ALL,FAVORITES,@@ -994,3 +876,5 @@ private fun movieReleaseScore(movie: Movie): Long {?: movie.year?.toLongOrNull()?: 0L}++diff --git a/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewPlannerDialog.kt b/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewPlannerDialog.ktindex 8631cb9a..a307ae90 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewPlannerDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewPlannerDialog.kt@@ -1,38 +1,50 @@package com.streamvault.app.ui.screens.multiview+import androidx.compose.foundation.BorderStrokeimport androidx.compose.foundation.background-import androidx.compose.foundation.border-import androidx.compose.foundation.clickable-import androidx.compose.foundation.layout.*+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.material.icons.Icons-import androidx.compose.material.icons.filled.Clear-import androidx.compose.material3.*-import androidx.compose.runtime.*+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier-import androidx.compose.ui.draw.clip+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Color+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.ui.unit.sp-import androidx.compose.ui.window.Dialogimport androidx.hilt.navigation.compose.hiltViewModel-import androidx.compose.ui.focus.FocusRequester-import androidx.compose.ui.focus.focusRequester+import androidx.tv.material3.Border+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButton+import com.streamvault.app.ui.components.shell.AppMessageState+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.design.FocusSpecimport com.streamvault.domain.model.Channel+import kotlinx.coroutines.delay-/**- * Split Screen Manager dialog — two modes:- *- * • Picker mode [pendingChannel] != null — user chose "Add to Split Screen" from long-press.- * Shows the 2×2 grid; tapping a slot places the channel and STAYS OPEN so they can- * hit "Start Split Screen" right away.- *- * • Manager mode [pendingChannel] == null — opened from the sidebar button or player overlay.- * Shows all 4 slots with individual remove buttons + Launch button.- */@Composablefun MultiViewPlannerDialog(pendingChannel: Channel? = null,@@ -43,196 +55,118 @@ fun MultiViewPlannerDialog(val slots by viewModel.slotsFlow.collectAsState()val isPickerMode = pendingChannel != nullval hasAny = slots.any { it != null }-- // Track whether channel was just placed (picker mode only)var channelPlaced by remember { mutableStateOf(false) }- val firstSlotFocusRequester = remember { androidx.compose.ui.focus.FocusRequester() }+ val firstSlotFocusRequester = remember { FocusRequester() }LaunchedEffect(Unit) {- // Ensure focus starts on a slot, not a button below- try {- kotlinx.coroutines.delay(150)- firstSlotFocusRequester.requestFocus()- } catch (e: Exception) {}+ delay(150)+ runCatching { firstSlotFocusRequester.requestFocus() }}- Dialog(onDismissRequest = onDismiss) {- Card(- modifier = Modifier- .fillMaxWidth()- .wrapContentHeight(),- shape = RoundedCornerShape(20.dp),- colors = CardDefaults.cardColors(containerColor = Color(0xFF12121F))- ) {- Column(modifier = Modifier.padding(20.dp)) {-- // ── Header ─────────────────────────────────────────- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- Text(- text = "🔳 Split Screen",- color = Color.White,- fontSize = 18.sp,- fontWeight = FontWeight.Bold- )- if (!isPickerMode || channelPlaced) {- TextButton(onClick = {- viewModel.clearAll()- onDismiss()- }) {- Text("Clear All", color = Color(0xFFFF5252), fontSize = 13.sp)- }- }- }-- // Subtitle- if (isPickerMode && !channelPlaced) {- Spacer(modifier = Modifier.height(4.dp))- Text(- text = "Pick a slot for: ${pendingChannel!!.name}",- color = Color(0xFF90CAF9),- fontSize = 13.sp- )- } else if (channelPlaced) {- Spacer(modifier = Modifier.height(4.dp))- Text(- text = "✓ ${pendingChannel?.name} added",- color = Color(0xFF81C784),- fontSize = 13.sp,- fontWeight = FontWeight.Medium- )- }-- Spacer(modifier = Modifier.height(16.dp))-- // ── 2×2 Slot Grid ──────────────────────────────────- val stillPicking = isPickerMode && !channelPlaced- Column(verticalArrangement = Arrangement.spacedBy(10.dp)) {- for (row in 0 until 2) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.spacedBy(10.dp)- ) {- for (col in 0 until 2) {- val slotIndex = row * 2 + col- val occupant = slots.getOrNull(slotIndex)- SlotCell(- slotIndex = slotIndex,- occupant = occupant,- isPickerMode = stillPicking,- modifier = Modifier- .weight(1f)- .then(if (slotIndex == 0) Modifier.focusRequester(firstSlotFocusRequester) else Modifier),- onSlotClick = {- if (stillPicking) {- viewModel.assignChannelToSlot(slotIndex, pendingChannel!!)- channelPlaced = true // stay open- }- },- onClearSlot = { viewModel.clearSlot(slotIndex) }- )- }- }- }- }+ val subtitle = when {+ isPickerMode && !channelPlaced && pendingChannel != null ->+ stringResource(R.string.multiview_planner_pick_slot, pendingChannel.name)+ channelPlaced && pendingChannel != null ->+ stringResource(R.string.multiview_planner_added, pendingChannel.name)+ hasAny ->+ stringResource(R.string.multiview_planner_ready_subtitle)+ else ->+ stringResource(R.string.multiview_planner_empty)+ }- Spacer(modifier = Modifier.height(16.dp))+ PremiumDialog(+ title = stringResource(R.string.multiview_planner_title),+ subtitle = subtitle,+ onDismissRequest = onDismiss,+ widthFraction = 0.58f,+ content = {+ Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {+ StatusPill(+ label = stringResource(R.string.multiview_policy_balanced),+ containerColor = AppColors.BrandMuted+ )+ StatusPill(+ label = stringResource(R.string.multiview_policy_summary, stringResource(R.string.multiview_policy_auto), slots.count { it != null }),+ containerColor = AppColors.SurfaceEmphasis+ )+ }- // ── Bottom actions ──────────────────────────────────- val showLaunch = !isPickerMode || channelPlaced- if (showLaunch) {- androidx.tv.material3.Button(- onClick = onLaunch,- enabled = hasAny,- modifier = Modifier.fillMaxWidth(),- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Color(0xFF1B5E20),- focusedContainerColor = Color(0xFF2E7D32),- disabledContainerColor = Color(0xFF1A2E1A)- ),- border = androidx.tv.material3.ButtonDefaults.border(- focusedBorder = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(3.dp, Color.White)- )- ),- scale = androidx.tv.material3.ButtonDefaults.scale(focusedScale = 1.05f)- ) {- Text(- text = if (hasAny) "▶ Start Split Screen" else "Add channels to slots first",- color = Color.White,- fontWeight = FontWeight.Bold- )- }- Spacer(Modifier.height(8.dp))+ Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {+ for (row in 0 until 2) {Row(modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ horizontalArrangement = Arrangement.spacedBy(12.dp)) {- if (!isPickerMode || channelPlaced) {- androidx.tv.material3.Button(- onClick = {- viewModel.clearAll()- onDismiss()+ for (col in 0 until 2) {+ val slotIndex = row * 2 + col+ val occupant = slots.getOrNull(slotIndex)+ MultiViewSlotCard(+ slotIndex = slotIndex,+ occupant = occupant,+ isPickerMode = isPickerMode && !channelPlaced,+ modifier = Modifier+ .weight(1f)+ .then(+ if (slotIndex == 0) Modifier.focusRequester(firstSlotFocusRequester)+ else Modifier+ ),+ onSlotClick = {+ if (pendingChannel != null && isPickerMode && !channelPlaced) {+ viewModel.assignChannelToSlot(slotIndex, pendingChannel)+ channelPlaced = true+ }},- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Color.Transparent,- focusedContainerColor = Color(0xFFB71C1C)- ),- border = androidx.tv.material3.ButtonDefaults.border(- focusedBorder = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(2.dp, Color.White)- )- )- ) {- Text("Clear All", color = Color.White, fontSize = 13.sp)- }- } else {- Spacer(Modifier.width(1.dp))- }-- androidx.tv.material3.Button(- onClick = onDismiss,- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Color.Transparent,- focusedContainerColor = Color(0xFF455A64)- ),- border = androidx.tv.material3.ButtonDefaults.border(- focusedBorder = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(2.dp, Color.White)- )- )- ) {- Text("Close", color = Color.White)- }- }- } else {- // Still picking — just a cancel- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.End- ) {- androidx.tv.material3.Button(- onClick = onDismiss,- colors = androidx.tv.material3.ButtonDefaults.colors(- containerColor = Color.Transparent,- focusedContainerColor = Color(0x22FFFFFF)+ onClearSlot = { viewModel.clearSlot(slotIndex) })- ) {- Text("Cancel", color = Color(0xFFCCCCCC))}}}}++ if (!hasAny && !isPickerMode) {+ AppMessageState(+ title = stringResource(R.string.multiview_empty_slot),+ subtitle = stringResource(R.string.multiview_planner_empty)+ )+ }+ },+ footer = {+ if (!isPickerMode || channelPlaced) {+ PremiumDialogFooterButton(+ label = stringResource(R.string.multiview_planner_clear),+ onClick = {+ viewModel.clearAll()+ onDismiss()+ },+ destructive = true+ )+ }+ PremiumDialogFooterButton(+ label = if (isPickerMode && !channelPlaced) {+ stringResource(R.string.settings_cancel)+ } else {+ stringResource(R.string.category_options_cancel)+ },+ onClick = onDismiss+ )+ if (!isPickerMode || channelPlaced) {+ PremiumDialogFooterButton(+ label = if (hasAny) {+ stringResource(R.string.multiview_planner_launch)+ } else {+ stringResource(R.string.multiview_planner_launch_disabled)+ },+ onClick = onLaunch,+ enabled = hasAny,+ emphasized = true+ )+ }}- }+ )}@Composable-private fun SlotCell(+private fun MultiViewSlotCard(slotIndex: Int,occupant: Channel?,isPickerMode: Boolean,@@ -241,94 +175,110 @@ private fun SlotCell(onClearSlot: () -> Unit) {val isEmpty = occupant == null-- val baseBorderColor = when {- isPickerMode && !isEmpty -> Color(0xFFFF9800)- isPickerMode && isEmpty -> Color(0xFF4CAF50)- !isEmpty -> Color(0xFF2D4A6E)- else -> Color(0xFF333355)+ val accent = when {+ isPickerMode && !isEmpty -> AppColors.Warning+ isPickerMode -> AppColors.Success+ isEmpty -> AppColors.TextTertiary+ else -> AppColors.Brand}- androidx.tv.material3.Surface(+ Surface(onClick = { if (isPickerMode) onSlotClick() else onClearSlot() },- modifier = modifier- .aspectRatio(16f / 9f),- shape = androidx.tv.material3.ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),- colors = androidx.tv.material3.ClickableSurfaceDefaults.colors(- containerColor = if (isEmpty) Color(0xFF1A1A30) else Color(0xFF1E2A3A),- focusedContainerColor = if (isEmpty) Color(0xFF3B3B60) else Color(0xFF3E5A7A),- pressedContainerColor = Color(0xFF4CAF50)+ modifier = modifier.aspectRatio(16f / 9f),+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(18.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis,+ pressedContainerColor = AppColors.SurfaceEmphasis),- border = androidx.tv.material3.ClickableSurfaceDefaults.border(- border = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(1.dp, baseBorderColor.copy(alpha = 0.5f))- ),- focusedBorder = androidx.tv.material3.Border(- border = androidx.compose.foundation.BorderStroke(4.dp, Color.White)- )+ border = ClickableSurfaceDefaults.border(+ border = Border(border = BorderStroke(1.dp, accent.copy(alpha = 0.35f))),+ focusedBorder = Border(border = BorderStroke(FocusSpec.BorderWidth, AppColors.Focus))),- scale = androidx.tv.material3.ClickableSurfaceDefaults.scale(focusedScale = 1.05f)+ scale = ClickableSurfaceDefaults.scale(focusedScale = FocusSpec.FocusedScale)) {Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center+ modifier = Modifier+ .fillMaxSize()+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.SurfaceElevated,+ AppColors.Surface+ )+ )+ )+ .padding(16.dp)) {if (isEmpty) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Column(+ modifier = Modifier.align(Alignment.Center),+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ StatusPill(+ label = stringResource(R.string.multiview_empty_slot),+ containerColor = AppColors.SurfaceEmphasis+ )Text(- text = "+",- color = if (isPickerMode) Color(0xFF4CAF50) else Color(0xFF555577),- fontSize = 24.sp,- fontWeight = FontWeight.Bold+ text = if (isPickerMode) {+ stringResource(R.string.multiview_add_to_split)+ } else {+ stringResource(R.string.multiview_empty_slot)+ },+ style = MaterialTheme.typography.titleSmall,+ color = AppColors.TextPrimary)Text(- text = if (isPickerMode) "Add here" else "Empty",- color = if (isPickerMode) Color(0xFF81C784) else Color(0xFF555577),- fontSize = 12.sp+ text = if (isPickerMode) {+ stringResource(R.string.multiview_planner_slot_hint)+ } else {+ stringResource(R.string.multiview_replace_empty)+ },+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis)}} else {Column(- modifier = Modifier- .fillMaxSize()- .padding(10.dp),+ modifier = Modifier.fillMaxSize(),verticalArrangement = Arrangement.SpaceBetween) {- Text(- text = occupant!!.name,- color = Color.White,- fontSize = 12.sp,- fontWeight = FontWeight.Bold,- maxLines = 2,- overflow = TextOverflow.Ellipsis,- modifier = Modifier.weight(1f)- )- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(+ label = stringResource(R.string.multiview_slot_label, slotIndex + 1),+ containerColor = AppColors.BrandMuted+ )Text(- text = "Slot ${slotIndex + 1}",- color = Color(0xFFAAAAAA),- fontSize = 11.sp+ text = occupant.name,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,+ fontWeight = FontWeight.Bold,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis)- if (isPickerMode) {- Text(- text = "Replace",- color = Color(0xFFFF9800),- fontSize = 11.sp,- fontWeight = FontWeight.Black- )- } else {+ occupant.categoryName?.takeIf { it.isNotBlank() }?.let { categoryName ->Text(- text = "✕ Clear",- color = Color(0xFFFF5252),- fontSize = 11.sp,- fontWeight = FontWeight.Bold+ text = categoryName,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis)}}+ Text(+ text = if (isPickerMode) {+ stringResource(R.string.multiview_replace_slot)+ } else {+ stringResource(R.string.multiview_remove_slot)+ },+ style = MaterialTheme.typography.labelMedium,+ color = accent,+ fontWeight = FontWeight.Bold+ )}}}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 a0706a55..6863be27 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@@ -48,6 +48,9 @@ import androidx.tv.material3.Buttonimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.Surfaceimport com.streamvault.app.R+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogActionButton+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButtonimport com.streamvault.app.ui.theme.Primary@Composable@@ -481,54 +484,34 @@ private fun ReplaceSlotDialog(onDismiss: () -> Unit,onReplace: (com.streamvault.domain.model.Channel) -> Unit) {- androidx.compose.ui.window.Dialog(onDismissRequest = onDismiss) {- androidx.compose.material3.Surface(- shape = RoundedCornerShape(16.dp),- color = Color(0xFF12121F),- modifier = Modifier- .fillMaxWidth(0.55f)- .padding(20.dp)- ) {- Column(- modifier = Modifier.padding(20.dp),- verticalArrangement = Arrangement.spacedBy(12.dp)- ) {+ PremiumDialog(+ title = stringResource(R.string.multiview_replace_title),+ subtitle = stringResource(R.string.multiview_replace_empty),+ onDismissRequest = onDismiss,+ widthFraction = 0.5f,+ content = {+ if (candidates.isEmpty()) {Text(- text = stringResource(R.string.multiview_replace_title),- color = Color.White,- style = MaterialTheme.typography.titleMedium+ text = stringResource(R.string.multiview_replace_empty),+ color = Color.White.copy(alpha = 0.72f),+ style = MaterialTheme.typography.bodyMedium)- if (candidates.isEmpty()) {- Text(- text = stringResource(R.string.multiview_replace_empty),- color = Color(0xFFAAAAAA),- style = MaterialTheme.typography.bodySmall- )- } else {- Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {- candidates.forEach { channel ->- Surface(- onClick = { onReplace(channel) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color(0xFF1A1A30),- focusedContainerColor = Color(0xFF2C2C46)- )- ) {- Column(modifier = Modifier.padding(14.dp)) {- Text(channel.name, color = Color.White, style = MaterialTheme.typography.bodyLarge)- channel.categoryName?.takeIf { it.isNotBlank() }?.let {- Text(it, color = Color(0xFFAAAAAA), style = MaterialTheme.typography.bodySmall)- }- }- }- }+ } else {+ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ candidates.forEach { channel ->+ PremiumDialogActionButton(+ label = channel.name,+ onClick = { onReplace(channel) }+ )}}- Button(onClick = onDismiss) {- Text(stringResource(R.string.settings_cancel))- }}+ },+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )}- }+ )}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 f5a6b720..b0deb48b 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@@ -63,6 +63,19 @@ import androidx.lifecycle.Lifecycleimport androidx.lifecycle.LifecycleEventObserverimport androidx.lifecycle.compose.LocalLifecycleOwnerimport com.streamvault.app.R+import com.streamvault.app.ui.screens.player.overlay.ChannelInfoOverlay+import com.streamvault.app.ui.screens.player.overlay.ChannelListOverlay+import com.streamvault.app.ui.screens.player.overlay.DiagnosticsOverlay+import com.streamvault.app.ui.screens.player.overlay.EpgOverlay+import com.streamvault.app.ui.screens.player.overlay.PlayerErrorOverlay+import com.streamvault.app.ui.screens.player.overlay.PlayerNoticeBanner+import com.streamvault.app.ui.screens.player.overlay.PlayerResumePrompt+import com.streamvault.app.ui.screens.player.overlay.PlayerTrackSelectionDialog+import com.streamvault.app.ui.screens.player.overlay.PlayerAspectRatioToast+import com.streamvault.app.ui.screens.player.overlay.PlayerControlsOverlay+import com.streamvault.app.ui.screens.player.overlay.PlayerNumericInputOverlay+import 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@@ -475,668 +488,109 @@ fun PlayerScreen(.align(Alignment.TopCenter).padding(top = 116.dp)) {- Surface(- onClick = viewModel::dismissPlayerNotice,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color(0xCC5B1F1F),- focusedContainerColor = Color(0xFFE45757)- )- ) {- Column(modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp)) {- Text(- text = playerNotice?.message.orEmpty(),- style = MaterialTheme.typography.bodyMedium,- color = Color.White- )- if (!playerNotice?.actions.isNullOrEmpty()) {- Spacer(modifier = Modifier.height(10.dp))- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- playerNotice?.actions.orEmpty().forEach { action ->- Surface(- onClick = { handlePlayerNoticeAction(action) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.12f),- focusedContainerColor = Color.White.copy(alpha = 0.22f)- )- ) {- Text(- text = when (action) {- PlayerNoticeAction.RETRY -> stringResource(R.string.player_retry)- PlayerNoticeAction.LAST_CHANNEL -> stringResource(R.string.player_last_channel_action)- PlayerNoticeAction.ALTERNATE_STREAM -> stringResource(R.string.player_try_alternate_stream)- PlayerNoticeAction.OPEN_GUIDE -> stringResource(R.string.player_open_guide_action)- },- color = Color.White,- modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp)- )- }- }- }- }- }- }+ PlayerNoticeBanner(+ notice = playerNotice,+ onDismiss = viewModel::dismissPlayerNotice,+ onAction = handlePlayerNoticeAction+ )}// Error overlayif (playbackState == PlaybackState.ERROR) {- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center- ) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text(- text = stringResource(R.string.player_error_title),- style = MaterialTheme.typography.titleMedium,- color = ErrorColor- )- Spacer(modifier = Modifier.height(8.dp))-- // Show specific error message based on error type- val errorMessage = when (playerError) {- is PlayerError.NetworkError ->- stringResource(R.string.player_error_network)- is PlayerError.SourceError ->- stringResource(R.string.player_error_source)- is PlayerError.DecoderError ->- stringResource(R.string.player_error_decoder)- is PlayerError.UnknownError ->- playerError?.message ?: stringResource(R.string.player_error_unknown)- null -> stringResource(R.string.player_error_unknown)- }-- Text(- text = errorMessage,- style = MaterialTheme.typography.bodyMedium,- color = OnSurface- )-- Spacer(modifier = Modifier.height(16.dp))-- val recoveryActions = buildList {- add(PlayerNoticeAction.RETRY)- if (contentType == "LIVE" && viewModel.hasAlternateStream()) add(PlayerNoticeAction.ALTERNATE_STREAM)- if (contentType == "LIVE" && viewModel.hasLastChannel()) add(PlayerNoticeAction.LAST_CHANNEL)- }-- Row(- horizontalArrangement = Arrangement.spacedBy(12.dp),- verticalAlignment = Alignment.CenterVertically- ) {- recoveryActions.forEach { action ->- Surface(- onClick = { handlePlayerNoticeAction(action) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = if (action == PlayerNoticeAction.RETRY) Primary else Color.White.copy(alpha = 0.08f),- focusedContainerColor = if (action == PlayerNoticeAction.RETRY) PrimaryVariant else Color.White.copy(alpha = 0.18f)- )- ) {- Text(- text = when (action) {- PlayerNoticeAction.RETRY -> stringResource(R.string.player_retry)- PlayerNoticeAction.LAST_CHANNEL -> stringResource(R.string.player_last_channel_action)- PlayerNoticeAction.ALTERNATE_STREAM -> stringResource(R.string.player_try_alternate_stream)- PlayerNoticeAction.OPEN_GUIDE -> stringResource(R.string.player_open_guide_action)- },- color = if (action == PlayerNoticeAction.RETRY) OnBackground else Color.White,- modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp)- )- }- }- }-- Spacer(modifier = Modifier.height(8.dp))-- Text(- text = if (contentType == "LIVE" && viewModel.hasLastChannel()) {- stringResource(R.string.player_error_live_hint)- } else {- stringResource(R.string.player_error_back)- },- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- }+ PlayerErrorOverlay(+ playerError = playerError,+ contentType = contentType,+ hasAlternateStream = viewModel.hasAlternateStream(),+ hasLastChannel = viewModel.hasLastChannel(),+ onAction = handlePlayerNoticeAction+ )}- // Cinematic Controls Overlay- AnimatedVisibility(+ PlayerControlsOverlay(visible = showControls,- enter = fadeIn() + expandVertically(),- exit = fadeOut() + shrinkVertically(),- modifier = Modifier.fillMaxSize()- ) {- Box(modifier = Modifier.fillMaxSize()) {- // Top Gradient & Bar- Box(- modifier = Modifier- .fillMaxWidth()- .height(120.dp)- .background(- Brush.verticalGradient(- colors = listOf(Color.Black.copy(alpha = 0.8f), Color.Transparent)- )- )- .align(Alignment.TopCenter)- .padding(horizontal = 32.dp, vertical = 24.dp)- ) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- Column {- Text(- text = title,- style = MaterialTheme.typography.titleLarge,- color = Color.White,- fontWeight = FontWeight.Bold- )- if (contentType != "LIVE") {- Text(- text = if (contentType == "MOVIE") stringResource(R.string.player_type_movie) else stringResource(R.string.player_type_series),- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.6f)- )- }- }-- Row(verticalAlignment = Alignment.CenterVertically) {- // System Clock- val currentTime = remember { mutableStateOf(SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date())) }- LaunchedEffect(Unit) {- while(true) {- delay(10000)- currentTime.value = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date())- }- }- Text(- text = currentTime.value,- style = MaterialTheme.typography.titleMedium,- color = Color.White.copy(alpha = 0.8f),- modifier = Modifier.padding(end = 24.dp)- )-- // Exit Button- Surface(- onClick = onBack,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.1f),- focusedContainerColor = Primary.copy(alpha = 0.9f)- )- ) {- Text(- text = stringResource(R.string.player_close),- color = Color.White,- modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)- )- }- }- }- }-- // Bottom Gradient & Bar- Box(- modifier = Modifier- .fillMaxWidth()- .height(180.dp)- .background(- Brush.verticalGradient(- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.8f))- )- )- .align(Alignment.BottomCenter)- .padding(horizontal = 32.dp, vertical = 32.dp)- ) {- Column(modifier = Modifier.fillMaxWidth()) {- if (contentType == "LIVE" && currentProgram != null) {- // Live TV Program Info- Row(verticalAlignment = Alignment.Bottom) {- Column(modifier = Modifier.weight(1f)) {- Text(- text = currentProgram?.title ?: "",- style = MaterialTheme.typography.titleMedium,- color = Color.White,- maxLines = 1- )- Spacer(modifier = Modifier.height(4.dp))- currentChannel?.let {- Text(- text = "$displayChannelNumber. ${it.name}",- style = MaterialTheme.typography.bodySmall,- color = Color.White.copy(alpha = 0.6f)- )- }- }-- // Next Program Preview Removed (Moved to EPG Overlay)-- // Track selection buttons shifted here for Live- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- if (currentChannel?.catchUpSupported == true) {- QuickSettingsButton(stringResource(R.string.player_restart)) { viewModel.restartCurrentProgram() }- QuickSettingsButton(stringResource(R.string.player_archive)) { showProgramHistory = true }- }- if (currentChannelRecording?.status == com.streamvault.domain.model.RecordingStatus.RECORDING) {- QuickSettingsButton(stringResource(R.string.player_stop_recording)) { viewModel.stopCurrentRecording() }- } else {- QuickSettingsButton(stringResource(R.string.player_record)) { viewModel.startManualRecording() }- QuickSettingsButton(stringResource(R.string.player_schedule_recording)) { viewModel.scheduleRecording() }- }- QuickSettingsButton(stringResource(R.string.player_aspect_ratio_label, aspectRatio.modeName)) { viewModel.toggleAspectRatio() }- if (availableSubtitleTracks.isNotEmpty()) {- QuickSettingsButton(stringResource(R.string.player_subs)) { showTrackSelection = TrackType.TEXT }- }- if (availableAudioTracks.size > 1) {- QuickSettingsButton(stringResource(R.string.player_audio)) { showTrackSelection = TrackType.AUDIO }- }- if (availableVideoQualities.size > 1) {- QuickSettingsButton(stringResource(R.string.player_video_quality)) { showTrackSelection = TrackType.VIDEO }- }- QuickSettingsButton(stringResource(R.string.multiview_nav)) { showSplitDialog = true }- }- }-- Spacer(modifier = Modifier.height(12.dp))-- // Progress bar for Live TV- val now = System.currentTimeMillis()- val start = currentProgram?.startTime ?: 0- val end = currentProgram?.endTime ?: 0- if (start > 0 && end > 0) {- val progress = (now - start).toFloat() / (end - start)- androidx.compose.material3.LinearProgressIndicator(- progress = { progress.coerceIn(0f, 1f) },- modifier = Modifier.fillMaxWidth().height(4.dp),- color = Primary,- trackColor = Color.White.copy(alpha = 0.2f)- )- Spacer(modifier = Modifier.height(6.dp))- Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {- Text(- text = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(start)),- style = MaterialTheme.typography.labelSmall,- color = Color.White.copy(alpha = 0.5f)- )- Text(- text = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(end)),- style = MaterialTheme.typography.labelSmall,- color = Color.White.copy(alpha = 0.5f)- )- }- }- } else if (contentType != "LIVE") {- // VOD Seek Bar- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = formatDuration(currentPosition),- style = MaterialTheme.typography.labelMedium,- color = Color.White- )- Slider(- value = if (duration > 0) currentPosition.toFloat() / duration else 0f,- onValueChange = { /* Handled via DPAD usually */ },- modifier = Modifier.weight(1f).padding(horizontal = 16.dp),- colors = SliderDefaults.colors(- activeTrackColor = Primary,- inactiveTrackColor = Color.White.copy(alpha = 0.2f)- )- )- Text(- text = formatDuration(duration),- style = MaterialTheme.typography.labelMedium,- color = Color.White- )- }-- Spacer(modifier = Modifier.height(12.dp))-- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- // Content info for VOD- Text(- text = title,- style = MaterialTheme.typography.bodyMedium,- color = Color.White.copy(alpha = 0.8f)- )-- // Track selection for VOD- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- QuickSettingsButton(stringResource(R.string.player_aspect_ratio_label, aspectRatio.modeName)) { viewModel.toggleAspectRatio() }- if (availableSubtitleTracks.isNotEmpty()) {- QuickSettingsButton(stringResource(R.string.player_subs)) { showTrackSelection = TrackType.TEXT }- }- if (availableAudioTracks.size > 1) {- QuickSettingsButton(stringResource(R.string.player_audio)) { showTrackSelection = TrackType.AUDIO }- }- if (availableVideoQualities.size > 1) {- QuickSettingsButton(stringResource(R.string.player_video_quality)) { showTrackSelection = TrackType.VIDEO }- }- }- }- }- }- }-- // Center Playback Controls- Row(- modifier = Modifier.align(Alignment.Center),- horizontalArrangement = Arrangement.spacedBy(32.dp),- verticalAlignment = Alignment.CenterVertically- ) {- if (contentType != "LIVE") {- TransportButton("<<") { viewModel.seekBackward() }- }-- if (contentType != "LIVE") {- Surface(- onClick = { if (isPlaying) viewModel.pause() else viewModel.play() },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(50)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Primary.copy(alpha = 0.8f),- focusedContainerColor = Primary- ),- modifier = Modifier- .size(80.dp)- .focusRequester(playButtonFocusRequester)- ) {- Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {- Text(- text = if (isPlaying) "||" else ">",- style = MaterialTheme.typography.headlineMedium,- color = Color.White- )- }- }- }+ title = title,+ contentType = contentType,+ isPlaying = isPlaying,+ currentProgram = currentProgram,+ currentChannelName = currentChannel?.name,+ displayChannelNumber = displayChannelNumber,+ currentPosition = currentPosition,+ duration = duration,+ aspectRatioLabel = aspectRatio.modeName,+ subtitleTrackCount = availableSubtitleTracks.size,+ audioTrackCount = availableAudioTracks.size,+ videoQualityCount = availableVideoQualities.size,+ currentRecordingStatus = currentChannelRecording?.status,+ playButtonFocusRequester = playButtonFocusRequester,+ modifier = Modifier.fillMaxSize(),+ onClose = onBack,+ onTogglePlayPause = { if (isPlaying) viewModel.pause() else viewModel.play() },+ onSeekBackward = viewModel::seekBackward,+ onSeekForward = viewModel::seekForward,+ onRestartProgram = viewModel::restartCurrentProgram,+ onOpenArchive = { showProgramHistory = true },+ onStartRecording = viewModel::startManualRecording,+ onStopRecording = viewModel::stopCurrentRecording,+ onScheduleRecording = viewModel::scheduleRecording,+ onToggleAspectRatio = viewModel::toggleAspectRatio,+ onOpenSubtitleTracks = { showTrackSelection = TrackType.TEXT },+ onOpenAudioTracks = { showTrackSelection = TrackType.AUDIO },+ onOpenVideoTracks = { showTrackSelection = TrackType.VIDEO },+ onOpenSplitScreen = { showSplitDialog = true }+ )- if (contentType != "LIVE") {- TransportButton(">>") { viewModel.seekForward() }- }- }- }- }-- // Cinematic Zap Overlay- AnimatedVisibility(+ PlayerZapOverlay(visible = showZapOverlay && !showControls && currentChannel != null,- enter = fadeIn() + slideInHorizontally(),- exit = fadeOut() + slideOutHorizontally(),+ displayChannelNumber = displayChannelNumber,+ channelName = currentChannel?.name,+ programTitle = currentProgram?.title,modifier = Modifier.align(Alignment.BottomStart)- ) {- Box(- modifier = Modifier- .padding(32.dp)- .background(- brush = Brush.horizontalGradient(- colors = listOf(Color.Black.copy(alpha = 0.8f), Color.Transparent)- ),- shape = RoundedCornerShape(8.dp)- )- .padding(16.dp)- .widthIn(min = 300.dp, max = 450.dp)- ) {- Column {- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = displayChannelNumber.toString(),- style = MaterialTheme.typography.headlineMedium,- color = Primary,- fontWeight = FontWeight.Bold- )- Spacer(modifier = Modifier.width(16.dp))- Column {- Text(- text = currentChannel?.name ?: "",- style = MaterialTheme.typography.titleMedium,- color = Color.White- )- if (currentProgram != null) {- Text(- text = currentProgram?.title ?: "",- style = MaterialTheme.typography.bodyMedium,- color = Color.White.copy(alpha = 0.8f),- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- }- }- }- }- }- }-- AnimatedVisibility(- visible = numericChannelInput != null && contentType == "LIVE" && !showControls,- enter = fadeIn() + slideInVertically(initialOffsetY = { -it / 2 }),- exit = fadeOut() + slideOutVertically(targetOffsetY = { -it / 2 }),- modifier = Modifier- .align(Alignment.TopCenter)- .padding(top = 40.dp)- ) {- val inputState = numericChannelInput ?: return@AnimatedVisibility- Box(- modifier = Modifier- .background(Color.Black.copy(alpha = 0.82f), RoundedCornerShape(14.dp))- .padding(horizontal = 22.dp, vertical = 12.dp)- ) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text(- text = inputState.input,- style = MaterialTheme.typography.headlineMedium,- color = if (inputState.invalid) ErrorColor else Primary,- fontWeight = FontWeight.Bold- )- Text(- text = when {- inputState.invalid -> "Channel not found"- !inputState.matchedChannelName.isNullOrBlank() -> inputState.matchedChannelName- else -> "Type channel number"- },- style = MaterialTheme.typography.bodySmall,- color = Color.White.copy(alpha = 0.85f),- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- }- }- }+ )- // Aspect Ratio confirmation Toast- var showAspectRatioToast by remember { mutableStateOf(false) }- LaunchedEffect(aspectRatio) {- showAspectRatioToast = true- delay(2000)- showAspectRatioToast = false- }-- AnimatedVisibility(- visible = showAspectRatioToast && !showControls,- enter = fadeIn() + slideInVertically(initialOffsetY = { -it }),- exit = fadeOut() + slideOutVertically(targetOffsetY = { -it }),- modifier = Modifier.align(Alignment.TopCenter).padding(top = 32.dp)- ) {- Box(- modifier = Modifier- .background(Primary.copy(alpha = 0.9f), RoundedCornerShape(24.dp))- .padding(horizontal = 24.dp, vertical = 12.dp)- ) {- Text(- text = "Aspect Ratio: ${aspectRatio.modeName}",- style = MaterialTheme.typography.titleMedium,- color = Color.White,- fontWeight = FontWeight.Bold- )- }- }-- // EPG Overlay removed (Unified into side overlay and bottom info overlay)+ PlayerNumericInputOverlay(+ state = numericChannelInput,+ visible = contentType == "LIVE" && !showControls,+ modifier = Modifier+ .align(Alignment.TopCenter)+ .padding(top = 40.dp)+ )- // Resolution Overlay (Top Right)- if (showResolution && !showControls && !videoFormat.isEmpty) {- Box(- modifier = Modifier- .align(Alignment.TopEnd)- .padding(32.dp)- .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(4.dp))- .padding(horizontal = 12.dp, vertical = 6.dp)- ) {- Text(- text = videoFormat.resolutionLabel,- style = MaterialTheme.typography.labelMedium,- color = Color.White,- fontWeight = androidx.compose.ui.text.font.FontWeight.Bold- )- }- }+ PlayerAspectRatioToast(+ aspectRatioLabel = aspectRatio.modeName,+ controlsVisible = showControls,+ modifier = Modifier+ .align(Alignment.TopCenter)+ .padding(top = 32.dp)+ )++ PlayerResolutionBadge(+ visible = showResolution && !showControls && !videoFormat.isEmpty,+ resolutionLabel = videoFormat.resolutionLabel,+ modifier = Modifier+ .align(Alignment.TopEnd)+ .padding(32.dp)+ )// Resume Prompt Dialogif (resumePrompt.show) {- Box(- modifier = Modifier- .fillMaxSize()- .background(Color.Black.copy(alpha = 0.85f)),- contentAlignment = Alignment.Center- ) {- Column(- modifier = Modifier- .widthIn(max = 500.dp)- .background(SurfaceElevated, RoundedCornerShape(12.dp))- .padding(32.dp),- horizontalAlignment = Alignment.CenterHorizontally- ) {- Text(- text = stringResource(R.string.player_resume_title),- style = MaterialTheme.typography.headlineMedium,- color = Color.White- )- Spacer(modifier = Modifier.height(16.dp))- Text(- text = stringResource(R.string.player_resume_desc, resumePrompt.title),- style = MaterialTheme.typography.bodyLarge,- color = TextSecondary,- textAlign = androidx.compose.ui.text.style.TextAlign.Center- )- Spacer(modifier = Modifier.height(32.dp))-- Row(- horizontalArrangement = Arrangement.spacedBy(16.dp)- ) {- Surface(- onClick = { viewModel.dismissResumePrompt(resume = false) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = SurfaceVariant,- focusedContainerColor = SurfaceHighlight- ),- modifier = Modifier.weight(1f)- ) {- Text(- stringResource(R.string.player_resume_start_over),- modifier = Modifier.padding(vertical = 12.dp).fillMaxWidth(),- textAlign = androidx.compose.ui.text.style.TextAlign.Center,- color = Color.White- )- }-- Surface(- onClick = { viewModel.dismissResumePrompt(resume = true) },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Primary,- focusedContainerColor = PrimaryVariant- ),- modifier = Modifier.weight(1f)- ) {- Text(- stringResource(R.string.player_resume),- modifier = Modifier.padding(vertical = 12.dp).fillMaxWidth(),- textAlign = androidx.compose.ui.text.style.TextAlign.Center,- color = Color.White,- fontWeight = androidx.compose.ui.text.font.FontWeight.Bold- )- }- }- }- }+ PlayerResumePrompt(+ title = resumePrompt.title,+ onStartOver = { viewModel.dismissResumePrompt(resume = false) },+ onResume = { viewModel.dismissResumePrompt(resume = true) }+ )}// Track Selection Dialog- if (showTrackSelection != null) {- Box(- modifier = Modifier- .fillMaxSize()- .background(Color.Black.copy(alpha = 0.8f))- .clickable(onClick = { showTrackSelection = null }),- contentAlignment = Alignment.Center- ) {- val tracks = when (showTrackSelection) {- TrackType.AUDIO -> availableAudioTracks- TrackType.VIDEO -> availableVideoQualities- else -> availableSubtitleTracks- }-- val titleRes = when (showTrackSelection) {- TrackType.AUDIO -> R.string.player_track_audio- TrackType.VIDEO -> R.string.player_video_quality- else -> R.string.player_track_subs- }-- Column(- modifier = Modifier- .widthIn(min = 300.dp, max = 400.dp)- .background(SurfaceElevated, RoundedCornerShape(12.dp))- .padding(24.dp)- ) {- Text(- text = if (showTrackSelection == TrackType.VIDEO) "Video Quality" else stringResource(titleRes),- style = MaterialTheme.typography.titleLarge,- color = Color.White,- modifier = Modifier.padding(bottom = 16.dp)- )-- androidx.compose.foundation.lazy.LazyColumn(- verticalArrangement = Arrangement.spacedBy(8.dp)- ) {- if (showTrackSelection == TrackType.TEXT) {- item {- TrackItem(- name = stringResource(R.string.player_track_off),- isSelected = tracks.none { it.isSelected },- onClick = {- viewModel.selectSubtitleTrack(null)- showTrackSelection = null- }- )- }- }-- items(tracks.size) { index ->- val track = tracks[index]- TrackItem(- name = track.name,- isSelected = track.isSelected,- onClick = {- when (showTrackSelection) {- TrackType.AUDIO -> viewModel.selectAudioTrack(track.id)- TrackType.VIDEO -> viewModel.selectVideoQuality(track.id)- else -> viewModel.selectSubtitleTrack(track.id)- }- showTrackSelection = null- }- )- }- }- }- }- }+ PlayerTrackSelectionDialog(+ trackType = showTrackSelection,+ audioTracks = availableAudioTracks,+ subtitleTracks = availableSubtitleTracks,+ videoTracks = availableVideoQualities,+ onDismiss = { showTrackSelection = null },+ onSelectAudio = viewModel::selectAudioTrack,+ onSelectVideo = viewModel::selectVideoQuality,+ onSelectSubtitle = viewModel::selectSubtitleTrack+ )// --- Overlays ---if (showDiagnostics) {@@ -1243,869 +697,3 @@ fun PlayerScreen(}}}--@Composable-fun ChannelInfoOverlay(- currentChannel: com.streamvault.domain.model.Channel?,- displayChannelNumber: Int,- currentProgram: Program?,- nextProgram: Program?,- focusRequester: FocusRequester,- lastVisitedCategoryName: String?,- onDismiss: () -> Unit,- onOpenFullEpg: () -> Unit,- onOpenLastGroup: () -> Unit,- onOpenRecentChannels: () -> Unit,- onOpenFullControls: () -> Unit,- onRestartProgram: () -> Unit,- onToggleAspectRatio: () -> Unit,- onToggleDiagnostics: () -> Unit,- onTogglePlayPause: () -> Unit,- isPlaying: Boolean,- currentAspectRatio: String,- isDiagnosticsEnabled: Boolean,- onOpenSplitScreen: () -> Unit = {}-) {- val timeFormat = java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault())-- BackHandler { onDismiss() }-- Box(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 48.dp, vertical = 32.dp)- .background(- Color.Black.copy(alpha = 0.55f),- RoundedCornerShape(24.dp)- )- ) {- Column(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 32.dp, vertical = 20.dp),- verticalArrangement = Arrangement.spacedBy(8.dp)- ) {- // Channel name & number- if (currentChannel != null) {- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = "$displayChannelNumber",- style = MaterialTheme.typography.headlineMedium,- color = Primary,- fontWeight = FontWeight.Bold- )- Spacer(Modifier.width(16.dp))- Text(- text = currentChannel.name,- style = MaterialTheme.typography.headlineMedium,- color = Color.White,- fontWeight = FontWeight.Bold,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- if (currentChannel.catchUpSupported) {- Spacer(Modifier.width(12.dp))- Box(- modifier = Modifier- .background(Primary.copy(alpha = 0.8f), RoundedCornerShape(4.dp))- .padding(horizontal = 8.dp, vertical = 3.dp)- ) {- Text(stringResource(R.string.player_catchup_badge), style = MaterialTheme.typography.labelSmall, color = Color.White)- }- }- }- }-- // Current program info- if (currentProgram != null) {- Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {- Row(- modifier = Modifier.fillMaxWidth(),- verticalAlignment = Alignment.CenterVertically- ) {- Column(modifier = Modifier.weight(1f)) {- Text(- text = currentProgram.title,- style = MaterialTheme.typography.titleMedium,- color = Color.White,- fontWeight = FontWeight.Bold,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- Text(- text = stringResource(- R.string.player_time_range_minutes,- timeFormat.format(java.util.Date(currentProgram.startTime)),- timeFormat.format(java.util.Date(currentProgram.endTime)),- currentProgram.durationMinutes- ),- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.7f)- )- }- }- // Progress bar- 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 = Color.White.copy(alpha = 0.15f)- )- Text(- text = "$remainingMin min remaining",- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- }- }-- // Next program & Quick actions row- Row(- modifier = Modifier.fillMaxWidth(),- verticalAlignment = Alignment.Bottom,- horizontalArrangement = Arrangement.SpaceBetween- ) {- 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 = Color.White.copy(alpha = 0.7f),- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,- modifier = Modifier.weight(1f)- )- Text(- text = timeFormat.format(java.util.Date(nextProgram.startTime)),- style = MaterialTheme.typography.labelSmall,- color = Color.White.copy(alpha = 0.5f)- )- }- }- }-- // Quick action buttons aligned to the right- Row(- horizontalArrangement = Arrangement.spacedBy(8.dp),- verticalAlignment = Alignment.CenterVertically- ) {- QuickActionButton(- icon = if (isPlaying) "||" else ">",- 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 = "R",- label = stringResource(R.string.player_restart),- onClick = {- onRestartProgram()- onDismiss()- }- )- }- QuickActionButton(- icon = "AR",- label = currentAspectRatio,- onClick = onToggleAspectRatio,- modifier = Modifier.focusRequester(focusRequester)- )- if (!lastVisitedCategoryName.isNullOrBlank()) {- QuickActionButton(- icon = "LG",- label = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),- onClick = onOpenLastGroup- )- }- QuickActionButton(- icon = "RC",- label = stringResource(R.string.player_recent_channels),- onClick = onOpenRecentChannels- )- QuickActionButton(- icon = "EPG",- label = stringResource(R.string.player_full_epg),- onClick = onOpenFullEpg- )- QuickActionButton(- icon = "MV",- label = stringResource(R.string.multiview_nav),- onClick = {- onDismiss()- onOpenSplitScreen()- }- )- QuickActionButton(- icon = if (isDiagnosticsEnabled) "ON" else "OFF",- label = stringResource(R.string.player_stats),- onClick = onToggleDiagnostics- )- }- }- }- }-}--@Composable-private fun QuickActionButton(- icon: String,- label: String,- modifier: Modifier = Modifier,- colors: androidx.tv.material3.ClickableSurfaceColors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.1f),- focusedContainerColor = Primary.copy(alpha = 0.85f)- ),- onClick: () -> Unit-) {- Surface(- onClick = onClick,- modifier = modifier,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),- colors = colors,- scale = ClickableSurfaceDefaults.scale(focusedScale = 1.05f)- ) {- Column(- modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp),- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(2.dp)- ) {- androidx.compose.animation.AnimatedContent(- targetState = icon,- transitionSpec = {- (fadeIn() + scaleIn()).togetherWith(fadeOut() + scaleOut())- },- label = "iconToggle"- ) { targetIcon ->- Text(targetIcon, style = MaterialTheme.typography.titleLarge)- }- Text(- text = label,- style = MaterialTheme.typography.labelSmall,- color = Color.White,- fontWeight = FontWeight.Bold- )- }- }-}--@Composable-private fun TrackItem(- name: String,- isSelected: Boolean,- onClick: () -> Unit-) {- Surface(- onClick = onClick,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = if (isSelected) Primary.copy(alpha = 0.2f) else Color.Transparent,- focusedContainerColor = SurfaceHighlight- ),- modifier = Modifier.fillMaxWidth()- ) {- Row(- modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Text(- text = name,- style = MaterialTheme.typography.bodyLarge,- color = if (isSelected) Primary else TextPrimary,- modifier = Modifier.weight(1f)- )- if (isSelected) {- Text(stringResource(R.string.player_selected), color = Primary, style = MaterialTheme.typography.labelSmall)- }- }- }-}--@Composable-fun ChannelListOverlay(- channels: List<com.streamvault.domain.model.Channel>,- recentChannels: List<com.streamvault.domain.model.Channel>,- currentChannelId: Long,- overlayFocusRequester: FocusRequester = remember { FocusRequester() },- preferredFocusedChannelId: Long? = null,- onFocusedChannelChange: (Long) -> Unit = {},- lastVisitedCategoryName: String? = null,- onOpenLastGroup: () -> Unit = {},- onSelectChannel: (Long) -> Unit,- onDismiss: () -> Unit-) {- val listState = androidx.compose.foundation.lazy.rememberLazyListState()- val scope = rememberCoroutineScope()- val currentIndex = remember(channels, currentChannelId) {- channels.indexOfFirst { it.id == currentChannelId }.coerceAtLeast(0)- }- val preferredIndex = remember(channels, currentChannelId, preferredFocusedChannelId) {- val focused = preferredFocusedChannelId?.let { channelId ->- channels.indexOfFirst { it.id == channelId }.takeIf { it >= 0 }- }- focused ?: currentIndex- }- // Scroll to focused/current item when channels load- LaunchedEffect(channels, preferredIndex) {- if (channels.isNotEmpty()) {- listState.scrollToItem(preferredIndex)- }- }-- BackHandler { onDismiss() }-- androidx.compose.foundation.lazy.LazyColumn(- state = listState,- modifier = Modifier- .fillMaxSize()- .background(Color.Black.copy(alpha = 0.70f)),- contentPadding = PaddingValues(top = 16.dp, bottom = 32.dp)- ) {- item {- Row(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 24.dp, vertical = 24.dp),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- Text(- text = stringResource(R.string.player_channel_list_title, channels.size),- style = MaterialTheme.typography.titleMedium,- color = Primary- )- if (!lastVisitedCategoryName.isNullOrBlank()) {- Surface(- onClick = onOpenLastGroup,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.08f),- focusedContainerColor = Primary- )- ) {- Text(- text = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),- style = MaterialTheme.typography.labelMedium,- color = Color.White,- modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)- )- }- }- }- }- if (!lastVisitedCategoryName.isNullOrBlank()) {- item {- Text(- text = stringResource(R.string.player_last_group_hint),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim,- modifier = Modifier.padding(horizontal = 24.dp)- )- }- }- item {- Text(- text = stringResource(R.string.player_channel_list_hint),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim,- modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp)- )- }- if (recentChannels.isNotEmpty()) {- item {- Column(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 16.dp, vertical = 4.dp)- ) {- Text(- text = stringResource(R.string.player_recent_channels),- style = MaterialTheme.typography.labelLarge,- color = OnSurfaceDim,- modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)- )- LazyRow(- horizontalArrangement = Arrangement.spacedBy(8.dp),- contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp)- ) {- items(recentChannels, key = { it.id }) { channel ->- Surface(- onClick = {- onSelectChannel(channel.id)- onDismiss()- },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.08f),- focusedContainerColor = Primary- )- ) {- Row(- modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(8.dp)- ) {- val recentNumber = if (channel.number > 0) channel.number.toString() else "?"- Text(- text = recentNumber,- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.75f)- )- Text(- text = channel.name,- style = MaterialTheme.typography.bodySmall,- color = Color.White,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- }- }- }- }- }- }- }- items(channels.size) { index ->- val channel = channels[index]- val isSelected = channel.id == currentChannelId- val shouldRequestFocus = preferredFocusedChannelId?.let { it == channel.id } ?: isSelected- val channelNumber = if (channel.number > 0) channel.number else index + 1-- Surface(- onClick = {- onSelectChannel(channel.id)- onDismiss()- },- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 16.dp, vertical = 3.dp)- .onFocusChanged {- if (it.isFocused) {- onFocusedChannelChange(channel.id)- scope.launch {- val targetIndex = (index - 1).coerceAtLeast(0)- listState.animateScrollToItem(targetIndex)- }- }- }- .then(- if (shouldRequestFocus) Modifier.focusRequester(overlayFocusRequester)- else Modifier- ),- scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = if (isSelected) Primary.copy(alpha = 0.25f) else Color.White.copy(alpha = 0.05f),- focusedContainerColor = Primary- )- ) {- Row(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 16.dp, vertical = 12.dp),- verticalAlignment = Alignment.CenterVertically,- horizontalArrangement = Arrangement.spacedBy(12.dp)- ) {- if (isSelected) {- Text(stringResource(R.string.player_channel_selected), color = Color.White, style = MaterialTheme.typography.labelSmall)- } else {- Text(" ", style = MaterialTheme.typography.bodySmall)- }- Text(- text = channelNumber.toString().padStart(2, '0'),- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.72f)- )- Text(- text = channel.name,- style = MaterialTheme.typography.bodyLarge,- color = Color.White,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis,- modifier = Modifier.weight(1f)- )- if (channel.catchUpSupported) {- Text(stringResource(R.string.player_archive_badge), style = MaterialTheme.typography.labelSmall)- }- }- }- }- }-}---@Composable-fun EpgOverlay(- currentChannel: com.streamvault.domain.model.Channel?,- displayChannelNumber: Int,- currentProgram: Program?,- nextProgram: Program?,- upcomingPrograms: List<Program>,- overlayFocusRequester: FocusRequester = remember { FocusRequester() },- preferredFocusedProgramToken: Long? = null,- onFocusedProgramChange: (Long) -> Unit = {},- onDismiss: () -> Unit,- onPlayCatchUp: (Program) -> Unit-) {- val timeFormat = java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault())- val listState = androidx.compose.foundation.lazy.rememberLazyListState()- val filteredUpcoming = remember(upcomingPrograms, currentProgram, nextProgram) {- upcomingPrograms.filter { it.id != currentProgram?.id && it.id != nextProgram?.id }- }- val displayPrograms = remember(filteredUpcoming, nextProgram) {- if (nextProgram != null) listOf(nextProgram) + filteredUpcoming else filteredUpcoming- }-- BackHandler { onDismiss() }-- Box(- modifier = Modifier- .fillMaxSize()- .background(Color.Black.copy(alpha = 0.70f))- ) {- androidx.compose.foundation.lazy.LazyColumn(- state = listState,- modifier = Modifier- .fillMaxSize()- .padding(24.dp),- verticalArrangement = Arrangement.spacedBy(16.dp)- ) {- // Header: Channel info- item {- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = stringResource(R.string.epg_title),- style = MaterialTheme.typography.titleLarge,- color = Primary,- fontWeight = FontWeight.Bold- )- }- if (currentChannel != null) {- Spacer(Modifier.height(8.dp))- Text(- text = "$displayChannelNumber. ${currentChannel.name}",- style = MaterialTheme.typography.headlineSmall,- color = Color.White,- fontWeight = FontWeight.Bold- )- if (currentChannel.catchUpSupported) {- Spacer(Modifier.height(4.dp))- Text(- text = stringResource(R.string.epg_catchup_available, currentChannel.catchUpDays),- style = MaterialTheme.typography.bodySmall,- color = Primary.copy(alpha = 0.8f)- )- }- }- Spacer(Modifier.height(8.dp))- Text(- text = stringResource(R.string.player_epg_overlay_hint),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }-- // Now Playing section- item {- androidx.compose.material3.HorizontalDivider(color = SurfaceVariant)- Spacer(Modifier.height(8.dp))- Text(- text = stringResource(R.string.epg_now_playing),- style = MaterialTheme.typography.labelMedium,- color = Primary,- fontWeight = FontWeight.Bold- )- Spacer(Modifier.height(8.dp))- if (currentProgram != null) {- Text(- currentProgram.title,- style = MaterialTheme.typography.titleMedium,- color = Color.White,- fontWeight = FontWeight.Bold- )- Spacer(Modifier.height(4.dp))- Row(verticalAlignment = Alignment.CenterVertically) {- Text(- text = "${timeFormat.format(java.util.Date(currentProgram.startTime))} - ${timeFormat.format(java.util.Date(currentProgram.endTime))}",- style = MaterialTheme.typography.bodyMedium,- color = TextSecondary- )- Spacer(Modifier.width(12.dp))- Text(- text = "${currentProgram.durationMinutes} min",- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- if (currentProgram.lang.isNotEmpty()) {- Spacer(Modifier.width(8.dp))- Text(- text = currentProgram.lang.uppercase(),- style = MaterialTheme.typography.labelSmall,- color = Primary.copy(alpha = 0.7f)- )- }- }- // Progress bar- Spacer(Modifier.height(8.dp))- 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(4.dp),- color = Primary,- trackColor = Color.White.copy(alpha = 0.2f)- )- Spacer(Modifier.height(4.dp))- Text(- text = stringResource(R.string.player_minutes_remaining, remainingMin),- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- }- // Description- if (!currentProgram.description.isNullOrEmpty()) {- Spacer(Modifier.height(12.dp))- Text(- currentProgram.description!!,- style = MaterialTheme.typography.bodyMedium,- color = Color.White.copy(alpha = 0.7f),- maxLines = 6,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- }- } else {- Text(stringResource(R.string.epg_no_info), color = OnSurfaceDim)- }- }-- // Upcoming schedule- if (upcomingPrograms.isNotEmpty()) {- item {- Spacer(Modifier.height(8.dp))- androidx.compose.material3.HorizontalDivider(color = SurfaceVariant)- Spacer(Modifier.height(8.dp))- Text(- text = stringResource(R.string.epg_upcoming_schedule),- style = MaterialTheme.typography.labelMedium,- color = Primary,- fontWeight = FontWeight.Bold- )- }- items(displayPrograms.size) { index ->- val program = displayPrograms[index]- val isNext = index == 0 && nextProgram != null- val focusToken = if (program.id > 0) program.id else program.startTime- val shouldRequestFocus = preferredFocusedProgramToken?.let { it == focusToken } ?: (index == 0)-- Surface(- onClick = {- if (program.hasArchive || currentChannel?.catchUpSupported == true) {- onPlayCatchUp(program)- }- },- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = if (isNext) Primary.copy(alpha = 0.08f) else Color.Transparent,- focusedContainerColor = Primary.copy(alpha = 0.2f)- ),- modifier = Modifier- .fillMaxWidth()- .then(- if (shouldRequestFocus) Modifier.focusRequester(overlayFocusRequester)- else Modifier- )- .onFocusChanged {- if (it.isFocused) onFocusedProgramChange(focusToken)- }- ) {- Column(- modifier = Modifier.padding(12.dp)- ) {- if (isNext) {- Text(- text = stringResource(R.string.epg_up_next),- style = MaterialTheme.typography.labelSmall,- color = Primary,- fontWeight = FontWeight.Bold- )- Spacer(Modifier.height(4.dp))- }- Text(- program.title,- style = MaterialTheme.typography.bodyLarge,- color = if (isNext) Color.White else Color.White.copy(alpha = 0.8f),- fontWeight = if (isNext) FontWeight.Bold else FontWeight.Normal,- maxLines = 1,- overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis- )- Spacer(Modifier.height(2.dp))- Row {- Text(- text = "${timeFormat.format(java.util.Date(program.startTime))} - ${timeFormat.format(java.util.Date(program.endTime))}",- style = MaterialTheme.typography.bodySmall,- color = TextSecondary- )- Spacer(Modifier.width(8.dp))- Text(- text = "${program.durationMinutes} min",- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim- )- if (program.hasArchive) {- Spacer(Modifier.width(8.dp))- Text(- text = stringResource(R.string.player_archive_badge),- style = MaterialTheme.typography.labelSmall- )- }- }- }- }- }- }-}-}-}--@Composable-private fun QuickSettingsButton(- text: String,- onClick: () -> Unit-) {- Surface(- onClick = onClick,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.1f),- focusedContainerColor = Primary.copy(alpha = 0.9f)- )- ) {- Text(- text = text,- color = Color.White,- style = MaterialTheme.typography.labelMedium,- modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)- )- }-}--@Composable-private fun TransportButton(- text: String,- onClick: () -> Unit-) {- Surface(- onClick = onClick,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(50)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.1f),- focusedContainerColor = Color.White.copy(alpha = 0.3f)- ),- modifier = Modifier.size(56.dp)- ) {- Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {- Text(- text = text,- style = MaterialTheme.typography.headlineSmall,- color = Color.White- )- }- }-}--private fun formatTime(ms: Long): String {- val formatter = java.text.SimpleDateFormat("HH:mm", java.util.Locale.getDefault())- return formatter.format(java.util.Date(ms))-}--private fun formatDuration(ms: Long): String {- val totalSeconds = ms / 1000- val minutes = totalSeconds / 60- val seconds = totalSeconds % 60- val hours = minutes / 60- val remainingMinutes = minutes % 60-- return if (hours > 0) {- String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, remainingMinutes, seconds)- } else {- String.format(Locale.getDefault(), "%02d:%02d", remainingMinutes, seconds)- }-}--@Composable-fun DiagnosticsOverlay(- stats: com.streamvault.player.PlayerStats,- diagnostics: PlayerDiagnosticsUiState,- modifier: Modifier = Modifier-) {- Box(- modifier = modifier- .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(8.dp))- .padding(16.dp)- ) {- Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {- Text("Player Diagnostics", color = Primary, style = MaterialTheme.typography.labelMedium, fontWeight = FontWeight.Bold)- Spacer(Modifier.height(4.dp))- if (diagnostics.providerName.isNotBlank()) {- Text("Provider: ${diagnostics.providerName}", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- if (diagnostics.providerSourceLabel.isNotBlank()) {- Text("Source: ${diagnostics.providerSourceLabel}", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- Text("Decoder: ${diagnostics.decoderMode.name}", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Stream Class: ${diagnostics.streamClassLabel}", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Playback State: ${diagnostics.playbackStateLabel}", color = Color.White, style = MaterialTheme.typography.bodySmall)- if (diagnostics.archiveSupportLabel.isNotBlank()) {- Text("Archive: ${diagnostics.archiveSupportLabel}", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- Text("Alternate Streams: ${diagnostics.alternativeStreamCount}", color = Color.White, style = MaterialTheme.typography.bodySmall)- if (diagnostics.channelErrorCount > 0) {- Text("Channel Errors: ${diagnostics.channelErrorCount}", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- Text("Resolution: ${stats.width}x${stats.height}", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Video Codec: ${stats.videoCodec}", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Audio Codec: ${stats.audioCodec}", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Video Bitrate: ${stats.videoBitrate / 1000} kbps", color = Color.White, style = MaterialTheme.typography.bodySmall)- Text("Dropped Frames: ${stats.droppedFrames}", color = Color.White, style = MaterialTheme.typography.bodySmall)- diagnostics.lastFailureReason?.let { reason ->- Spacer(Modifier.height(4.dp))- Text("Last Failure: $reason", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- if (diagnostics.recentRecoveryActions.isNotEmpty()) {- Spacer(Modifier.height(4.dp))- Text("Recovery Actions", color = Primary, style = MaterialTheme.typography.labelSmall, fontWeight = FontWeight.Bold)- diagnostics.recentRecoveryActions.forEach { action ->- Text("• $action", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- }- if (diagnostics.troubleshootingHints.isNotEmpty()) {- Spacer(Modifier.height(4.dp))- Text("Troubleshooting", color = Primary, style = MaterialTheme.typography.labelSmall, fontWeight = FontWeight.Bold)- diagnostics.troubleshootingHints.forEach { hint ->- Text("- $hint", color = Color.White, style = MaterialTheme.typography.bodySmall)- }- }- }- }-}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 2c154cc6..14607b83 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@@ -289,10 +289,6 @@ class PlayerViewModel @Inject constructor(_showEpgOverlay.value = false_showControls.value = falsechannelInfoHideJob?.cancel()- channelInfoHideJob = viewModelScope.launch {- delay(3000)- _showChannelInfoOverlay.value = false- }}fun closeChannelInfoOverlay() {@@ -722,8 +718,11 @@ class PlayerViewModel @Inject constructor(}flows.collect { channels ->- channelList = channels- _currentChannelList.value = channels+ val numberedChannels = channels.mapIndexed { index, channel ->+ channel.copy(number = index + 1)+ }+ channelList = numberedChannels+ _currentChannelList.value = numberedChannels// Recalculate index based on initial ID or URLif (initialChannelId != -1L) {currentChannelIndex = channelList.indexOfFirst { it.id == initialChannelId }@@ -736,7 +735,7 @@ class PlayerViewModel @Inject constructor(_currentChannel.value = channelList[currentChannelIndex]refreshCurrentChannelRecording()val ch = channelList[currentChannelIndex]- _displayChannelNumber.value = if (ch.number > 0) ch.number else currentChannelIndex + 1+ _displayChannelNumber.value = resolveChannelNumber(ch, currentChannelIndex)}}}@@ -937,7 +936,7 @@ class PlayerViewModel @Inject constructor(updateStreamClass("Primary")_currentChannel.value = channelrefreshCurrentChannelRecording()- _displayChannelNumber.value = if (channel.number > 0) channel.number else index + 1+ _displayChannelNumber.value = resolveChannelNumber(channel, index)_recentChannels.update { channels -> channels.filterNot { it.id == channel.id } }// Prepare player@@ -1178,7 +1177,7 @@ class PlayerViewModel @Inject constructor(private fun resolveChannelNumber(channel: com.streamvault.domain.model.Channel,index: Int- ): Int = if (channel.number > 0) channel.number else index + 1+ ): Int = index + 1fun play() = playerEngine.play()fun pause() = playerEngine.pause()diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.ktnew file mode 100644index 00000000..b0225f27--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerControlsChrome.kt@@ -0,0 +1,862 @@+package com.streamvault.app.ui.screens.player.overlay++import androidx.compose.animation.AnimatedVisibility+import androidx.compose.animation.expandVertically+import androidx.compose.animation.fadeIn+import androidx.compose.animation.fadeOut+import androidx.compose.animation.shrinkVertically+import androidx.compose.animation.slideInHorizontally+import androidx.compose.animation.slideInVertically+import androidx.compose.animation.slideOutHorizontally+import androidx.compose.animation.slideOutVertically+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.layout.widthIn+import androidx.compose.foundation.layout.paddingFromBaseline+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.PlayArrow+import androidx.compose.material3.LinearProgressIndicator+import androidx.compose.material3.Slider+import androidx.compose.material3.SliderDefaults+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.semantics.contentDescription+import androidx.compose.ui.semantics.semantics+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.Icon+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.screens.player.NumericChannelInputState+import com.streamvault.app.ui.theme.ErrorColor+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.PrimaryVariant+import com.streamvault.domain.model.Program+import com.streamvault.domain.model.RecordingStatus+import kotlinx.coroutines.delay+import java.text.SimpleDateFormat+import java.util.Date+import java.util.Locale++private data class PlayerActionSpec(+ val label: String,+ val onClick: () -> Unit+)++@Composable+fun PlayerControlsOverlay(+ visible: Boolean,+ title: String,+ contentType: String,+ isPlaying: Boolean,+ currentProgram: Program?,+ currentChannelName: String?,+ displayChannelNumber: Int,+ currentPosition: Long,+ duration: Long,+ aspectRatioLabel: String,+ subtitleTrackCount: Int,+ audioTrackCount: Int,+ videoQualityCount: Int,+ currentRecordingStatus: RecordingStatus?,+ playButtonFocusRequester: FocusRequester,+ onClose: () -> Unit,+ onTogglePlayPause: () -> Unit,+ onSeekBackward: () -> Unit,+ onSeekForward: () -> Unit,+ onRestartProgram: () -> Unit,+ onOpenArchive: () -> Unit,+ onStartRecording: () -> Unit,+ onStopRecording: () -> Unit,+ onScheduleRecording: () -> Unit,+ onToggleAspectRatio: () -> Unit,+ onOpenSubtitleTracks: () -> Unit,+ onOpenAudioTracks: () -> Unit,+ onOpenVideoTracks: () -> Unit,+ onOpenSplitScreen: () -> Unit,+ clockLabelOverride: String? = null,+ modifier: Modifier = Modifier+) {+ AnimatedVisibility(+ visible = visible,+ enter = fadeIn() + expandVertically(),+ exit = fadeOut() + shrinkVertically(),+ modifier = modifier+ ) {+ Box(modifier = Modifier.fillMaxSize()) {+ PlayerTopBar(+ title = title,+ contentType = contentType,+ clockLabelOverride = clockLabelOverride,+ onClose = onClose,+ modifier = Modifier.align(Alignment.TopCenter)+ )++ PlayerBottomBar(+ title = title,+ contentType = contentType,+ currentProgram = currentProgram,+ currentChannelName = currentChannelName,+ displayChannelNumber = displayChannelNumber,+ currentPosition = currentPosition,+ duration = duration,+ aspectRatioLabel = aspectRatioLabel,+ subtitleTrackCount = subtitleTrackCount,+ audioTrackCount = audioTrackCount,+ videoQualityCount = videoQualityCount,+ currentRecordingStatus = currentRecordingStatus,+ modifier = Modifier.align(Alignment.BottomCenter),+ onRestartProgram = onRestartProgram,+ onOpenArchive = onOpenArchive,+ onStartRecording = onStartRecording,+ onStopRecording = onStopRecording,+ onScheduleRecording = onScheduleRecording,+ onToggleAspectRatio = onToggleAspectRatio,+ onOpenSubtitleTracks = onOpenSubtitleTracks,+ onOpenAudioTracks = onOpenAudioTracks,+ onOpenVideoTracks = onOpenVideoTracks,+ onOpenSplitScreen = onOpenSplitScreen+ )++ if (contentType != "LIVE") {+ PlayerTransportBar(+ isPlaying = isPlaying,+ playButtonFocusRequester = playButtonFocusRequester,+ onSeekBackward = onSeekBackward,+ onSeekForward = onSeekForward,+ onTogglePlayPause = onTogglePlayPause,+ modifier = Modifier.align(Alignment.Center)+ )+ }+ }+ }+}++@Composable+fun PlayerZapOverlay(+ visible: Boolean,+ displayChannelNumber: Int,+ channelName: String?,+ programTitle: String?,+ modifier: Modifier = Modifier+) {+ AnimatedVisibility(+ visible = visible,+ enter = fadeIn() + slideInHorizontally(),+ exit = fadeOut() + slideOutHorizontally(),+ modifier = modifier+ ) {+ Box(+ modifier = Modifier+ .padding(32.dp)+ .background(+ brush = Brush.horizontalGradient(+ colors = listOf(Color.Black.copy(alpha = 0.84f), Color.Transparent)+ ),+ shape = RoundedCornerShape(12.dp)+ )+ .padding(18.dp)+ .widthIn(min = 320.dp, max = 460.dp)+ ) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(+ text = displayChannelNumber.toString(),+ style = MaterialTheme.typography.headlineMedium,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ Spacer(modifier = Modifier.width(16.dp))+ Column {+ Text(+ text = channelName.orEmpty(),+ style = MaterialTheme.typography.titleMedium,+ color = Color.White,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ if (!programTitle.isNullOrBlank()) {+ Text(+ text = programTitle,+ style = MaterialTheme.typography.bodyMedium,+ color = Color.White.copy(alpha = 0.78f),+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+ }+ }+}++@Composable+fun PlayerNumericInputOverlay(+ state: NumericChannelInputState?,+ visible: Boolean,+ modifier: Modifier = Modifier+) {+ AnimatedVisibility(+ visible = visible && state != null,+ enter = fadeIn() + slideInVertically(initialOffsetY = { -it / 2 }),+ exit = fadeOut() + slideOutVertically(targetOffsetY = { -it / 2 }),+ modifier = modifier+ ) {+ val inputState = state ?: return@AnimatedVisibility+ Box(+ modifier = Modifier+ .background(Color.Black.copy(alpha = 0.82f), RoundedCornerShape(14.dp))+ .padding(horizontal = 22.dp, vertical = 12.dp)+ ) {+ Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Text(+ text = inputState.input,+ style = MaterialTheme.typography.headlineMedium,+ color = if (inputState.invalid) ErrorColor else Primary,+ fontWeight = FontWeight.Bold+ )+ Text(+ text = when {+ inputState.invalid -> stringResource(R.string.player_channel_not_found)+ !inputState.matchedChannelName.isNullOrBlank() -> inputState.matchedChannelName+ else -> stringResource(R.string.player_type_channel_number)+ },+ style = MaterialTheme.typography.bodySmall,+ color = Color.White.copy(alpha = 0.85f),+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+}++@Composable+fun PlayerAspectRatioToast(+ aspectRatioLabel: String,+ controlsVisible: Boolean,+ modifier: Modifier = Modifier+) {+ var show by remember { mutableStateOf(false) }+ LaunchedEffect(aspectRatioLabel) {+ show = true+ delay(2000)+ show = false+ }++ AnimatedVisibility(+ visible = show && !controlsVisible,+ enter = fadeIn() + slideInVertically(initialOffsetY = { -it }),+ exit = fadeOut() + slideOutVertically(targetOffsetY = { -it }),+ modifier = modifier+ ) {+ Box(+ modifier = Modifier+ .background(Primary.copy(alpha = 0.9f), RoundedCornerShape(24.dp))+ .padding(horizontal = 24.dp, vertical = 12.dp)+ ) {+ Text(+ text = stringResource(R.string.player_aspect_ratio_label, aspectRatioLabel),+ style = MaterialTheme.typography.titleMedium,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ }+ }+}++@Composable+fun PlayerResolutionBadge(+ visible: Boolean,+ resolutionLabel: String,+ modifier: Modifier = Modifier+) {+ if (!visible) return++ Box(+ modifier = modifier+ .background(Color.Black.copy(alpha = 0.6f), RoundedCornerShape(6.dp))+ .padding(horizontal = 12.dp, vertical = 6.dp)+ ) {+ Text(+ text = resolutionLabel,+ style = MaterialTheme.typography.labelMedium,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ }+}++@Composable+private fun PlayerTopBar(+ title: String,+ contentType: String,+ clockLabelOverride: String?,+ onClose: () -> Unit,+ modifier: Modifier = Modifier+) {+ Box(+ modifier = modifier+ .fillMaxWidth()+ .height(132.dp)+ .background(+ Brush.verticalGradient(+ colors = listOf(Color.Black.copy(alpha = 0.8f), Color.Transparent)+ )+ )+ .padding(horizontal = 32.dp, vertical = 24.dp)+ ) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column {+ PlayerMetaPill(+ text = when (contentType) {+ "LIVE" -> stringResource(R.string.nav_live_tv)+ "MOVIE" -> stringResource(R.string.player_type_movie)+ else -> stringResource(R.string.player_type_series)+ }+ )+ Spacer(modifier = Modifier.height(10.dp))+ Text(+ text = title,+ style = MaterialTheme.typography.titleLarge,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ if (contentType != "LIVE") {+ Text(+ text = if (contentType == "MOVIE") {+ stringResource(R.string.player_type_movie)+ } else {+ stringResource(R.string.player_type_series)+ },+ style = MaterialTheme.typography.labelMedium,+ color = Color.White.copy(alpha = 0.6f)+ )+ }+ }++ Row(verticalAlignment = Alignment.CenterVertically) {+ val currentTime = remember(clockLabelOverride) {+ mutableStateOf(+ clockLabelOverride ?: SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date())+ )+ }+ LaunchedEffect(clockLabelOverride) {+ if (clockLabelOverride == null) {+ while (true) {+ delay(10_000)+ currentTime.value = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date())+ }+ } else {+ currentTime.value = clockLabelOverride+ }+ }+ Text(+ text = currentTime.value,+ style = MaterialTheme.typography.titleMedium,+ color = Color.White.copy(alpha = 0.8f),+ modifier = Modifier.padding(end = 16.dp)+ )++ Surface(+ onClick = onClose,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.12f),+ focusedContainerColor = Primary.copy(alpha = 0.9f)+ )+ ) {+ Text(+ text = stringResource(R.string.player_close),+ color = Color.White,+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 10.dp)+ )+ }+ }+ }+ }+}++@Composable+private fun PlayerBottomBar(+ title: String,+ contentType: String,+ currentProgram: Program?,+ currentChannelName: String?,+ displayChannelNumber: Int,+ currentPosition: Long,+ duration: Long,+ aspectRatioLabel: String,+ subtitleTrackCount: Int,+ audioTrackCount: Int,+ videoQualityCount: Int,+ currentRecordingStatus: RecordingStatus?,+ onRestartProgram: () -> Unit,+ onOpenArchive: () -> Unit,+ onStartRecording: () -> Unit,+ onStopRecording: () -> Unit,+ onScheduleRecording: () -> Unit,+ onToggleAspectRatio: () -> Unit,+ onOpenSubtitleTracks: () -> Unit,+ onOpenAudioTracks: () -> Unit,+ onOpenVideoTracks: () -> Unit,+ onOpenSplitScreen: () -> Unit,+ modifier: Modifier = Modifier+) {+ Box(+ modifier = modifier+ .fillMaxWidth()+ .height(248.dp)+ .background(+ Brush.verticalGradient(+ colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.84f))+ )+ )+ .padding(horizontal = 32.dp, vertical = 24.dp)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(),+ shape = RoundedCornerShape(28.dp),+ colors = SurfaceDefaults.colors(containerColor = Color(0xFF0C1624).copy(alpha = 0.92f))+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .background(+ Brush.horizontalGradient(+ colors = listOf(+ Primary.copy(alpha = 0.10f),+ Color.Transparent+ )+ )+ )+ .padding(horizontal = 24.dp, vertical = 22.dp)+ ) {+ if (contentType == "LIVE" && currentProgram != null) {+ PlayerLiveInfo(+ currentProgram = currentProgram,+ currentChannelName = currentChannelName,+ displayChannelNumber = displayChannelNumber,+ aspectRatioLabel = aspectRatioLabel,+ subtitleTrackCount = subtitleTrackCount,+ audioTrackCount = audioTrackCount,+ videoQualityCount = videoQualityCount,+ currentRecordingStatus = currentRecordingStatus,+ onRestartProgram = onRestartProgram,+ onOpenArchive = onOpenArchive,+ onStartRecording = onStartRecording,+ onStopRecording = onStopRecording,+ onScheduleRecording = onScheduleRecording,+ onToggleAspectRatio = onToggleAspectRatio,+ onOpenSubtitleTracks = onOpenSubtitleTracks,+ onOpenAudioTracks = onOpenAudioTracks,+ onOpenVideoTracks = onOpenVideoTracks,+ onOpenSplitScreen = onOpenSplitScreen+ )+ } else if (contentType != "LIVE") {+ PlayerVodInfo(+ title = title,+ currentPosition = currentPosition,+ duration = duration,+ aspectRatioLabel = aspectRatioLabel,+ subtitleTrackCount = subtitleTrackCount,+ audioTrackCount = audioTrackCount,+ videoQualityCount = videoQualityCount,+ onToggleAspectRatio = onToggleAspectRatio,+ onOpenSubtitleTracks = onOpenSubtitleTracks,+ onOpenAudioTracks = onOpenAudioTracks,+ onOpenVideoTracks = onOpenVideoTracks+ )+ }+ }+ }+ }+}++@Composable+private fun PlayerLiveInfo(+ currentProgram: Program,+ currentChannelName: String?,+ displayChannelNumber: Int,+ aspectRatioLabel: String,+ subtitleTrackCount: Int,+ audioTrackCount: Int,+ videoQualityCount: Int,+ currentRecordingStatus: RecordingStatus?,+ onRestartProgram: () -> Unit,+ onOpenArchive: () -> Unit,+ onStartRecording: () -> Unit,+ onStopRecording: () -> Unit,+ onScheduleRecording: () -> Unit,+ onToggleAspectRatio: () -> Unit,+ onOpenSubtitleTracks: () -> Unit,+ onOpenAudioTracks: () -> Unit,+ onOpenVideoTracks: () -> Unit,+ onOpenSplitScreen: () -> Unit+) {+ val primaryActions = buildList {+ if (currentProgram.hasArchive) {+ add(PlayerActionSpec(stringResource(R.string.player_restart), onRestartProgram))+ add(PlayerActionSpec(stringResource(R.string.player_archive), onOpenArchive))+ }+ if (currentRecordingStatus == RecordingStatus.RECORDING) {+ add(PlayerActionSpec(stringResource(R.string.player_stop_recording), onStopRecording))+ } else {+ add(PlayerActionSpec(stringResource(R.string.player_record), onStartRecording))+ add(PlayerActionSpec(stringResource(R.string.player_schedule_recording), onScheduleRecording))+ }+ }+ val secondaryActions = buildList {+ add(PlayerActionSpec(stringResource(R.string.player_aspect_ratio_label, aspectRatioLabel), onToggleAspectRatio))+ if (subtitleTrackCount > 0) {+ add(PlayerActionSpec(stringResource(R.string.player_subs), onOpenSubtitleTracks))+ }+ if (audioTrackCount > 1) {+ add(PlayerActionSpec(stringResource(R.string.player_audio), onOpenAudioTracks))+ }+ if (videoQualityCount > 1) {+ add(PlayerActionSpec(stringResource(R.string.player_video_quality), onOpenVideoTracks))+ }+ add(PlayerActionSpec(stringResource(R.string.multiview_nav), onOpenSplitScreen))+ }++ Row(verticalAlignment = Alignment.Top) {+ Column(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ PlayerMetaPill(text = stringResource(R.string.player_live_now), accent = true)+ PlayerMetaPill(text = stringResource(R.string.player_live_channel, displayChannelNumber))+ if (currentProgram.hasArchive) {+ PlayerMetaPill(text = stringResource(R.string.player_archive_badge))+ }+ }+ Text(+ text = currentProgram.title,+ style = MaterialTheme.typography.headlineSmall,+ color = Color.White,+ maxLines = 1+ )+ Text(+ text = "$displayChannelNumber. ${currentChannelName.orEmpty()}",+ style = MaterialTheme.typography.bodyMedium,+ color = Color.White.copy(alpha = 0.68f)+ )+ }+ }++ Spacer(modifier = Modifier.height(16.dp))++ val start = currentProgram.startTime+ val end = currentProgram.endTime+ if (start > 0 && end > 0) {+ val now = System.currentTimeMillis()+ val progress = (now - start).toFloat() / (end - start)+ LinearProgressIndicator(+ progress = { progress.coerceIn(0f, 1f) },+ modifier = Modifier+ .fillMaxWidth()+ .height(4.dp),+ color = Primary,+ trackColor = Color.White.copy(alpha = 0.2f)+ )+ Spacer(modifier = Modifier.height(8.dp))+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween+ ) {+ Text(+ text = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(start)),+ style = MaterialTheme.typography.labelSmall,+ color = Color.White.copy(alpha = 0.5f)+ )+ Text(+ text = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date(end)),+ style = MaterialTheme.typography.labelSmall,+ color = Color.White.copy(alpha = 0.5f)+ )+ }+ }++ PlayerQuickActionRows(primaryActions, secondaryActions)+}++@Composable+private fun PlayerVodInfo(+ title: String,+ currentPosition: Long,+ duration: Long,+ aspectRatioLabel: String,+ subtitleTrackCount: Int,+ audioTrackCount: Int,+ videoQualityCount: Int,+ onToggleAspectRatio: () -> Unit,+ onOpenSubtitleTracks: () -> Unit,+ onOpenAudioTracks: () -> Unit,+ onOpenVideoTracks: () -> Unit+) {+ val actions = buildList {+ add(PlayerActionSpec(stringResource(R.string.player_aspect_ratio_label, aspectRatioLabel), onToggleAspectRatio))+ if (subtitleTrackCount > 0) {+ add(PlayerActionSpec(stringResource(R.string.player_subs), onOpenSubtitleTracks))+ }+ if (audioTrackCount > 1) {+ add(PlayerActionSpec(stringResource(R.string.player_audio), onOpenAudioTracks))+ }+ if (videoQualityCount > 1) {+ add(PlayerActionSpec(stringResource(R.string.player_video_quality), onOpenVideoTracks))+ }+ }++ Row(+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ PlayerMetaPill(text = stringResource(R.string.player_playback_label), accent = true)+ Text(+ text = title,+ style = MaterialTheme.typography.bodyMedium,+ color = Color.White.copy(alpha = 0.82f),+ maxLines = 1+ )+ }++ Spacer(modifier = Modifier.height(14.dp))++ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(+ text = formatDuration(currentPosition),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White+ )+ Slider(+ value = if (duration > 0) currentPosition.toFloat() / duration else 0f,+ onValueChange = { },+ modifier = Modifier+ .weight(1f)+ .padding(horizontal = 16.dp),+ colors = SliderDefaults.colors(+ activeTrackColor = Primary,+ inactiveTrackColor = Color.White.copy(alpha = 0.2f)+ )+ )+ Text(+ text = formatDuration(duration),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White+ )+ }++ PlayerQuickActionRows(actions, emptyList())+}++@Composable+private fun PlayerTransportBar(+ isPlaying: Boolean,+ playButtonFocusRequester: FocusRequester,+ onSeekBackward: () -> Unit,+ onSeekForward: () -> Unit,+ onTogglePlayPause: () -> Unit,+ modifier: Modifier = Modifier+) {+ val playPauseDescription = if (isPlaying) {+ stringResource(R.string.player_pause)+ } else {+ stringResource(R.string.player_play)+ }+ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(999.dp),+ colors = SurfaceDefaults.colors(containerColor = Color.Black.copy(alpha = 0.52f))+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.spacedBy(24.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(R.string.player_playback_label),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White.copy(alpha = 0.7f)+ )+ PlayerTransportButton(+ label = "\u23EA",+ contentDescription = stringResource(R.string.player_rewind),+ onClick = onSeekBackward+ )+ Surface(+ onClick = onTogglePlayPause,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(50)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary.copy(alpha = 0.8f),+ focusedContainerColor = Primary+ ),+ modifier = Modifier+ .size(80.dp)+ .focusRequester(playButtonFocusRequester)+ .semantics { contentDescription = playPauseDescription }+ ) {+ Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {+ if (isPlaying) {+ Text(+ text = "II",+ style = MaterialTheme.typography.headlineMedium,+ color = Color.White+ )+ } else {+ Icon(+ imageVector = Icons.Default.PlayArrow,+ contentDescription = stringResource(R.string.player_play),+ tint = Color.White,+ modifier = Modifier.size(38.dp)+ )+ }+ }+ }+ PlayerTransportButton(+ label = "\u23E9",+ contentDescription = stringResource(R.string.player_forward),+ onClick = onSeekForward+ )+ }+ }+}++@Composable+private fun PlayerQuickSettingsButton(+ text: String,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.1f),+ focusedContainerColor = Primary.copy(alpha = 0.9f)+ )+ ) {+ Text(+ text = text,+ color = Color.White,+ style = MaterialTheme.typography.labelMedium,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 9.dp)+ )+ }+}++@Composable+private fun PlayerTransportButton(+ label: String,+ contentDescription: String,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(50)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.1f),+ focusedContainerColor = Color.White.copy(alpha = 0.3f)+ ),+ modifier = Modifier+ .size(56.dp)+ .semantics { this.contentDescription = contentDescription }+ ) {+ Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {+ Text(+ text = label,+ style = MaterialTheme.typography.headlineSmall,+ color = Color.White+ )+ }+ }+}++@Composable+private fun PlayerMetaPill(+ text: String,+ accent: Boolean = false+) {+ Surface(+ shape = RoundedCornerShape(999.dp),+ colors = SurfaceDefaults.colors(+ containerColor = if (accent) Primary.copy(alpha = 0.22f) else Color.White.copy(alpha = 0.10f)+ )+ ) {+ Text(+ text = text,+ style = MaterialTheme.typography.labelMedium,+ color = Color.White,+ modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)+ )+ }+}++@Composable+private fun PlayerQuickActionRows(+ primaryActions: List<PlayerActionSpec>,+ secondaryActions: List<PlayerActionSpec>+) {+ val rows = listOf(primaryActions, secondaryActions).filter { it.isNotEmpty() }+ if (rows.isEmpty()) return++ Spacer(modifier = Modifier.height(14.dp))++ Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ rows.forEachIndexed { index, row ->+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ if (index == 1) {+ PlayerMetaPill(text = stringResource(R.string.player_more_controls))+ }+ row.forEach { action ->+ PlayerQuickSettingsButton(action.label, action.onClick)+ }+ }+ }+ }+}++private fun formatDuration(ms: Long): String {+ val totalSeconds = ms / 1000+ val minutes = totalSeconds / 60+ val seconds = totalSeconds % 60+ val hours = minutes / 60+ val remainingMinutes = minutes % 60++ return if (hours > 0) {+ String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, remainingMinutes, seconds)+ } else {+ String.format(Locale.getDefault(), "%02d:%02d", remainingMinutes, seconds)+ }+}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.ktnew file mode 100644index 00000000..16e04c7c--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerOverlays.kt@@ -0,0 +1,899 @@+package com.streamvault.app.ui.screens.player.overlay++import androidx.activity.compose.BackHandler+import androidx.compose.animation.AnimatedContent+import androidx.compose.animation.fadeIn+import androidx.compose.animation.fadeOut+import androidx.compose.animation.scaleIn+import androidx.compose.animation.scaleOut+import androidx.compose.animation.togetherWith+import androidx.compose.foundation.BorderStroke+import androidx.compose.foundation.background+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.ColumnScope+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+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.LazyRow+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.lazy.itemsIndexed+import androidx.compose.foundation.lazy.rememberLazyListState+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.graphics.Brush+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextOverflow+import androidx.compose.ui.unit.dp+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColors+import com.streamvault.app.ui.screens.player.PlayerDiagnosticsUiState+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.SurfaceVariant+import com.streamvault.app.ui.theme.TextSecondary+import com.streamvault.domain.model.Channel+import com.streamvault.domain.model.Program+import com.streamvault.player.PlayerStats+import kotlinx.coroutines.launch+import java.text.SimpleDateFormat+import java.util.Date+import java.util.Locale++@Composable+private fun PlayerOverlayPanel(+ modifier: Modifier = Modifier,+ content: @Composable ColumnScope.() -> Unit+) {+ Surface(+ modifier = modifier,+ shape = RoundedCornerShape(28.dp),+ colors = androidx.tv.material3.SurfaceDefaults.colors(containerColor = AppColors.SurfaceElevated)+ ) {+ Column(+ modifier = Modifier+ .background(+ Brush.verticalGradient(+ colors = listOf(+ AppColors.BrandMuted.copy(alpha = 0.15f),+ AppColors.SurfaceElevated,+ AppColors.Surface+ )+ )+ )+ .padding(24.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ content = content+ )+ }+}++@Composable+private fun PlayerMetaRow(label: String, value: String) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ 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+ )+ }+}++@Composable+fun ChannelInfoOverlay(+ currentChannel: Channel?,+ displayChannelNumber: Int,+ currentProgram: Program?,+ nextProgram: Program?,+ focusRequester: FocusRequester,+ lastVisitedCategoryName: String?,+ onDismiss: () -> Unit,+ onOpenFullEpg: () -> Unit,+ onOpenLastGroup: () -> Unit,+ onOpenRecentChannels: () -> Unit,+ onOpenFullControls: () -> Unit,+ onRestartProgram: () -> Unit,+ onToggleAspectRatio: () -> Unit,+ onToggleDiagnostics: () -> Unit,+ onTogglePlayPause: () -> Unit,+ isPlaying: Boolean,+ currentAspectRatio: String,+ isDiagnosticsEnabled: Boolean,+ onOpenSplitScreen: () -> Unit = {}+) {+ val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())++ BackHandler { onDismiss() }++ PlayerOverlayPanel(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 48.dp, vertical = 32.dp)+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 4.dp),+ verticalArrangement = Arrangement.spacedBy(8.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+ )+ }+ }+ }++ if (currentProgram != null) {+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(+ text = currentProgram.title,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,+ fontWeight = FontWeight.Bold,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ 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+ )+ }+ }+ 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+ ) {+ 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_split),+ label = stringResource(R.string.multiview_nav),+ onClick = {+ onDismiss()+ onOpenSplitScreen()+ }+ )+ QuickActionButton(+ icon = stringResource(R.string.player_action_diagnostics),+ label = stringResource(R.string.player_stats),+ onClick = onToggleDiagnostics+ )+ }+ }+ }+ }+}++@Composable+private fun QuickActionButton(+ icon: String,+ label: String,+ modifier: Modifier = Modifier,+ colors: androidx.tv.material3.ClickableSurfaceColors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceEmphasis,+ focusedContainerColor = Primary.copy(alpha = 0.85f)+ ),+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ modifier = modifier,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(16.dp)),+ colors = colors,+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1.05f)+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp),+ horizontalAlignment = Alignment.Start,+ verticalArrangement = Arrangement.spacedBy(4.dp)+ ) {+ AnimatedContent(+ targetState = icon,+ transitionSpec = {+ (fadeIn() + scaleIn()).togetherWith(fadeOut() + scaleOut())+ },+ label = "iconToggle"+ ) { targetIcon ->+ Text(+ text = targetIcon.uppercase(Locale.getDefault()),+ style = MaterialTheme.typography.labelSmall,+ color = AppColors.BrandStrong,+ fontWeight = FontWeight.Bold+ )+ }+ Text(+ text = label,+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextPrimary,+ fontWeight = FontWeight.Bold+ )+ }+ }+}++@Composable+fun ChannelListOverlay(+ channels: List<Channel>,+ recentChannels: List<Channel>,+ currentChannelId: Long,+ overlayFocusRequester: FocusRequester = remember { FocusRequester() },+ preferredFocusedChannelId: Long? = null,+ onFocusedChannelChange: (Long) -> Unit = {},+ lastVisitedCategoryName: String? = null,+ onOpenLastGroup: () -> Unit = {},+ onSelectChannel: (Long) -> Unit,+ onDismiss: () -> Unit+) {+ val listState = rememberLazyListState()+ val scope = rememberCoroutineScope()+ val currentIndex = remember(channels, currentChannelId) {+ channels.indexOfFirst { it.id == currentChannelId }.coerceAtLeast(0)+ }+ val preferredIndex = remember(channels, currentChannelId, preferredFocusedChannelId) {+ val focused = preferredFocusedChannelId?.let { channelId ->+ channels.indexOfFirst { it.id == channelId }.takeIf { it >= 0 }+ }+ focused ?: currentIndex+ }++ LaunchedEffect(channels, preferredIndex) {+ if (channels.isNotEmpty()) {+ listState.scrollToItem(preferredIndex)+ }+ }++ BackHandler { onDismiss() }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.42f))+ ) {+ PlayerOverlayPanel(+ modifier = Modifier+ .width(520.dp)+ .fillMaxWidth()+ .padding(20.dp)+ ) {+ androidx.compose.foundation.lazy.LazyColumn(+ state = listState,+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(top = 8.dp, bottom = 24.dp),+ verticalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ item {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 8.dp, vertical = 8.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(R.string.player_channel_list_title, channels.size),+ style = MaterialTheme.typography.titleMedium,+ color = Primary+ )+ if (!lastVisitedCategoryName.isNullOrBlank()) {+ Surface(+ onClick = onOpenLastGroup,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceEmphasis,+ focusedContainerColor = Primary+ )+ ) {+ Text(+ text = stringResource(R.string.player_last_group_label, lastVisitedCategoryName),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp)+ )+ }+ }+ }+ }+ if (!lastVisitedCategoryName.isNullOrBlank()) {+ item {+ Text(+ text = stringResource(R.string.player_last_group_hint),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ modifier = Modifier.padding(horizontal = 8.dp)+ )+ }+ }+ item {+ Text(+ text = stringResource(R.string.player_channel_list_hint),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp)+ )+ }+ if (recentChannels.isNotEmpty()) {+ item {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(vertical = 4.dp)+ ) {+ Text(+ text = stringResource(R.string.player_recent_channels),+ style = MaterialTheme.typography.labelLarge,+ color = OnSurfaceDim,+ modifier = Modifier.padding(horizontal = 8.dp, vertical = 8.dp)+ )+ LazyRow(+ horizontalArrangement = Arrangement.spacedBy(8.dp),+ contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp)+ ) {+ itemsIndexed(recentChannels, key = { _, channel -> channel.id }) { index, channel ->+ Surface(+ onClick = {+ onSelectChannel(channel.id)+ onDismiss()+ },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(999.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = AppColors.SurfaceEmphasis,+ focusedContainerColor = Primary+ )+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 10.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ val recentNumber = (index + 1).toString().padStart(2, '0')+ Text(+ text = recentNumber,+ style = MaterialTheme.typography.labelMedium,+ color = Color.White.copy(alpha = 0.75f)+ )+ Text(+ text = channel.name,+ style = MaterialTheme.typography.bodySmall,+ color = Color.White,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ }+ }+ }+ }+ }+ }+ }+ items(channels.size) { index ->+ val channel = channels[index]+ val isSelected = channel.id == currentChannelId+ val shouldRequestFocus = preferredFocusedChannelId?.let { it == channel.id } ?: isSelected+ val channelNumber = index + 1++ Surface(+ onClick = {+ onSelectChannel(channel.id)+ onDismiss()+ },+ modifier = Modifier+ .fillMaxWidth()+ .padding(vertical = 3.dp)+ .onFocusChanged {+ if (it.isFocused) {+ onFocusedChannelChange(channel.id)+ scope.launch {+ val targetIndex = (index - 1).coerceAtLeast(0)+ listState.animateScrollToItem(targetIndex)+ }+ }+ }+ .then(+ if (shouldRequestFocus) Modifier.focusRequester(overlayFocusRequester)+ else Modifier+ ),+ 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),+ focusedContainerColor = Primary+ )+ ) {+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(horizontal = 16.dp, vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically,+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ if (isSelected) {+ StatusPill(+ label = stringResource(R.string.player_channel_selected),+ containerColor = AppColors.BrandMuted+ )+ } else {+ Spacer(Modifier.width(42.dp))+ }+ Text(+ text = channelNumber.toString().padStart(2, '0'),+ style = MaterialTheme.typography.labelMedium,+ color = Color.White.copy(alpha = 0.72f)+ )+ Text(+ text = channel.name,+ style = MaterialTheme.typography.bodyLarge,+ color = Color.White,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis,+ modifier = Modifier.weight(1f)+ )+ if (channel.catchUpSupported) {+ StatusPill(+ label = stringResource(R.string.player_archive_badge),+ containerColor = AppColors.Warning,+ contentColor = Color.Black+ )+ }+ }+ }+ }+ }+ }+ }+}++@Composable+fun EpgOverlay(+ currentChannel: Channel?,+ displayChannelNumber: Int,+ currentProgram: Program?,+ nextProgram: Program?,+ upcomingPrograms: List<Program>,+ overlayFocusRequester: FocusRequester = remember { FocusRequester() },+ preferredFocusedProgramToken: Long? = null,+ onFocusedProgramChange: (Long) -> Unit = {},+ onDismiss: () -> Unit,+ onPlayCatchUp: (Program) -> Unit+) {+ val timeFormat = SimpleDateFormat("HH:mm", Locale.getDefault())+ val listState = rememberLazyListState()+ val filteredUpcoming = remember(upcomingPrograms, currentProgram, nextProgram) {+ upcomingPrograms.filter { it.id != currentProgram?.id && it.id != nextProgram?.id }+ }+ val displayPrograms = remember(filteredUpcoming, nextProgram) {+ if (nextProgram != null) listOf(nextProgram) + filteredUpcoming else filteredUpcoming+ }++ BackHandler { onDismiss() }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.42f))+ ) {+ PlayerOverlayPanel(+ modifier = Modifier+ .align(Alignment.CenterEnd)+ .width(560.dp)+ .padding(24.dp)+ ) {+ androidx.compose.foundation.lazy.LazyColumn(+ state = listState,+ modifier = Modifier.fillMaxSize(),+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ item {+ Text(+ text = stringResource(R.string.epg_title),+ style = MaterialTheme.typography.titleLarge,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ if (currentChannel != null) {+ Spacer(Modifier.height(8.dp))+ Text(+ text = "$displayChannelNumber. ${currentChannel.name}",+ style = MaterialTheme.typography.headlineSmall,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ if (currentChannel.catchUpSupported) {+ Spacer(Modifier.height(8.dp))+ StatusPill(+ label = stringResource(R.string.epg_catchup_available, currentChannel.catchUpDays),+ containerColor = AppColors.BrandMuted+ )+ }+ }+ Spacer(Modifier.height(8.dp))+ Text(+ text = stringResource(R.string.player_epg_overlay_hint),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }++ item {+ androidx.compose.material3.HorizontalDivider(color = SurfaceVariant)+ Spacer(Modifier.height(8.dp))+ Text(+ text = stringResource(R.string.epg_now_playing),+ style = MaterialTheme.typography.labelMedium,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ Spacer(Modifier.height(8.dp))+ if (currentProgram != null) {+ Text(+ currentProgram.title,+ style = MaterialTheme.typography.titleMedium,+ color = AppColors.TextPrimary,+ fontWeight = FontWeight.Bold+ )+ Spacer(Modifier.height(4.dp))+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text(+ text = "${timeFormat.format(Date(currentProgram.startTime))} - ${timeFormat.format(Date(currentProgram.endTime))}",+ style = MaterialTheme.typography.bodyMedium,+ color = TextSecondary+ )+ Spacer(Modifier.width(12.dp))+ Text(+ text = "${currentProgram.durationMinutes} min",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ if (currentProgram.lang.isNotEmpty()) {+ Spacer(Modifier.width(8.dp))+ Text(+ text = currentProgram.lang.uppercase(),+ style = MaterialTheme.typography.labelSmall,+ color = Primary.copy(alpha = 0.7f)+ )+ }+ }+ Spacer(Modifier.height(4.dp))+ 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(4.dp),+ color = Primary,+ trackColor = AppColors.SurfaceEmphasis+ )+ Spacer(Modifier.height(4.dp))+ Text(+ text = stringResource(R.string.player_minutes_remaining, remainingMin),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ if (!currentProgram.description.isNullOrEmpty()) {+ Spacer(Modifier.height(12.dp))+ Text(+ currentProgram.description!!,+ style = MaterialTheme.typography.bodyMedium,+ color = Color.White.copy(alpha = 0.7f),+ maxLines = 6,+ overflow = TextOverflow.Ellipsis+ )+ }+ } else {+ Text(stringResource(R.string.epg_no_info), color = OnSurfaceDim)+ }+ }++ if (upcomingPrograms.isNotEmpty()) {+ item {+ Spacer(Modifier.height(8.dp))+ androidx.compose.material3.HorizontalDivider(color = SurfaceVariant)+ Spacer(Modifier.height(8.dp))+ Text(+ text = stringResource(R.string.epg_upcoming_schedule),+ style = MaterialTheme.typography.labelMedium,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ }+ items(displayPrograms.size) { index ->+ val program = displayPrograms[index]+ val isNext = index == 0 && nextProgram != null+ val focusToken = if (program.id > 0) program.id else program.startTime+ val shouldRequestFocus = preferredFocusedProgramToken?.let { it == focusToken } ?: (index == 0)++ Surface(+ onClick = {+ if (program.hasArchive || currentChannel?.catchUpSupported == true) {+ onPlayCatchUp(program)+ }+ },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isNext) Primary.copy(alpha = 0.08f) else Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.2f)+ ),+ modifier = Modifier+ .fillMaxWidth()+ .then(+ if (shouldRequestFocus) Modifier.focusRequester(overlayFocusRequester)+ else Modifier+ )+ .onFocusChanged {+ if (it.isFocused) onFocusedProgramChange(focusToken)+ }+ ) {+ Column(modifier = Modifier.padding(12.dp)) {+ if (isNext) {+ Text(+ text = stringResource(R.string.epg_up_next),+ style = MaterialTheme.typography.labelSmall,+ color = Primary,+ fontWeight = FontWeight.Bold+ )+ Spacer(Modifier.height(4.dp))+ }+ Text(+ text = program.title,+ style = MaterialTheme.typography.bodyLarge,+ color = if (isNext) Color.White else Color.White.copy(alpha = 0.8f),+ fontWeight = if (isNext) FontWeight.Bold else FontWeight.Normal,+ maxLines = 1,+ overflow = TextOverflow.Ellipsis+ )+ Spacer(Modifier.height(2.dp))+ Row {+ Text(+ text = "${timeFormat.format(Date(program.startTime))} - ${timeFormat.format(Date(program.endTime))}",+ style = MaterialTheme.typography.bodySmall,+ color = TextSecondary+ )+ Spacer(Modifier.width(8.dp))+ Text(+ text = "${program.durationMinutes} min",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ if (program.hasArchive) {+ Spacer(Modifier.width(8.dp))+ StatusPill(+ label = stringResource(R.string.player_archive_badge),+ containerColor = AppColors.Warning,+ contentColor = Color.Black+ )+ }+ }+ }+ }+ }+ }+ }+ }+ }+}++@Composable+fun DiagnosticsOverlay(+ stats: PlayerStats,+ 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()) {+ Text(+ text = stringResource(R.string.player_diagnostics_recovery_actions),+ color = Primary,+ style = MaterialTheme.typography.labelMedium,+ fontWeight = FontWeight.Bold+ )+ diagnostics.recentRecoveryActions.forEach { action ->+ Text(action, color = AppColors.TextSecondary, style = MaterialTheme.typography.bodySmall)+ }+ }+ 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)+ }+ }+ }+}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.ktnew file mode 100644index 00000000..b69965b1--- /dev/null+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/overlay/PlayerSystemOverlays.kt@@ -0,0 +1,366 @@+package com.streamvault.app.ui.screens.player.overlay++import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthIn+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.text.style.TextAlign+import androidx.compose.ui.unit.dp+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.screens.player.PlayerNoticeAction+import com.streamvault.app.ui.screens.player.PlayerNoticeState+import com.streamvault.app.ui.theme.ErrorColor+import com.streamvault.app.ui.theme.OnBackground+import com.streamvault.app.ui.theme.OnSurface+import com.streamvault.app.ui.theme.OnSurfaceDim+import com.streamvault.app.ui.theme.Primary+import com.streamvault.app.ui.theme.PrimaryVariant+import com.streamvault.app.ui.theme.SurfaceElevated+import com.streamvault.app.ui.theme.SurfaceHighlight+import com.streamvault.app.ui.theme.SurfaceVariant+import com.streamvault.app.ui.theme.TextSecondary+import com.streamvault.player.PlayerError+import com.streamvault.player.PlayerTrack+import com.streamvault.player.TrackType++@Composable+fun PlayerNoticeBanner(+ notice: PlayerNoticeState?,+ onDismiss: () -> Unit,+ onAction: (PlayerNoticeAction) -> Unit,+ modifier: Modifier = Modifier+) {+ if (notice == null) return++ Surface(+ onClick = onDismiss,+ modifier = modifier,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color(0xCC5B1F1F),+ focusedContainerColor = Color(0xFFE45757)+ )+ ) {+ Column(modifier = Modifier.padding(horizontal = 18.dp, vertical = 12.dp)) {+ Text(+ text = notice.message,+ style = MaterialTheme.typography.bodyMedium,+ color = Color.White+ )+ if (notice.actions.isNotEmpty()) {+ Spacer(modifier = Modifier.height(10.dp))+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ notice.actions.forEach { action ->+ Surface(+ onClick = { onAction(action) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.12f),+ focusedContainerColor = Color.White.copy(alpha = 0.22f)+ )+ ) {+ Text(+ text = playerNoticeActionLabel(action),+ color = Color.White,+ modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp)+ )+ }+ }+ }+ }+ }+ }+}++@Composable+fun PlayerErrorOverlay(+ playerError: PlayerError?,+ contentType: String,+ hasAlternateStream: Boolean,+ hasLastChannel: Boolean,+ onAction: (PlayerNoticeAction) -> Unit,+ modifier: Modifier = Modifier+) {+ val errorMessage = when (playerError) {+ is PlayerError.NetworkError -> stringResource(R.string.player_error_network)+ is PlayerError.SourceError -> stringResource(R.string.player_error_source)+ is PlayerError.DecoderError -> stringResource(R.string.player_error_decoder)+ is PlayerError.UnknownError -> playerError.message ?: stringResource(R.string.player_error_unknown)+ null -> stringResource(R.string.player_error_unknown)+ }+ val recoveryActions = buildList {+ add(PlayerNoticeAction.RETRY)+ if (contentType == "LIVE" && hasAlternateStream) add(PlayerNoticeAction.ALTERNATE_STREAM)+ if (contentType == "LIVE" && hasLastChannel) add(PlayerNoticeAction.LAST_CHANNEL)+ }++ Box(+ modifier = modifier.fillMaxSize(),+ contentAlignment = Alignment.Center+ ) {+ Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Text(+ text = stringResource(R.string.player_error_title),+ style = MaterialTheme.typography.titleMedium,+ color = ErrorColor+ )+ Spacer(modifier = Modifier.height(8.dp))+ Text(+ text = errorMessage,+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurface+ )+ Spacer(modifier = Modifier.height(16.dp))+ Row(+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ recoveryActions.forEach { action ->+ Surface(+ onClick = { onAction(action) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (action == PlayerNoticeAction.RETRY) Primary else Color.White.copy(alpha = 0.08f),+ focusedContainerColor = if (action == PlayerNoticeAction.RETRY) PrimaryVariant else Color.White.copy(alpha = 0.18f)+ )+ ) {+ Text(+ text = playerNoticeActionLabel(action),+ color = if (action == PlayerNoticeAction.RETRY) OnBackground else Color.White,+ modifier = Modifier.padding(horizontal = 24.dp, vertical = 8.dp)+ )+ }+ }+ }+ Spacer(modifier = Modifier.height(8.dp))+ Text(+ text = if (contentType == "LIVE" && hasLastChannel) {+ stringResource(R.string.player_error_live_hint)+ } else {+ stringResource(R.string.player_error_back)+ },+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+ }+}++@Composable+fun PlayerTrackSelectionDialog(+ trackType: TrackType?,+ audioTracks: List<PlayerTrack>,+ subtitleTracks: List<PlayerTrack>,+ videoTracks: List<PlayerTrack>,+ onDismiss: () -> Unit,+ onSelectAudio: (String) -> Unit,+ onSelectVideo: (String) -> Unit,+ onSelectSubtitle: (String?) -> Unit+) {+ if (trackType == null) return++ val tracks = when (trackType) {+ TrackType.AUDIO -> audioTracks+ TrackType.VIDEO -> videoTracks+ TrackType.TEXT -> subtitleTracks+ }+ val title = when (trackType) {+ TrackType.AUDIO -> stringResource(R.string.player_track_audio)+ TrackType.VIDEO -> stringResource(R.string.player_video_quality)+ TrackType.TEXT -> stringResource(R.string.player_track_subs)+ }++ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.8f))+ .clickable(onClick = onDismiss),+ contentAlignment = Alignment.Center+ ) {+ Column(+ modifier = Modifier+ .widthIn(min = 300.dp, max = 400.dp)+ .background(SurfaceElevated, RoundedCornerShape(12.dp))+ .padding(24.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleLarge,+ color = Color.White,+ modifier = Modifier.padding(bottom = 16.dp)+ )++ LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) {+ if (trackType == TrackType.TEXT) {+ item {+ TrackSelectionItem(+ name = stringResource(R.string.player_track_off),+ isSelected = tracks.none { it.isSelected },+ onClick = {+ onSelectSubtitle(null)+ onDismiss()+ }+ )+ }+ }++ items(tracks, key = { it.id }) { track ->+ TrackSelectionItem(+ name = track.name,+ isSelected = track.isSelected,+ onClick = {+ when (trackType) {+ TrackType.AUDIO -> onSelectAudio(track.id)+ TrackType.VIDEO -> onSelectVideo(track.id)+ TrackType.TEXT -> onSelectSubtitle(track.id)+ }+ onDismiss()+ }+ )+ }+ }+ }+ }+}++@Composable+private fun TrackSelectionItem(+ name: String,+ isSelected: Boolean,+ onClick: () -> Unit+) {+ Surface(+ onClick = onClick,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = if (isSelected) Primary.copy(alpha = 0.2f) else Color.Transparent,+ focusedContainerColor = SurfaceHighlight+ ),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = name,+ style = MaterialTheme.typography.bodyLarge,+ color = if (isSelected) Primary else Color.White,+ modifier = Modifier.weight(1f)+ )+ if (isSelected) {+ Text(+ text = stringResource(R.string.player_selected),+ color = Primary,+ style = MaterialTheme.typography.labelSmall+ )+ }+ }+ }+}++@Composable+fun PlayerResumePrompt(+ title: String,+ onStartOver: () -> Unit,+ onResume: () -> Unit+) {+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(Color.Black.copy(alpha = 0.85f)),+ contentAlignment = Alignment.Center+ ) {+ Column(+ modifier = Modifier+ .widthIn(max = 500.dp)+ .background(SurfaceElevated, RoundedCornerShape(12.dp))+ .padding(32.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ Text(+ text = stringResource(R.string.player_resume_title),+ style = MaterialTheme.typography.headlineMedium,+ color = Color.White+ )+ Spacer(modifier = Modifier.height(16.dp))+ Text(+ text = stringResource(R.string.player_resume_desc, title),+ style = MaterialTheme.typography.bodyLarge,+ color = TextSecondary,+ textAlign = TextAlign.Center+ )+ Spacer(modifier = Modifier.height(32.dp))+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {+ Surface(+ onClick = onStartOver,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = SurfaceVariant,+ focusedContainerColor = SurfaceHighlight+ ),+ modifier = Modifier.weight(1f)+ ) {+ Text(+ stringResource(R.string.player_resume_start_over),+ modifier = Modifier+ .padding(vertical = 12.dp)+ .fillMaxWidth(),+ textAlign = TextAlign.Center,+ color = Color.White+ )+ }++ Surface(+ onClick = onResume,+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Primary,+ focusedContainerColor = PrimaryVariant+ ),+ modifier = Modifier.weight(1f)+ ) {+ Text(+ stringResource(R.string.player_resume),+ modifier = Modifier+ .padding(vertical = 12.dp)+ .fillMaxWidth(),+ textAlign = TextAlign.Center,+ color = Color.White,+ fontWeight = FontWeight.Bold+ )+ }+ }+ }+ }+}++@Composable+private fun playerNoticeActionLabel(action: PlayerNoticeAction): String =+ when (action) {+ PlayerNoticeAction.RETRY -> stringResource(R.string.player_retry)+ PlayerNoticeAction.LAST_CHANNEL -> stringResource(R.string.player_last_channel_action)+ PlayerNoticeAction.ALTERNATE_STREAM -> stringResource(R.string.player_try_alternate_stream)+ PlayerNoticeAction.OPEN_GUIDE -> stringResource(R.string.player_open_guide_action)+ }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 33649457..c0909414 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@@ -20,11 +20,11 @@ import androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.input.key.onPreviewKeyEventimport androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.text.input.PasswordVisualTransformationimport androidx.compose.ui.text.input.VisualTransformationimport androidx.compose.ui.unit.dp-import androidx.compose.ui.window.Dialogimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.activity.compose.rememberLauncherForActivityResultimport androidx.activity.result.contract.ActivityResultContracts@@ -33,6 +33,10 @@ import kotlinx.coroutines.Dispatchersimport kotlinx.coroutines.launchimport kotlinx.coroutines.withContextimport androidx.tv.material3.*+import com.streamvault.app.ui.components.shell.AppSectionHeader+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.app.ui.theme.*import androidx.compose.ui.res.stringResourceimport com.streamvault.app.R@@ -145,6 +149,11 @@ fun ProviderSetupScreen(var serverUrl by remember { mutableStateOf("") }var username by remember { mutableStateOf("") }var password by remember { mutableStateOf("") }+ val providerNameFocusRequester = remember { FocusRequester() }+ val m3uUrlTabFocusRequester = remember { FocusRequester() }+ val m3uFileTabFocusRequester = remember { FocusRequester() }+ val m3uValueFocusRequester = remember { FocusRequester() }+ val m3uSubmitFocusRequester = remember { FocusRequester() }// Initialize state from ViewModel if editingLaunchedEffect(editProviderId) {@@ -176,155 +185,261 @@ fun ProviderSetupScreen(Brush.verticalGradient(colors = listOf(BackgroundDeep, Background, Surface))- ),- contentAlignment = Alignment.Center+ )) {- Box(+ Row(modifier = Modifier- .width(620.dp)- .padding(horizontal = 32.dp, vertical = 24.dp)- .background(SurfaceElevated.copy(alpha = 0.94f), RoundedCornerShape(20.dp))- .border(1.dp, SurfaceHighlight, RoundedCornerShape(20.dp))+ .align(Alignment.Center)+ .fillMaxWidth()+ .padding(horizontal = 28.dp, vertical = 16.dp),+ horizontalArrangement = Arrangement.spacedBy(14.dp),+ verticalAlignment = Alignment.Top) {- Column(- modifier = Modifier- .fillMaxWidth()- .padding(28.dp)- .verticalScroll(rememberScrollState()),- horizontalAlignment = Alignment.Start,- verticalArrangement = Arrangement.spacedBy(16.dp)+ Surface(+ modifier = Modifier.width(240.dp),+ shape = RoundedCornerShape(22.dp),+ colors = SurfaceDefaults.colors(containerColor = Surface.copy(alpha = 0.92f))) {- Text(- text = if (uiState.isEditing) stringResource(R.string.setup_edit_provider) else stringResource(R.string.setup_title_streamvault),- style = MaterialTheme.typography.headlineMedium,- color = TextPrimary- )- Text(- text = if (uiState.isEditing) stringResource(R.string.setup_update_desc) else stringResource(R.string.setup_add_desc),- style = MaterialTheme.typography.bodyLarge,- color = OnSurface- )+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(14.dp),+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ Text(+ text = if (uiState.isEditing) {+ stringResource(R.string.setup_edit_provider)+ } else {+ stringResource(R.string.setup_provider_title)+ },+ style = MaterialTheme.typography.titleMedium,+ color = TextPrimary+ )- Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- if (!uiState.isEditing || uiState.selectedTab == 0) {- TabButton(stringResource(R.string.setup_xtream), selectedTab == 0) {- if (!uiState.isEditing) selectedTab = 0- }- }- if (!uiState.isEditing || uiState.selectedTab == 1) {- TabButton(stringResource(R.string.setup_m3u), selectedTab == 1) {- if (!uiState.isEditing) selectedTab = 1- }+ Text(+ text = stringResource(R.string.setup_shell_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )++ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(+ label = stringResource(R.string.setup_xtream),+ containerColor = AppColors.BrandMuted+ )+ StatusPill(+ label = stringResource(R.string.setup_m3u),+ containerColor = AppColors.SurfaceEmphasis+ )}++ SetupInfoLine(+ title = stringResource(R.string.setup_info_xtream_title),+ body = stringResource(R.string.setup_info_xtream_body)+ )+ SetupInfoLine(+ title = stringResource(R.string.setup_info_m3u_title),+ body = stringResource(R.string.setup_info_m3u_body)+ )+ SetupInfoLine(+ title = stringResource(R.string.setup_info_manage_title),+ body = stringResource(R.string.setup_info_manage_body)+ )}+ }- TvTextField(- value = name,- onValueChange = { name = it },- label = stringResource(R.string.setup_name_hint)- )+ Surface(+ modifier = Modifier.weight(1f),+ shape = RoundedCornerShape(22.dp),+ border = Border(+ border = BorderStroke(1.dp, SurfaceHighlight),+ shape = RoundedCornerShape(22.dp)+ ),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated.copy(alpha = 0.95f))+ ) {+ Column(+ modifier = Modifier+ .fillMaxWidth()+ .padding(18.dp)+ .verticalScroll(rememberScrollState()),+ horizontalAlignment = Alignment.Start,+ verticalArrangement = Arrangement.spacedBy(10.dp)+ ) {+ AppSectionHeader(+ title = if (uiState.isEditing) {+ stringResource(R.string.setup_edit_provider)+ } else {+ stringResource(R.string.setup_add_desc)+ },+ subtitle = if (uiState.isEditing) {+ stringResource(R.string.setup_update_desc)+ } else {+ stringResource(R.string.setup_form_subtitle)+ }+ )- when (selectedTab) {- 0 -> {- TvTextField(- value = serverUrl,- onValueChange = { serverUrl = it },- label = stringResource(R.string.setup_server_hint)- )- TvTextField(- value = username,- onValueChange = { username = it },- label = stringResource(R.string.setup_user_hint)- )- TvTextField(- value = password,- onValueChange = { password = it },- label = stringResource(R.string.setup_pass_hint),- isPassword = true- )+ Text(+ text = stringResource(R.string.setup_source_type_label),+ style = MaterialTheme.typography.labelMedium,+ color = AppColors.TextTertiary+ )- ActionButton(- text = if (uiState.isLoading) {- stringResource(R.string.setup_connecting)- } else if (uiState.isEditing) {- stringResource(R.string.setup_save)- } else {- stringResource(R.string.setup_login)- },- enabled = !uiState.isLoading,- onClick = {- viewModel.loginXtream(serverUrl, username, password, name)- }- )- }- 1 -> {- Row(- horizontalArrangement = Arrangement.spacedBy(8.dp),- modifier = Modifier.padding(bottom = 8.dp)- ) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ if (!uiState.isEditing || uiState.selectedTab == 0) {TabButton(- text = stringResource(R.string.setup_tab_url),- isSelected = uiState.m3uTab == 0,- onClick = { viewModel.updateM3uTab(0) }+ text = stringResource(R.string.setup_xtream),+ isSelected = selectedTab == 0,+ onClick = { if (!uiState.isEditing) selectedTab = 0 })+ }+ if (!uiState.isEditing || uiState.selectedTab == 1) {TabButton(- text = stringResource(R.string.setup_tab_file),- isSelected = uiState.m3uTab == 1,- onClick = { viewModel.updateM3uTab(1) }+ text = stringResource(R.string.setup_m3u),+ isSelected = selectedTab == 1,+ onClick = { if (!uiState.isEditing) selectedTab = 1 })}+ }- if (uiState.m3uTab == 0) {+ TvTextField(+ value = name,+ onValueChange = { name = it },+ label = stringResource(R.string.setup_name_hint),+ focusRequester = providerNameFocusRequester,+ onMoveDown = {+ if (selectedTab == 1) {+ if (uiState.m3uTab == 0) {+ m3uUrlTabFocusRequester.requestFocus()+ } else {+ m3uFileTabFocusRequester.requestFocus()+ }+ }+ }+ )++ when (selectedTab) {+ 0 -> {TvTextField(- value = m3uUrl,- onValueChange = { m3uUrl = it },- label = stringResource(R.string.setup_m3u_hint)+ value = serverUrl,+ onValueChange = { serverUrl = it },+ label = stringResource(R.string.setup_server_hint))- } else {- FileSelectorCard(- fileName = if (m3uUrl.startsWith("file://")) m3uUrl.substringAfterLast("/") else null,- fileSelectedHint = stringResource(R.string.setup_file_replace_hint),- emptySelectionTitle = stringResource(R.string.setup_file_select_title),- emptySelectionHint = stringResource(R.string.setup_file_browse_hint),- onClick = { filePickerLauncher.launch(arrayOf("*/*")) }+ TvTextField(+ value = username,+ onValueChange = { username = it },+ label = stringResource(R.string.setup_user_hint)+ )+ TvTextField(+ value = password,+ onValueChange = { password = it },+ label = stringResource(R.string.setup_pass_hint),+ isPassword = true+ )++ ActionButton(+ text = if (uiState.isLoading) {+ stringResource(R.string.setup_connecting)+ } else if (uiState.isEditing) {+ stringResource(R.string.setup_save)+ } else {+ stringResource(R.string.setup_login)+ },+ enabled = !uiState.isLoading,+ onClick = {+ viewModel.loginXtream(serverUrl, username, password, name)+ })- fileImportError?.let { importError ->- Text(- text = importError,- style = MaterialTheme.typography.bodyMedium,- color = ErrorColor+ }++ 1 -> {+ Row(+ horizontalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ TabButton(+ text = stringResource(R.string.setup_tab_url),+ isSelected = uiState.m3uTab == 0,+ onClick = { viewModel.updateM3uTab(0) },+ onFocused = { viewModel.updateM3uTab(0) },+ focusRequester = m3uUrlTabFocusRequester,+ onMoveUp = { providerNameFocusRequester.requestFocus() },+ onMoveDown = { m3uValueFocusRequester.requestFocus() }+ )+ TabButton(+ text = stringResource(R.string.setup_tab_file),+ isSelected = uiState.m3uTab == 1,+ onClick = { viewModel.updateM3uTab(1) },+ onFocused = { viewModel.updateM3uTab(1) },+ focusRequester = m3uFileTabFocusRequester,+ onMoveUp = { providerNameFocusRequester.requestFocus() },+ onMoveDown = { m3uValueFocusRequester.requestFocus() })}- }- ActionButton(- text = if (uiState.isLoading) {- stringResource(R.string.setup_validating)- } else if (uiState.isEditing) {- stringResource(R.string.setup_save)+ if (uiState.m3uTab == 0) {+ TvTextField(+ value = m3uUrl,+ onValueChange = { m3uUrl = it },+ label = stringResource(R.string.setup_m3u_hint),+ focusRequester = m3uValueFocusRequester,+ onMoveUp = { m3uUrlTabFocusRequester.requestFocus() },+ onMoveDown = { m3uSubmitFocusRequester.requestFocus() }+ )} else {- stringResource(R.string.setup_add)- },- enabled = !uiState.isLoading,- onClick = { viewModel.addM3u(m3uUrl, name) }- )+ FileSelectorCard(+ fileName = if (m3uUrl.startsWith("file://")) {+ m3uUrl.substringAfterLast("/")+ } else {+ null+ },+ fileSelectedHint = stringResource(R.string.setup_file_replace_hint),+ emptySelectionTitle = stringResource(R.string.setup_file_select_title),+ emptySelectionHint = stringResource(R.string.setup_file_browse_hint),+ onClick = { filePickerLauncher.launch(arrayOf("*/*")) },+ focusRequester = m3uValueFocusRequester,+ onMoveUp = { m3uFileTabFocusRequester.requestFocus() },+ onMoveDown = { m3uSubmitFocusRequester.requestFocus() }+ )++ fileImportError?.let { importError ->+ Text(+ text = importError,+ style = MaterialTheme.typography.bodyMedium,+ color = ErrorColor+ )+ }+ }++ ActionButton(+ text = if (uiState.isLoading) {+ stringResource(R.string.setup_validating)+ } else if (uiState.isEditing) {+ stringResource(R.string.setup_save)+ } else {+ stringResource(R.string.setup_add)+ },+ enabled = !uiState.isLoading,+ onClick = { viewModel.addM3u(m3uUrl, name) },+ focusRequester = m3uSubmitFocusRequester,+ onMoveUp = { m3uValueFocusRequester.requestFocus() }+ )+ }}- }- uiState.validationError?.let { error ->- Text(- text = error,- style = MaterialTheme.typography.bodyMedium,- color = ErrorColor- )- }+ uiState.validationError?.let { error ->+ Text(+ text = error,+ style = MaterialTheme.typography.bodyMedium,+ color = ErrorColor+ )+ }- uiState.error?.let { error ->- Text(- text = error,- style = MaterialTheme.typography.bodyMedium,- color = ErrorColor- )+ uiState.error?.let { error ->+ Text(+ text = error,+ style = MaterialTheme.typography.bodyMedium,+ color = ErrorColor+ )+ }}}}@@ -335,29 +450,52 @@ fun ProviderSetupScreen(}}+@Composable+private fun SetupInfoLine(+ title: String,+ body: String+) {+ Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {+ Text(+ text = title,+ style = MaterialTheme.typography.titleSmall,+ color = TextPrimary+ )+ Text(+ text = body,+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )+ }+}+@Composablefun SyncProgressDialog(message: String) {- Dialog(onDismissRequest = {}) {- androidx.compose.material3.Surface(- shape = RoundedCornerShape(16.dp),- color = MaterialTheme.colorScheme.surface,- modifier = Modifier.width(300.dp).padding(16.dp)- ) {+ PremiumDialog(+ title = stringResource(R.string.settings_syncing_title),+ subtitle = stringResource(R.string.settings_syncing_subtitle),+ onDismissRequest = {},+ widthFraction = 0.32f,+ content = {Column(- modifier = Modifier.padding(24.dp),+ modifier = Modifier.fillMaxWidth(),horizontalAlignment = Alignment.CenterHorizontally,verticalArrangement = Arrangement.spacedBy(16.dp)) {- CircularProgressIndicator(color = MaterialTheme.colorScheme.primary)+ CircularProgressIndicator(color = AppColors.Brand)+ StatusPill(+ label = stringResource(R.string.settings_syncing_btn),+ containerColor = AppColors.BrandMuted+ )Text(text = message,- style = MaterialTheme.typography.bodyLarge,- color = MaterialTheme.colorScheme.onSurface,+ style = MaterialTheme.typography.bodyMedium,+ color = OnBackground,textAlign = TextAlign.Center)}}- }+ )}@Composable@@ -366,10 +504,13 @@ private fun TvTextField(onValueChange: (String) -> Unit,label: String,isPassword: Boolean = false,- modifier: Modifier = Modifier+ modifier: Modifier = Modifier,+ focusRequester: FocusRequester? = null,+ onMoveUp: (() -> Unit)? = null,+ onMoveDown: (() -> Unit)? = null) {var isFocused by remember { mutableStateOf(false) }- val focusRequester = remember { androidx.compose.ui.focus.FocusRequester() }+ val internalFocusRequester = focusRequester ?: remember { FocusRequester() }val borderColor = if (isFocused) Primary else SurfaceHighlightval bgColor = if (isFocused) Surface else SurfaceElevated@@ -382,7 +523,7 @@ private fun TvTextField(.height(52.dp).background(bgColor, RoundedCornerShape(8.dp)).border(borderWidth, borderColor, RoundedCornerShape(8.dp))- .clickable { focusRequester.requestFocus() }+ .clickable { internalFocusRequester.requestFocus() }.padding(horizontal = 16.dp),contentAlignment = Alignment.CenterStart) {@@ -390,7 +531,7 @@ private fun TvTextField(if (value.isEmpty() && !isFocused) {Text(text = label,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = OnSurfaceDim)}@@ -400,11 +541,24 @@ private fun TvTextField(onValueChange = onValueChange,modifier = Modifier.fillMaxWidth()- .focusRequester(focusRequester)- .onFocusChanged { isFocused = it.isFocused },- textStyle = MaterialTheme.typography.bodyMedium.copy(- color = OnBackground- ),+ .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+ },+ textStyle = MaterialTheme.typography.bodySmall.copy(color = OnBackground),singleLine = true,visualTransformation = if (isPassword) PasswordVisualTransformation() else VisualTransformation.None,cursorBrush = androidx.compose.ui.graphics.SolidColor(Primary)@@ -416,9 +570,12 @@ private fun TvTextField(private fun ActionButton(text: String,enabled: Boolean,- onClick: () -> Unit+ onClick: () -> Unit,+ focusRequester: FocusRequester? = null,+ onMoveUp: (() -> Unit)? = null) {var isFocused by remember { mutableStateOf(false) }+ val internalFocusRequester = focusRequester ?: remember { FocusRequester() }val scale by animateFloatAsState(targetValue = if (isFocused) 1.05f else 1f,@@ -432,7 +589,17 @@ private fun ActionButton(.fillMaxWidth().height(52.dp).scale(scale)- .onFocusChanged { isFocused = it.isFocused },+ .focusRequester(internalFocusRequester)+ .onFocusChanged { isFocused = it.isFocused }+ .onPreviewKeyEvent { event ->+ if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN &&+ event.nativeKeyEvent.keyCode == android.view.KeyEvent.KEYCODE_DPAD_UP &&+ onMoveUp != null+ ) {+ onMoveUp()+ true+ } else false+ },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = if (enabled) Primary else SurfaceHighlight,@@ -446,7 +613,7 @@ private fun ActionButton(Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) {Text(text = text,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = if (enabled) Color.White else OnSurfaceDim)}@@ -459,9 +626,13 @@ private fun FileSelectorCard(fileSelectedHint: String,emptySelectionTitle: String,emptySelectionHint: String,- onClick: () -> Unit+ onClick: () -> Unit,+ focusRequester: FocusRequester? = null,+ onMoveUp: (() -> Unit)? = null,+ onMoveDown: (() -> Unit)? = null) {var isFocused by remember { mutableStateOf(false) }+ val internalFocusRequester = focusRequester ?: remember { FocusRequester() }val borderColor = if (isFocused) Primary else SurfaceHighlightval bgColor = if (isFocused) Surface else SurfaceElevated@@ -472,7 +643,23 @@ private fun FileSelectorCard(modifier = Modifier.fillMaxWidth().height(80.dp)- .onFocusChanged { isFocused = it.isFocused },+ .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+ },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(12.dp)),border = ClickableSurfaceDefaults.border(border = Border(BorderStroke(borderWidth, borderColor)),@@ -520,13 +707,38 @@ private fun FileSelectorCard(private fun TabButton(text: String,isSelected: Boolean,- onClick: () -> Unit+ onClick: () -> Unit,+ onFocused: (() -> Unit)? = null,+ focusRequester: FocusRequester? = null,+ onMoveUp: (() -> Unit)? = null,+ onMoveDown: (() -> Unit)? = null) {var isFocused by remember { mutableStateOf(false) }+ val internalFocusRequester = focusRequester ?: remember { FocusRequester() }Surface(onClick = onClick,- modifier = Modifier.onFocusChanged { isFocused = it.isFocused },+ modifier = Modifier+ .focusRequester(internalFocusRequester)+ .onFocusChanged {+ isFocused = it.isFocused+ if (it.isFocused) onFocused?.invoke()+ }+ .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+ },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),colors = ClickableSurfaceDefaults.colors(containerColor = if (isSelected) Primary.copy(alpha = 0.2f) else Surface,@@ -539,7 +751,7 @@ private fun TabButton() {Text(text = text,- style = MaterialTheme.typography.bodyMedium,+ style = MaterialTheme.typography.bodySmall,color = if (isSelected) Primary else if (isFocused) TextPrimary else OnSurface,modifier = Modifier.padding(horizontal = 24.dp, vertical = 10.dp))diff --git a/app/src/main/java/com/streamvault/app/ui/screens/search/SearchScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/search/SearchScreen.ktindex 583ce69a..931908ff 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/search/SearchScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/search/SearchScreen.kt@@ -6,24 +6,22 @@ import androidx.compose.foundation.backgroundimport androidx.compose.foundation.borderimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.*+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.grid.GridCells+import androidx.compose.foundation.lazy.grid.GridItemSpanimport androidx.compose.foundation.lazy.grid.LazyVerticalGridimport androidx.compose.foundation.lazy.grid.items-import androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.foundation.text.BasicTextFieldimport androidx.compose.material3.TextButtonimport androidx.compose.runtime.*import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequester-import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Color-import androidx.compose.ui.graphics.SolidColorimport androidx.compose.ui.platform.LocalFocusManagerimport androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dpimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.lifecycle.ViewModel@@ -35,6 +33,9 @@ import com.streamvault.app.ui.components.ChannelCardimport com.streamvault.app.ui.components.MovieCardimport com.streamvault.app.ui.components.SeriesCardimport com.streamvault.app.ui.components.TvEmptyState+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppScreenScaffold+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.app.ui.theme.*import com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Movie@@ -195,6 +196,8 @@ fun SearchScreen(onChannelClick: (Channel) -> Unit,onMovieClick: (Movie) -> Unit,onSeriesClick: (Series) -> Unit,+ onNavigate: (String) -> Unit,+ currentRoute: String,viewModel: SearchViewModel = hiltViewModel()) {val query by viewModel.query.collectAsState()@@ -250,18 +253,38 @@ fun SearchScreen()}- Row(- modifier = Modifier- .fillMaxSize()- .padding(24.dp),- horizontalArrangement = Arrangement.spacedBy(32.dp)+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.search_title),+ subtitle = stringResource(R.string.search_screen_subtitle),+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false) {- // Left Side: Keyboard & Filters- Column(- modifier = Modifier.weight(1f),- verticalArrangement = Arrangement.spacedBy(24.dp)+ LazyColumn(+ modifier = Modifier.fillMaxSize(),+ verticalArrangement = Arrangement.spacedBy(14.dp),+ contentPadding = PaddingValues(bottom = 24.dp)) {- // Real Search Input triggering system keyboard+ item {+ Text(+ text = stringResource(R.string.search_title),+ style = MaterialTheme.typography.headlineSmall,+ color = AppColors.TextPrimary+ )+ }++ item {+ Text(+ text = stringResource(R.string.search_command_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = AppColors.TextSecondary,+ modifier = Modifier.widthIn(max = 640.dp)+ )+ }++ item {SearchInput(value = query,onValueChange = { viewModel.onQueryChange(it) },@@ -271,175 +294,179 @@ fun SearchScreen(viewModel.onSearchSubmitted()focusManager.clearFocus()},- modifier = Modifier.padding(bottom = 0.dp)+ modifier = Modifier.widthIn(max = 620.dp))-- androidx.compose.foundation.lazy.LazyRow(- horizontalArrangement = Arrangement.spacedBy(8.dp)- ) {- items(SearchTab.values().toList()) { tab ->- FilterChip(- selected = tab == selectedTab,- onClick = { viewModel.onTabSelected(tab) },- colors = FilterChipDefaults.colors(- selectedContainerColor = Primary,- selectedContentColor = Color.White- )- ) {- Text(stringResource(tab.titleRes))- }- }}- if (recentQueries.isNotEmpty()) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- Text(- text = stringResource(R.string.search_recent_title),- style = MaterialTheme.typography.titleSmall,- color = OnSurface- )- TextButton(onClick = { viewModel.clearRecentQueries() }) {- Text(stringResource(R.string.search_clear_history))- }- }-+ item {androidx.compose.foundation.lazy.LazyRow(horizontalArrangement = Arrangement.spacedBy(8.dp)) {- items(recentQueries) { recentQuery ->+ items(SearchTab.values().toList()) { tab ->FilterChip(- selected = recentQuery.equals(query, ignoreCase = true),- onClick = {- viewModel.onRecentQuerySelected(recentQuery)- focusManager.clearFocus()- },+ selected = tab == selectedTab,+ onClick = { viewModel.onTabSelected(tab) },colors = FilterChipDefaults.colors(selectedContainerColor = Primary,selectedContentColor = Color.White)) {- Text(recentQuery)+ Text(stringResource(tab.titleRes))}}}}- }- // Right Side: Results- Box(modifier = Modifier.weight(2.5f).fillMaxHeight()) {- when {- !uiState.hasActiveProvider -> {- SearchMessageState(- title = stringResource(R.string.search_no_provider_title),- subtitle = stringResource(R.string.search_no_provider_subtitle)- )+ if (recentQueries.isNotEmpty()) {+ item {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = stringResource(R.string.search_recent_title),+ style = MaterialTheme.typography.titleSmall,+ color = OnSurface+ )+ TextButton(onClick = { viewModel.clearRecentQueries() }) {+ Text(stringResource(R.string.search_clear_history))+ }+ }}- uiState.queryLength < 2 -> {- SearchMessageState(- title = stringResource(R.string.search_ready_title),- subtitle = stringResource(R.string.search_type_to_search)- )+ item {+ androidx.compose.foundation.lazy.LazyRow(+ horizontalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ items(recentQueries) { recentQuery ->+ FilterChip(+ selected = recentQuery.equals(query, ignoreCase = true),+ onClick = {+ viewModel.onRecentQuerySelected(recentQuery)+ focusManager.clearFocus()+ },+ colors = FilterChipDefaults.colors(+ selectedContainerColor = Primary,+ selectedContentColor = Color.White+ )+ ) {+ Text(recentQuery)+ }+ }+ }}+ }- uiState.isEmpty -> {- SearchMessageState(- title = stringResource(R.string.search_no_results_title),- subtitle = stringResource(R.string.search_no_results, query)- )- }+ item {+ when {+ !uiState.hasActiveProvider -> {+ SearchMessageState(+ title = stringResource(R.string.search_no_provider_title),+ subtitle = stringResource(R.string.search_no_provider_subtitle)+ )+ }- else -> {- LazyVerticalGrid(- columns = GridCells.Adaptive(140.dp),- verticalArrangement = Arrangement.spacedBy(16.dp),- horizontalArrangement = Arrangement.spacedBy(16.dp),- contentPadding = PaddingValues(bottom = 24.dp)- ) {- item(span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {- SearchResultsSummaryRow(- uiState = uiState,- selectedTab = selectedTab,- onTabSelected = viewModel::onTabSelected- )- }+ uiState.queryLength < 2 -> {+ SearchMessageState(+ title = stringResource(R.string.search_ready_title),+ subtitle = stringResource(R.string.search_type_to_search)+ )+ }- // Channels- if (uiState.channels.isNotEmpty()) {- if (selectedTab == SearchTab.ALL) {- item(span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {- SectionHeader(stringResource(R.string.search_live_tv))- }- }- items(uiState.channels) { channel ->- val isLocked = (channel.isAdult || channel.isUserProtected) && uiState.parentalControlLevel == 1- ChannelCard(- channel = channel,- isLocked = isLocked,- onClick = {- if (isLocked) {- pendingChannel = channel- showPinDialog = true- } else {- onChannelClick(channel)- }- },- modifier = Modifier.aspectRatio(16f/9f)+ uiState.isEmpty -> {+ SearchMessageState(+ title = stringResource(R.string.search_no_results_title),+ subtitle = stringResource(R.string.search_no_results, query)+ )+ }++ else -> {+ LazyVerticalGrid(+ columns = GridCells.Adaptive(132.dp),+ modifier = Modifier.fillMaxWidth().heightIn(min = 280.dp, max = 1600.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ userScrollEnabled = false+ ) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ SearchResultsSummaryRow(+ uiState = uiState,+ selectedTab = selectedTab,+ onTabSelected = viewModel::onTabSelected)}- }- // Movies- if (uiState.movies.isNotEmpty()) {- if (selectedTab == SearchTab.ALL) {- item(span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {- SectionHeader(stringResource(R.string.search_movies))+ if (uiState.channels.isNotEmpty()) {+ if (selectedTab == SearchTab.ALL) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ SectionHeader(stringResource(R.string.search_live_tv))+ }+ }+ items(uiState.channels) { channel ->+ val isLocked = (channel.isAdult || channel.isUserProtected) && uiState.parentalControlLevel == 1+ ChannelCard(+ channel = channel,+ isLocked = isLocked,+ onClick = {+ if (isLocked) {+ pendingChannel = channel+ showPinDialog = true+ } else {+ onChannelClick(channel)+ }+ },+ modifier = Modifier.aspectRatio(16f / 9f)+ )}}- items(uiState.movies) { movie ->- val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1- MovieCard(- movie = movie,- isLocked = isLocked,- onClick = {- if (isLocked) {- pendingMovie = movie- showPinDialog = true- } else {- onMovieClick(movie)- }- },- modifier = Modifier.aspectRatio(2f/3f)- )- }- }- // Series- if (uiState.series.isNotEmpty()) {- if (selectedTab == SearchTab.ALL) {- item(span = { androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }) {- SectionHeader(stringResource(R.string.search_series))+ if (uiState.movies.isNotEmpty()) {+ if (selectedTab == SearchTab.ALL) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ SectionHeader(stringResource(R.string.search_movies))+ }+ }+ items(uiState.movies) { movie ->+ val isLocked = (movie.isAdult || movie.isUserProtected) && uiState.parentalControlLevel == 1+ MovieCard(+ movie = movie,+ isLocked = isLocked,+ onClick = {+ if (isLocked) {+ pendingMovie = movie+ showPinDialog = true+ } else {+ onMovieClick(movie)+ }+ },+ modifier = Modifier.aspectRatio(2f / 3f)+ )}}- items(uiState.series) { series ->- val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1- SeriesCard(- series = series,- isLocked = isLocked,- onClick = {- if (isLocked) {- pendingSeries = series- showPinDialog = true- } else {- onSeriesClick(series)- }- },- modifier = Modifier.aspectRatio(2f/3f)- )++ if (uiState.series.isNotEmpty()) {+ if (selectedTab == SearchTab.ALL) {+ item(span = { GridItemSpan(maxLineSpan) }) {+ SectionHeader(stringResource(R.string.search_series))+ }+ }+ items(uiState.series) { series ->+ val isLocked = (series.isAdult || series.isUserProtected) && uiState.parentalControlLevel == 1+ SeriesCard(+ series = series,+ isLocked = isLocked,+ onClick = {+ if (isLocked) {+ pendingSeries = series+ showPinDialog = true+ } else {+ onSeriesClick(series)+ }+ },+ modifier = Modifier.aspectRatio(2f / 3f)+ )+ }}}}@@ -455,7 +482,7 @@ fun SectionHeader(title: String) {Text(text = title,style = MaterialTheme.typography.titleMedium,- color = Primary,+ color = AppColors.Brand,modifier = Modifier.padding(vertical = 8.dp))}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.ktindex 49a7aa00..fab03993 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailScreen.kt@@ -1,12 +1,26 @@package com.streamvault.app.ui.screens.seriesimport androidx.compose.foundation.background-import androidx.compose.foundation.layout.*+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.Spacer+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShape-import androidx.compose.runtime.*+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.draw.clip@@ -14,19 +28,28 @@ import androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.platform.LocalContext-import androidx.compose.ui.text.font.FontWeight+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.hilt.navigation.compose.hiltViewModel-import androidx.tv.material3.*+import androidx.tv.material3.Border+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport coil3.compose.AsyncImageimport coil3.request.ImageRequest-import com.streamvault.app.ui.theme.*+import com.streamvault.app.R+import com.streamvault.app.ui.components.shell.ContentMetadataStrip+import com.streamvault.app.ui.components.shell.EpisodeRowCard+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.domain.model.Episodeimport com.streamvault.domain.model.Seasonimport com.streamvault.domain.model.Series-import androidx.compose.ui.res.stringResource-import com.streamvault.app.R@Composablefun SeriesDetailScreen(@@ -36,17 +59,27 @@ fun SeriesDetailScreen() {val uiState by viewModel.uiState.collectAsState()val series = uiState.series-+if (uiState.isLoading) {- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Text(stringResource(R.string.series_loading_details), color = OnSurface)+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.Canvas),+ contentAlignment = Alignment.Center+ ) {+ Text(stringResource(R.string.series_loading_details), color = AppColors.TextSecondary)}return}if (series == null) {- Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Text(stringResource(R.string.series_not_found), color = ErrorColor)+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.Canvas),+ contentAlignment = Alignment.Center+ ) {+ Text(stringResource(R.string.series_not_found), color = AppColors.Live)}return}@@ -55,7 +88,8 @@ fun SeriesDetailScreen(series = series,selectedSeason = uiState.selectedSeason,onSeasonSelected = viewModel::selectSeason,- onEpisodeClick = onEpisodeClick+ onEpisodeClick = onEpisodeClick,+ onBack = onBack)}@@ -64,10 +98,14 @@ private fun SeriesDetailContent(series: Series,selectedSeason: Season?,onSeasonSelected: (Season) -> Unit,- onEpisodeClick: (Episode) -> Unit+ onEpisodeClick: (Episode) -> Unit,+ onBack: () -> Unit) {- Box(modifier = Modifier.fillMaxSize().background(Background)) {- // Backdrop+ Box(+ modifier = Modifier+ .fillMaxSize()+ .background(AppColors.Canvas)+ ) {AsyncImage(model = ImageRequest.Builder(LocalContext.current).data(series.backdropUrl ?: series.posterUrl)@@ -75,22 +113,21 @@ private fun SeriesDetailContent(contentDescription = null,modifier = Modifier.fillMaxWidth()- .height(400.dp)+ .height(420.dp).align(Alignment.TopCenter),- contentScale = ContentScale.Crop,- alpha = 0.5f+ contentScale = ContentScale.Crop)-- // Gradient overlay+Box(modifier = Modifier.fillMaxWidth()- .height(400.dp)+ .height(420.dp).background(Brush.verticalGradient(colors = listOf(Color.Transparent,- Background+ AppColors.HeroTop,+ AppColors.HeroBottom)))@@ -98,73 +135,120 @@ private fun SeriesDetailContent(LazyColumn(modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(16.dp)+ contentPadding = PaddingValues(horizontal = 56.dp, vertical = 36.dp),+ verticalArrangement = Arrangement.spacedBy(24.dp)) {- // Header Infoitem {- Column(modifier = Modifier.padding(top = 200.dp, bottom = 24.dp)) {- Text(- text = series.name,- style = MaterialTheme.typography.displayMedium,- color = OnSurface,- fontWeight = FontWeight.Bold+ Button(+ onClick = onBack,+ colors = ButtonDefaults.colors(+ containerColor = AppColors.Surface.copy(alpha = 0.72f),+ contentColor = AppColors.TextPrimary+ ),+ border = ButtonDefaults.border(+ border = Border(border = androidx.compose.foundation.BorderStroke(1.dp, AppColors.Outline)))- Spacer(modifier = Modifier.height(8.dp))- Row(verticalAlignment = Alignment.CenterVertically) {- if (series.rating > 0) {- Text("⭐ ${series.rating}", color = Secondary, style = MaterialTheme.typography.labelLarge)- Spacer(modifier = Modifier.width(16.dp))- }- series.releaseDate?.let { date ->- Text(date, color = OnSurfaceVariant, style = MaterialTheme.typography.labelLarge)- Spacer(modifier = Modifier.width(16.dp))- }- series.genre?.let { genre ->- Text(genre, color = OnSurfaceVariant, style = MaterialTheme.typography.labelLarge)+ ) {+ Text(stringResource(R.string.series_detail_back))+ }+ }++ item {+ Row(+ horizontalArrangement = Arrangement.spacedBy(24.dp),+ verticalAlignment = Alignment.Bottom+ ) {+ Box(+ modifier = Modifier+ .width(220.dp)+ .aspectRatio(2f / 3f)+ .clip(RoundedCornerShape(24.dp))+ .background(AppColors.SurfaceElevated)+ ) {+ AsyncImage(+ model = series.posterUrl ?: series.backdropUrl,+ contentDescription = series.name,+ modifier = Modifier.fillMaxSize(),+ contentScale = ContentScale.Crop+ )+ }++ Column(+ modifier = Modifier.fillMaxWidth(),+ verticalArrangement = Arrangement.spacedBy(18.dp)+ ) {+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ StatusPill(label = stringResource(R.string.nav_series), containerColor = AppColors.BrandMuted)+ series.rating.takeIf { it > 0f }?.let {+ StatusPill(label = "RTG ${String.format("%.1f", it)}", containerColor = AppColors.Warning, contentColor = Color.Black)+ }}+ Text(+ text = series.name,+ style = MaterialTheme.typography.displayMedium,+ color = AppColors.TextPrimary,+ maxLines = 2,+ overflow = TextOverflow.Ellipsis+ )+ ContentMetadataStrip(+ values = listOf(+ series.releaseDate.orEmpty(),+ series.genre.orEmpty(),+ selectedSeason?.name.orEmpty()+ )+ )+ Text(+ text = series.plot ?: stringResource(R.string.series_plot_fallback),+ style = MaterialTheme.typography.bodyLarge,+ color = AppColors.TextSecondary,+ maxLines = 5,+ overflow = TextOverflow.Ellipsis+ )}- Spacer(modifier = Modifier.height(16.dp))- Text(- text = series.plot ?: "No plot available",- style = MaterialTheme.typography.bodyMedium,- color = OnSurface.copy(alpha = 0.8f),- maxLines = 4,- overflow = TextOverflow.Ellipsis- )}}- // Seasonsif (series.seasons.isNotEmpty()) {item {- Text(stringResource(R.string.series_seasons), style = MaterialTheme.typography.titleMedium, color = OnSurface)- Spacer(modifier = Modifier.height(8.dp))- LazyRow(- horizontalArrangement = Arrangement.spacedBy(12.dp),- contentPadding = PaddingValues(horizontal = 4.dp, vertical = 4.dp)- ) {- items(series.seasons) { season ->- SeasonChip(- season = season,- isSelected = season == selectedSeason,- onClick = { onSeasonSelected(season) }- )+ Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {+ Text(+ text = stringResource(R.string.series_seasons),+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )+ LazyRow(+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ contentPadding = PaddingValues(vertical = 2.dp)+ ) {+ items(series.seasons) { season ->+ SeasonChip(+ season = season,+ isSelected = season == selectedSeason,+ onClick = { onSeasonSelected(season) }+ )+ }}}- Spacer(modifier = Modifier.height(24.dp))}}- // EpisodesselectedSeason?.let { season ->item {- Text(stringResource(R.string.series_episodes, season.episodes.size), style = MaterialTheme.typography.titleMedium, color = OnSurface)- Spacer(modifier = Modifier.height(8.dp))+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Text(+ text = stringResource(R.string.series_episodes, season.episodes.size),+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )+ Text(+ text = season.name,+ style = MaterialTheme.typography.bodyMedium,+ color = AppColors.TextTertiary+ )+ }}-items(season.episodes) { episode ->- EpisodeItem(episode = episode, onClick = { onEpisodeClick(episode) })- Spacer(modifier = Modifier.height(8.dp))+ EpisodeItem(episode = episode, onClick = { onEpisodeClick(episode) })}}}@@ -179,23 +263,28 @@ fun SeasonChip() {Surface(onClick = onClick,- shape = ClickableSurfaceDefaults.shape(shape = RoundedCornerShape(50)),+ shape = ClickableSurfaceDefaults.shape(shape = RoundedCornerShape(999.dp)),colors = ClickableSurfaceDefaults.colors(- containerColor = if (isSelected) Primary else Surface,- contentColor = if (isSelected) OnPrimary else OnSurface,- focusedContainerColor = Primary,- focusedContentColor = OnPrimary+ containerColor = if (isSelected) AppColors.BrandMuted else AppColors.SurfaceElevated,+ contentColor = AppColors.TextPrimary,+ focusedContainerColor = AppColors.SurfaceEmphasis,+ focusedContentColor = AppColors.TextPrimary),border = ClickableSurfaceDefaults.border(border = Border(- border = androidx.compose.foundation.BorderStroke(1.dp, if (isSelected) Primary else OnSurfaceVariant.copy(alpha = 0.5f))+ border = androidx.compose.foundation.BorderStroke(1.dp, if (isSelected) AppColors.Brand else AppColors.Outline),+ shape = RoundedCornerShape(999.dp)+ ),+ focusedBorder = Border(+ border = androidx.compose.foundation.BorderStroke(2.dp, AppColors.Focus),+ shape = RoundedCornerShape(999.dp)))) {Text(text = season.name,- modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),- style = MaterialTheme.typography.labelMedium+ modifier = Modifier.padding(horizontal = 18.dp, vertical = 10.dp),+ style = MaterialTheme.typography.labelLarge)}}@@ -207,68 +296,16 @@ fun EpisodeItem() {Surface(onClick = onClick,- shape = ClickableSurfaceDefaults.shape(shape = RoundedCornerShape(8.dp)),+ shape = ClickableSurfaceDefaults.shape(shape = RoundedCornerShape(18.dp)),colors = ClickableSurfaceDefaults.colors(- containerColor = Surface,- focusedContainerColor = SurfaceVariant+ containerColor = AppColors.SurfaceElevated,+ focusedContainerColor = AppColors.SurfaceEmphasis),modifier = Modifier.fillMaxWidth()) {- Row(- modifier = Modifier- .fillMaxWidth()- .padding(12.dp),- verticalAlignment = Alignment.CenterVertically- ) {- // Episode Number- Text(- text = "${episode.episodeNumber}",- style = MaterialTheme.typography.titleMedium,- color = OnSurfaceVariant,- modifier = Modifier.width(40.dp)- )-- // Thumbnail (Optional)- episode.coverUrl?.takeIf { it.isNotEmpty() }?.let { url ->- AsyncImage(- model = url,- contentDescription = null,- modifier = Modifier- .width(120.dp)- .aspectRatio(16f/9f)- .clip(RoundedCornerShape(4.dp)),- contentScale = ContentScale.Crop- )- Spacer(modifier = Modifier.width(16.dp))- }-- Column(modifier = Modifier.weight(1f)) {- Text(- text = episode.title,- style = MaterialTheme.typography.titleMedium,- color = OnSurface,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- episode.plot?.let { plot ->- if (plot.isNotEmpty()) {- Spacer(modifier = Modifier.height(4.dp))- Text(- text = plot,- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceVariant,- maxLines = 2,- overflow = TextOverflow.Ellipsis- )- }- }- }-- Text(- text = "▶",- color = Primary,- modifier = Modifier.padding(start = 8.dp)- )- }+ EpisodeRowCard(+ episode = episode,+ modifier = Modifier.fillMaxWidth()+ )}}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 c785946c..8cdff313 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@@ -1,5 +1,6 @@package com.streamvault.app.ui.screens.series+import androidx.activity.compose.BackHandlerimport androidx.compose.foundation.layout.*import androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.items@@ -43,7 +44,6 @@ import com.streamvault.app.ui.components.SelectionChipimport com.streamvault.app.ui.components.SelectionChipRowimport com.streamvault.app.ui.components.SeriesCardimport com.streamvault.app.ui.components.SkeletonRow-import com.streamvault.app.ui.components.TopNavBarimport com.streamvault.app.ui.theme.*import kotlinx.coroutines.launchimport androidx.compose.ui.res.stringResource@@ -55,6 +55,12 @@ import androidx.compose.runtime.saveable.rememberSaveableimport com.streamvault.app.ui.components.ReorderTopBarimport com.streamvault.app.ui.components.dialogs.DeleteGroupDialogimport com.streamvault.app.ui.components.dialogs.RenameGroupDialog+import com.streamvault.app.ui.components.shell.BrowseHeroPanel+import com.streamvault.app.ui.components.shell.BrowseSearchLaunchCard+import com.streamvault.app.ui.components.shell.LoadMoreCard+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppMessageState+import com.streamvault.app.ui.components.shell.AppScreenScaffold@OptIn(ExperimentalFoundationApi::class)@Composable@@ -82,6 +88,10 @@ fun SeriesScreen(}}+ BackHandler(enabled = uiState.selectedCategory != null && !uiState.isReorderMode) {+ viewModel.selectCategory(null)+ }+if (showPinDialog) {com.streamvault.app.ui.components.dialogs.PinDialog(onDismissRequest = {@@ -106,15 +116,22 @@ fun SeriesScreen(}Box(modifier = Modifier.fillMaxSize()) {- Column(modifier = Modifier.fillMaxSize()) {+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.nav_series),+ subtitle = null,+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false+ ) {if (uiState.isReorderMode && uiState.reorderCategory != null) {ReorderTopBar(categoryName = uiState.reorderCategory!!.name,onSave = { viewModel.saveReorder() },- onCancel = { viewModel.exitCategoryReorderMode() }+ onCancel = { viewModel.exitCategoryReorderMode() },+ subtitle = stringResource(R.string.series_reorder_subtitle))- } else {- TopNavBar(currentRoute = currentRoute, onNavigate = onNavigate)}if (uiState.isLoading) {@@ -130,11 +147,10 @@ fun SeriesScreen(}} else if (uiState.seriesByCategory.isEmpty()) {Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text("📺", style = MaterialTheme.typography.displayLarge)- Spacer(Modifier.height(8.dp))- Text(stringResource(R.string.series_no_found), style = MaterialTheme.typography.bodyLarge, color = OnSurface)- }+ AppMessageState(+ title = stringResource(R.string.series_no_found),+ subtitle = stringResource(R.string.series_no_found_subtitle)+ )}} else {Row(modifier = Modifier.fillMaxSize()) {@@ -180,16 +196,16 @@ fun SeriesScreen(Column(modifier = Modifier- .width(220.dp)+ .width(188.dp).fillMaxHeight()- .background(SurfaceElevated.copy(alpha = 0.5f))+ .background(SurfaceElevated.copy(alpha = 0.72f), RoundedCornerShape(20.dp)).padding(top = 8.dp)) {// Sticky Header- Column(modifier = Modifier.padding(horizontal = 16.dp)) {+ Column(modifier = Modifier.padding(horizontal = 12.dp)) {Text(text = stringResource(R.string.series_categories_title),- style = MaterialTheme.typography.titleMedium,+ style = MaterialTheme.typography.titleSmall,color = Primary,modifier = Modifier.padding(vertical = 8.dp))@@ -363,26 +379,12 @@ fun SeriesScreen()) {item {- Surface(+ BrowseSearchLaunchCard(+ title = stringResource(R.string.series_search_launch_title),+ subtitle = stringResource(R.string.series_search_launch_subtitle),onClick = { onNavigate(Routes.SEARCH) },- modifier = Modifier- .fillMaxWidth()- .padding(vertical = LocalSpacing.current.md),- shape = ClickableSurfaceDefaults.shape(androidx.compose.foundation.shape.RoundedCornerShape(12.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = SurfaceElevated,- focusedContainerColor = Primary.copy(alpha = 0.2f)- )- ) {- Row(- modifier = Modifier.padding(16.dp),- verticalAlignment = Alignment.CenterVertically- ) {- Text("🔍", style = MaterialTheme.typography.titleMedium)- Spacer(Modifier.width(16.dp))- Text(stringResource(R.string.search_hint), color = OnSurfaceDim, style = MaterialTheme.typography.bodyLarge)- }- }+ modifier = Modifier.padding(vertical = LocalSpacing.current.md)+ )}if (heroSeries != null) {@@ -631,7 +633,7 @@ fun SeriesScreen(}LazyVerticalGrid(- columns = GridCells.Adaptive(minSize = 160.dp),+ columns = GridCells.Adaptive(minSize = 138.dp),modifier = Modifier.fillMaxSize().onPreviewKeyEvent { event ->@@ -647,9 +649,9 @@ fun SeriesScreen(} else false} else false},- contentPadding = PaddingValues(16.dp),- horizontalArrangement = Arrangement.spacedBy(16.dp),- verticalArrangement = Arrangement.spacedBy(16.dp)+ contentPadding = PaddingValues(12.dp),+ horizontalArrangement = Arrangement.spacedBy(12.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)) {item(span = { GridItemSpan(maxLineSpan) }) {Column(modifier = Modifier.padding(bottom = 16.dp)) {@@ -658,7 +660,7 @@ fun SeriesScreen(uiState.fullLibraryCategoryName -> stringResource(R.string.library_full_browse_title_series)else -> uiState.selectedCategory ?: ""},- style = MaterialTheme.typography.headlineSmall,+ style = MaterialTheme.typography.titleLarge,color = Primary,fontWeight = androidx.compose.ui.text.font.FontWeight.Bold)@@ -737,26 +739,15 @@ fun SeriesScreen(if (!uiState.isReorderMode && uiState.canLoadMoreSelectedCategory) {item(span = { GridItemSpan(maxLineSpan) }) {- Surface(- onClick = viewModel::loadMoreSelectedCategory,- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),- colors = ClickableSurfaceDefaults.colors(- containerColor = Color.White.copy(alpha = 0.06f),- focusedContainerColor = Primary+ LoadMoreCard(+ label = stringResource(+ R.string.library_load_more,+ uiState.selectedCategoryLoadedCount,+ uiState.selectedCategoryTotalCount),+ onClick = viewModel::loadMoreSelectedCategory,modifier = Modifier.padding(top = 8.dp, bottom = 24.dp)- ) {- Text(- text = stringResource(- R.string.library_load_more,- uiState.selectedCategoryLoadedCount,- uiState.selectedCategoryTotalCount- ),- style = MaterialTheme.typography.bodyMedium,- color = Color.White,- modifier = Modifier.padding(horizontal = 18.dp, vertical = 14.dp)- )- }+ )}}}@@ -830,83 +821,18 @@ fun SeriesHeroBanner(series: com.streamvault.domain.model.Series,onClick: () -> Unit) {- var isFocused by remember { mutableStateOf(false) }-- Surface(+ BrowseHeroPanel(+ title = series.name,+ subtitle = series.plot ?: stringResource(R.string.series_library_lens_subtitle),onClick = onClick,- modifier = Modifier- .fillMaxWidth()- .height(400.dp)- .padding(horizontal = 32.dp, vertical = 16.dp)- .onFocusChanged { isFocused = it.isFocused },- shape = ClickableSurfaceDefaults.shape(androidx.compose.foundation.shape.RoundedCornerShape(16.dp)),- border = ClickableSurfaceDefaults.border(- focusedBorder = androidx.tv.material3.Border(- border = BorderStroke(3.dp, Color.White),- shape = RoundedCornerShape(8.dp)- )- )- ) {- Box(modifier = Modifier.fillMaxSize()) {- AsyncImage(- model = series.posterUrl ?: series.backdropUrl,- contentDescription = null,- contentScale = ContentScale.Crop,- modifier = Modifier.fillMaxSize()- )-- // Gradient- Box(- modifier = Modifier- .fillMaxSize()- .background(- Brush.verticalGradient(- colors = listOf(Color.Transparent, Color.Black.copy(alpha = 0.9f)),- startY = 200f- )- )- )-- // Content- Column(- modifier = Modifier- .align(Alignment.BottomStart)- .padding(32.dp)- ) {- Text(- text = series.name,- style = MaterialTheme.typography.displayMedium,- color = Color.White,- maxLines = 1,- overflow = TextOverflow.Ellipsis- )- Spacer(Modifier.height(8.dp))- if (!series.plot.isNullOrEmpty()) {- Text(- text = series.plot!!,- style = MaterialTheme.typography.bodyLarge,- color = TextSecondary,- maxLines = 3,- overflow = TextOverflow.Ellipsis,- modifier = Modifier.fillMaxWidth(0.6f)- )- Spacer(Modifier.height(16.dp))- }-- // Play Button- Row(- verticalAlignment = Alignment.CenterVertically,- modifier = Modifier- .background(if (isFocused) Primary else Color.White, androidx.compose.foundation.shape.RoundedCornerShape(4.dp))- .padding(horizontal = 24.dp, vertical = 8.dp)- ) {- Text("▶", color = if (isFocused) Color.White else Color.Black)- Spacer(Modifier.width(8.dp))- Text(stringResource(R.string.player_resume).substringBefore(" "), color = if (isFocused) Color.White else Color.Black, style = MaterialTheme.typography.titleMedium) // "Play" fallback- }- }- }- }+ eyebrow = series.genre ?: series.categoryName,+ imageUrl = series.backdropUrl ?: series.posterUrl,+ metadata = listOfNotNull(+ series.releaseDate,+ series.rating.takeIf { it > 0f }?.let { "RTG ${String.format("%.1f", it)}" }+ ),+ actionLabel = stringResource(R.string.player_resume).substringBefore(" ")+ )}private enum class SeriesLibraryFacet {@@ -981,3 +907,4 @@ private fun seriesFreshnessScore(series: com.streamvault.domain.model.Series): L?.toLongOrNull()?: 0L}+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 35989654..89a9ac38 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,4 +1,4 @@-package com.streamvault.app.ui.screens.settings+package com.streamvault.app.ui.screens.settingsimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border@@ -21,7 +21,6 @@ import androidx.compose.ui.graphics.Colorimport androidx.compose.foundation.clickableimport androidx.compose.material3.Switchimport androidx.compose.material3.RadioButton-import androidx.compose.material3.AlertDialogimport androidx.compose.material3.TextButtonimport androidx.compose.material3.Buttonimport androidx.compose.material3.OutlinedButton@@ -30,8 +29,11 @@ import androidx.activity.compose.rememberLauncherForActivityResultimport androidx.activity.result.contract.ActivityResultContractsimport com.streamvault.app.ui.components.dialogs.PinDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialog+import com.streamvault.app.ui.components.dialogs.PremiumDialogFooterButtonimport com.streamvault.app.ui.components.TvEmptyState-import com.streamvault.app.ui.components.TopNavBar+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppScreenScaffoldimport com.streamvault.app.ui.theme.*import com.streamvault.domain.manager.BackupConflictStrategyimport com.streamvault.domain.model.Provider@@ -62,15 +64,8 @@ fun SettingsScreen(val snackbarHostState = remember { SnackbarHostState() }val scope = rememberCoroutineScope()val context = androidx.compose.ui.platform.LocalContext.current- val activeProvider = uiState.providers.firstOrNull { it.id == uiState.activeProviderId }val appLanguageLabel = remember(uiState.appLanguage, context) {- when (uiState.appLanguage) {- "ar" -> "العربية"- "he" -> "עברית"- "ru" -> "Русский"- "en" -> "English"- else -> context.getString(R.string.settings_system_default)- }+ displayLanguageLabel(uiState.appLanguage, context.getString(R.string.settings_system_default))}val protectionSummary = remember(uiState.parentalControlLevel, context) {when (uiState.parentalControlLevel) {@@ -110,38 +105,21 @@ fun SettingsScreen(}Box(modifier = Modifier.fillMaxSize()) {- Column(- modifier = Modifier.fillMaxSize()+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = { if (!uiState.isSyncing) onNavigate(it) },+ title = stringResource(R.string.settings_title),+ subtitle = stringResource(R.string.settings_providers_subtitle),+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = { if (!uiState.isSyncing) onNavigate(it) } // Block nav- )-LazyColumn(modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(32.dp),+ contentPadding = PaddingValues(start = 8.dp, end = 8.dp, bottom = 32.dp),verticalArrangement = Arrangement.spacedBy(16.dp),- userScrollEnabled = !uiState.isSyncing // Block scroll+ userScrollEnabled = !uiState.isSyncing) {- item {- Text(- text = stringResource(R.string.settings_title),- style = MaterialTheme.typography.headlineMedium,- color = Primary,- modifier = Modifier.padding(bottom = 8.dp)- )- }-- item {- SettingsOverviewCard(- activeProviderName = activeProvider?.name ?: stringResource(R.string.settings_overview_no_provider),- providerCount = uiState.providers.size,- protectionSummary = protectionSummary,- languageLabel = appLanguageLabel- )- }-// Providers sectionitem {SettingsSectionHeader(@@ -192,6 +170,7 @@ fun SettingsScreen(containerColor = Primary.copy(alpha = 0.15f),focusedContainerColor = Primary.copy(alpha = 0.3f)),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),modifier = Modifier.fillMaxWidth()) {Row(@@ -202,7 +181,7 @@ fun SettingsScreen(verticalAlignment = Alignment.CenterVertically) {Text(- text = "➕ " + stringResource(R.string.settings_add_provider),+ text = stringResource(R.string.settings_add_provider),style = MaterialTheme.typography.bodyLarge,color = Primary)@@ -219,6 +198,7 @@ fun SettingsScreen()ParentalControlCard(level = uiState.parentalControlLevel,+ hasActiveProvider = uiState.activeProviderId != null,onChangeLevel = {pendingAction = ParentalAction.ChangeLevelshowPinDialog = true@@ -226,6 +206,9 @@ fun SettingsScreen(onChangePin = {pendingAction = ParentalAction.ChangePinshowPinDialog = true+ },+ onManageProtectedGroups = {+ uiState.activeProviderId?.let(onNavigateToParentalControl)})}@@ -245,6 +228,7 @@ fun SettingsScreen(containerColor = SurfaceElevated,focusedContainerColor = Primary.copy(alpha = 0.2f)),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),modifier = Modifier.fillMaxWidth()) {Row(@@ -259,15 +243,8 @@ fun SettingsScreen(style = MaterialTheme.typography.bodyLarge,color = OnBackground)- val languageName = when (uiState.appLanguage) {- "ar" -> "العربية"- "he" -> "עברית"- "ru" -> "Русский"- "en" -> "English"- else -> stringResource(R.string.settings_system_default)- }Text(- text = languageName,+ text = appLanguageLabel,style = MaterialTheme.typography.bodyMedium,color = Primary)@@ -291,10 +268,11 @@ fun SettingsScreen(containerColor = SurfaceElevated,focusedContainerColor = Primary.copy(alpha = 0.2f)),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),modifier = Modifier.weight(1f)) {Text(- text = "💾 " + stringResource(R.string.settings_backup_data),+ text = stringResource(R.string.settings_backup_data),style = MaterialTheme.typography.bodyLarge,color = OnBackground,modifier = Modifier.padding(16.dp),@@ -309,10 +287,11 @@ fun SettingsScreen(containerColor = SurfaceElevated,focusedContainerColor = Primary.copy(alpha = 0.2f)),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),modifier = Modifier.weight(1f)) {Text(- text = "📂 " + stringResource(R.string.settings_restore_data),+ text = stringResource(R.string.settings_restore_data),style = MaterialTheme.typography.bodyLarge,color = OnBackground,modifier = Modifier.padding(16.dp),@@ -380,8 +359,7 @@ fun SettingsScreen(SettingsRow(label = stringResource(R.string.settings_developed_by), value = stringResource(R.string.settings_developer_name))}}- }-+ }SnackbarHost(hostState = snackbarHostState,@@ -412,10 +390,15 @@ fun SettingsScreen() {CircularProgressIndicator(color = Primary)Text(- text = stringResource(R.string.settings_syncing),- style = MaterialTheme.typography.bodyLarge,+ text = stringResource(R.string.settings_syncing_title),+ style = MaterialTheme.typography.titleMedium,color = OnSurface)+ Text(+ text = stringResource(R.string.settings_syncing_subtitle),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim+ )}}}@@ -627,8 +610,10 @@ private fun LevelOption(level: Int, text: String, currentLevel: Int, onSelect: (@Composableprivate fun ParentalControlCard(level: Int,+ hasActiveProvider: Boolean,onChangeLevel: () -> Unit,- onChangePin: () -> Unit+ onChangePin: () -> Unit,+ onManageProtectedGroups: () -> Unit) {Column(modifier = Modifier@@ -784,10 +769,21 @@ private fun ProviderSettingsCard()diagnostics?.let { model ->- ProviderDiagnosticsPanel(- provider = provider,- diagnostics = model+ Text(+ text = listOf(model.sourceLabel, model.connectionSummary, model.expirySummary)+ .filter { it.isNotBlank() }+ .joinToString(" • "),+ style = MaterialTheme.typography.bodySmall,+ color = OnSurface)+ Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {+ ProviderCompactStat(title = stringResource(R.string.settings_diagnostic_live), count = model.liveCount)+ ProviderCompactStat(title = stringResource(R.string.settings_diagnostic_movies), count = model.movieCount)+ if (provider.type == ProviderType.XTREAM_CODES) {+ ProviderCompactStat(title = stringResource(R.string.settings_diagnostic_series), count = model.seriesCount)+ }+ ProviderCompactStat(title = stringResource(R.string.settings_diagnostic_epg), count = model.epgCount)+ }}if (syncWarnings.isNotEmpty()) {@@ -860,7 +856,7 @@ private fun ProviderSettingsCard(}// Action buttons - each independently focusable for d-pad- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {if (!isActive) {Surface(onClick = onConnect,@@ -869,10 +865,11 @@ private fun ProviderSettingsCard(containerColor = Primary,focusedContainerColor = Primary.copy(alpha = 0.8f),contentColor = Color.White- )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)) {Text(- text = "⚡ " + stringResource(R.string.settings_connect),+ text = stringResource(R.string.settings_connect),style = MaterialTheme.typography.labelMedium,color = Color.White,modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)@@ -885,10 +882,11 @@ private fun ProviderSettingsCard(colors = ClickableSurfaceDefaults.colors(containerColor = Primary.copy(alpha = 0.2f),focusedContainerColor = Primary.copy(alpha = 0.5f)- )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)) {Text(- text = if (isSyncing) "⟳ " + stringResource(R.string.settings_syncing_btn) else "⟳ " + stringResource(R.string.settings_sync_btn),+ text = if (isSyncing) stringResource(R.string.settings_syncing_btn) else stringResource(R.string.settings_sync_btn),style = MaterialTheme.typography.labelMedium,color = Primary,modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)@@ -902,10 +900,11 @@ private fun ProviderSettingsCard(colors = ClickableSurfaceDefaults.colors(containerColor = Secondary.copy(alpha = 0.2f),focusedContainerColor = Secondary.copy(alpha = 0.5f)- )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)) {Text(- text = "✎ " + stringResource(R.string.settings_edit),+ text = stringResource(R.string.settings_edit),style = MaterialTheme.typography.labelMedium,color = Secondary,modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)@@ -918,10 +917,11 @@ private fun ProviderSettingsCard(colors = ClickableSurfaceDefaults.colors(containerColor = ErrorColor.copy(alpha = 0.2f),focusedContainerColor = ErrorColor.copy(alpha = 0.5f)- )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)) {Text(- text = "🗑 " + stringResource(R.string.settings_delete),+ text = stringResource(R.string.settings_delete),style = MaterialTheme.typography.labelMedium,color = ErrorColor,modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)@@ -935,10 +935,11 @@ private fun ProviderSettingsCard(colors = ClickableSurfaceDefaults.colors(containerColor = Primary.copy(alpha = 0.15f),focusedContainerColor = Primary.copy(alpha = 0.3f)- )+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f)) {Text(- text = "🛡️ " + stringResource(R.string.settings_pc_btn),+ text = stringResource(R.string.settings_parental_groups_action),style = MaterialTheme.typography.labelMedium,color = Primary,modifier = Modifier.padding(horizontal = 16.dp, vertical = 10.dp)@@ -946,6 +947,34 @@ private fun ProviderSettingsCard(}}}++ }+}++@Composable+private fun ProviderCompactStat(+ title: String,+ count: Int+) {+ Surface(+ shape = RoundedCornerShape(10.dp),+ colors = SurfaceDefaults.colors(containerColor = Color.White.copy(alpha = 0.06f))+ ) {+ Column(+ modifier = Modifier.padding(horizontal = 10.dp, vertical = 8.dp),+ verticalArrangement = Arrangement.spacedBy(2.dp)+ ) {+ Text(+ text = title,+ style = MaterialTheme.typography.labelSmall,+ color = OnSurfaceDim+ )+ Text(+ text = count.toString(),+ style = MaterialTheme.typography.labelMedium,+ color = OnBackground+ )+ }}}@@ -1044,7 +1073,7 @@ private fun ProviderDiagnosticsPanel(color = OnSurfaceDim)Text(- text = "${diagnostics.sourceLabel} • ${diagnostics.connectionSummary}",+ text = "${diagnostics.sourceLabel} | ${diagnostics.connectionSummary}",style = MaterialTheme.typography.bodySmall,color = OnSurface)@@ -1206,52 +1235,56 @@ private fun BackupImportPreviewDialog(onImportMultiViewChanged: (Boolean) -> Unit,onConfirm: () -> Unit) {- AlertDialog(+ PremiumDialog(+ title = stringResource(R.string.settings_backup_preview_title),+ subtitle = stringResource(R.string.settings_backup_preview_subtitle, preview.version),onDismissRequest = onDismiss,- title = { Text(stringResource(R.string.settings_backup_preview_title)) },- text = {- Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {- Text(- text = stringResource(R.string.settings_backup_preview_subtitle, preview.version),- style = MaterialTheme.typography.bodyMedium,- color = OnSurfaceDim- )- BackupPreviewRow(stringResource(R.string.settings_backup_section_preferences), preview.preferenceCount, 0)- BackupPreviewRow(stringResource(R.string.settings_backup_section_providers), preview.providerCount, preview.providerConflicts)- BackupPreviewRow(stringResource(R.string.settings_backup_section_saved), preview.favoriteCount + preview.groupCount, preview.favoriteConflicts + preview.groupConflicts)- BackupPreviewRow(stringResource(R.string.settings_backup_section_history), preview.playbackHistoryCount, preview.historyConflicts)- BackupPreviewRow(stringResource(R.string.settings_backup_section_multiview), preview.multiViewPresetCount, 0)- Text(- text = stringResource(R.string.settings_backup_conflict_strategy),- style = MaterialTheme.typography.titleSmall,- color = Primary+ widthFraction = 0.58f,+ content = {+ BackupPreviewRow(stringResource(R.string.settings_backup_section_preferences), preview.preferenceCount, 0)+ BackupPreviewRow(stringResource(R.string.settings_backup_section_providers), preview.providerCount, preview.providerConflicts)+ BackupPreviewRow(stringResource(R.string.settings_backup_section_saved), preview.favoriteCount + preview.groupCount, preview.favoriteConflicts + preview.groupConflicts)+ BackupPreviewRow(stringResource(R.string.settings_backup_section_history), preview.playbackHistoryCount, preview.historyConflicts)+ BackupPreviewRow(stringResource(R.string.settings_backup_section_multiview), preview.multiViewPresetCount, 0)+ Text(+ text = stringResource(R.string.settings_backup_conflict_strategy),+ style = MaterialTheme.typography.titleSmall,+ color = Primary+ )+ Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {+ BackupStrategyChip(+ title = stringResource(R.string.settings_backup_keep_existing),+ selected = plan.conflictStrategy == BackupConflictStrategy.KEEP_EXISTING,+ onClick = { onStrategySelected(BackupConflictStrategy.KEEP_EXISTING) })- Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {- BackupStrategyChip(- title = stringResource(R.string.settings_backup_keep_existing),- selected = plan.conflictStrategy == BackupConflictStrategy.KEEP_EXISTING,- onClick = { onStrategySelected(BackupConflictStrategy.KEEP_EXISTING) }- )- BackupStrategyChip(- title = stringResource(R.string.settings_backup_replace_existing),- selected = plan.conflictStrategy == BackupConflictStrategy.REPLACE_EXISTING,- onClick = { onStrategySelected(BackupConflictStrategy.REPLACE_EXISTING) }- )- }- Text(- text = stringResource(R.string.settings_backup_import_sections),- style = MaterialTheme.typography.titleSmall,- color = Primary+ BackupStrategyChip(+ title = stringResource(R.string.settings_backup_replace_existing),+ selected = plan.conflictStrategy == BackupConflictStrategy.REPLACE_EXISTING,+ onClick = { onStrategySelected(BackupConflictStrategy.REPLACE_EXISTING) })- BackupToggleRow(stringResource(R.string.settings_backup_section_preferences), plan.importPreferences, onImportPreferencesChanged)- BackupToggleRow(stringResource(R.string.settings_backup_section_providers), plan.importProviders, onImportProvidersChanged)- BackupToggleRow(stringResource(R.string.settings_backup_section_saved), plan.importSavedLibrary, onImportSavedLibraryChanged)- BackupToggleRow(stringResource(R.string.settings_backup_section_history), plan.importPlaybackHistory, onImportPlaybackHistoryChanged)- BackupToggleRow(stringResource(R.string.settings_backup_section_multiview), plan.importMultiViewPresets, onImportMultiViewChanged)}+ Text(+ text = stringResource(R.string.settings_backup_import_sections),+ style = MaterialTheme.typography.titleSmall,+ color = Primary+ )+ BackupToggleRow(stringResource(R.string.settings_backup_section_preferences), plan.importPreferences, onImportPreferencesChanged)+ BackupToggleRow(stringResource(R.string.settings_backup_section_providers), plan.importProviders, onImportProvidersChanged)+ BackupToggleRow(stringResource(R.string.settings_backup_section_saved), plan.importSavedLibrary, onImportSavedLibraryChanged)+ BackupToggleRow(stringResource(R.string.settings_backup_section_history), plan.importPlaybackHistory, onImportPlaybackHistoryChanged)+ BackupToggleRow(stringResource(R.string.settings_backup_section_multiview), plan.importMultiViewPresets, onImportMultiViewChanged)},- confirmButton = { Button(onClick = onConfirm) { Text(stringResource(R.string.settings_backup_import_confirm)) } },- dismissButton = { OutlinedButton(onClick = onDismiss) { Text(stringResource(R.string.settings_cancel)) } }+ footer = {+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_cancel),+ onClick = onDismiss+ )+ PremiumDialogFooterButton(+ label = stringResource(R.string.settings_backup_import_confirm),+ onClick = onConfirm,+ emphasized = true+ )+ })}@@ -1487,3 +1520,18 @@ private fun formatTimestamp(timestampMs: Long): String {if (timestampMs <= 0L) return "--:--"return java.text.SimpleDateFormat("MMM d, HH:mm", Locale.getDefault()).format(java.util.Date(timestampMs))}++private fun displayLanguageLabel(languageTag: String, defaultLabel: String): String {+ if (languageTag.isBlank()) return defaultLabel+ val locale = Locale.forLanguageTag(languageTag)+ if (locale.language.isBlank()) return defaultLabel+ return locale.getDisplayLanguage(Locale.getDefault())+ .replaceFirstChar { character ->+ if (character.isLowerCase()) {+ character.titlecase(Locale.getDefault())+ } else {+ character.toString()+ }+ }+}+diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.ktindex a1eb4a2b..fcfdf664 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupScreen.kt@@ -2,29 +2,48 @@ package com.streamvault.app.ui.screens.settings.parentalimport androidx.compose.foundation.backgroundimport androidx.compose.foundation.border-import androidx.compose.foundation.layout.*-import androidx.compose.foundation.clickable-import androidx.compose.ui.focus.onFocusChanged+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.widthimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.items-import androidx.compose.material.icons.Icons-import androidx.compose.material.icons.automirrored.filled.ArrowBack-import androidx.compose.material.icons.filled.Search-import androidx.tv.material3.*-import androidx.compose.ui.res.stringResource-import com.streamvault.app.R-import androidx.compose.runtime.*+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.focus.onFocusChangedimport androidx.compose.ui.graphics.Color+import androidx.compose.ui.res.stringResourceimport androidx.compose.ui.text.style.TextOverflowimport androidx.compose.ui.unit.dpimport androidx.hilt.navigation.compose.hiltViewModel-import com.streamvault.app.ui.components.TopNavBar+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.automirrored.filled.ArrowBack+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.tv.material3.ClickableSurfaceDefaults+import androidx.tv.material3.Icon+import androidx.tv.material3.IconButton+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.Text+import com.streamvault.app.R+import com.streamvault.app.ui.components.SearchInput+import com.streamvault.app.ui.components.shell.AppNavigationChrome+import com.streamvault.app.ui.components.shell.AppScreenScaffoldimport com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.ContentType-import androidx.compose.ui.focus.focusRequester-import androidx.compose.ui.focus.FocusRequester@Composablefun ParentalControlGroupScreen(@@ -35,98 +54,47 @@ fun ParentalControlGroupScreen() {val uiState by viewModel.uiState.collectAsState()val backButtonFocusRequester = remember { FocusRequester() }+ val searchFocusRequester = remember { FocusRequester() }+ val focusManager = androidx.compose.ui.platform.LocalFocusManager.currentLaunchedEffect(Unit) {backButtonFocusRequester.requestFocus()}- Column(- modifier = Modifier- .fillMaxSize()- .background(MaterialTheme.colorScheme.background)- ) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = onNavigate- )-- Row(- modifier = Modifier- .fillMaxWidth()- .padding(horizontal = 32.dp, vertical = 16.dp),- verticalAlignment = Alignment.CenterVertically- ) {- IconButton(- onClick = onBack,- modifier = Modifier.focusRequester(backButtonFocusRequester)+ AppScreenScaffold(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ title = stringResource(R.string.parental_group_title),+ subtitle = stringResource(R.string.parental_group_shell_subtitle),+ navigationChrome = AppNavigationChrome.TopBar,+ compactHeader = true,+ showScreenHeader = false,+ header = {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(16.dp),+ verticalAlignment = Alignment.CenterVertically) {- Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.parental_group_back))- }- Text(- text = "🛡️ " + stringResource(R.string.parental_group_title),- style = MaterialTheme.typography.headlineSmall,- color = MaterialTheme.colorScheme.primary,- modifier = Modifier.padding(start = 16.dp)- )- }-- // Search Bar- // Search Bar with Click-to-Focus (No layout jump)- val focusManager = androidx.compose.ui.platform.LocalFocusManager.current- var isSearchActive by remember { mutableStateOf(false) }- val searchFocusRequester = remember { FocusRequester() }-- Box(- modifier = Modifier- .fillMaxWidth()- .padding(16.dp)- ) {- androidx.compose.material3.OutlinedTextField(- value = uiState.searchQuery,- onValueChange = { viewModel.onSearchQueryChange(it) },- modifier = Modifier- .fillMaxWidth()- .focusRequester(searchFocusRequester)- .onFocusChanged {- if (!it.isFocused && isSearchActive) {- // Optional: if focus lost via other means- }- },- placeholder = { Text(stringResource(R.string.parental_group_search), color = MaterialTheme.colorScheme.onSurfaceVariant) },- leadingIcon = { Icon(Icons.Default.Search, contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant) },- singleLine = true,- keyboardActions = androidx.compose.foundation.text.KeyboardActions(- onDone = {- focusManager.clearFocus()- isSearchActive = false- }- ),- colors = androidx.compose.material3.OutlinedTextFieldDefaults.colors(- focusedTextColor = MaterialTheme.colorScheme.onSurface,- unfocusedTextColor = MaterialTheme.colorScheme.onSurface,- cursorColor = MaterialTheme.colorScheme.primary,- focusedBorderColor = MaterialTheme.colorScheme.primary,- unfocusedBorderColor = MaterialTheme.colorScheme.onSurfaceVariant- )- )-- // Overlay to intercept clicks when inactive- if (!isSearchActive) {- Box(- modifier = Modifier- .matchParentSize()- .clickable(- interactionSource = remember { androidx.compose.foundation.interaction.MutableInteractionSource() },- indication = null, // No ripple on overlay, or use ripple if desired- onClick = {- isSearchActive = true- searchFocusRequester.requestFocus()- }- )+ IconButton(+ onClick = onBack,+ modifier = Modifier.focusRequester(backButtonFocusRequester)+ ) {+ Icon(+ imageVector = Icons.AutoMirrored.Filled.ArrowBack,+ contentDescription = stringResource(R.string.parental_group_back)+ )+ }+ SearchInput(+ value = uiState.searchQuery,+ onValueChange = viewModel::onSearchQueryChange,+ placeholder = stringResource(R.string.parental_group_search),+ onSearch = { focusManager.clearFocus() },+ focusRequester = searchFocusRequester,+ modifier = Modifier.width(420.dp))}}-+ ) {if (uiState.isLoading) {Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {androidx.compose.material3.CircularProgressIndicator(color = MaterialTheme.colorScheme.primary)@@ -134,7 +102,7 @@ fun ParentalControlGroupScreen(} else {LazyColumn(modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(16.dp),+ contentPadding = PaddingValues(bottom = 16.dp),verticalArrangement = Arrangement.spacedBy(8.dp)) {items(uiState.categories, key = { "${it.type.name}:${it.id}" }) { category ->@@ -154,27 +122,25 @@ fun CategoryProtectionCard(onToggle: () -> Unit) {var isFocused by remember { mutableStateOf(false) }-- // Optimistic state for smooth animation- // We initialize with the category state, but update immediately on user interaction- var isChecked by remember(category.isUserProtected, category.isAdult) {- mutableStateOf(category.isUserProtected || category.isAdult)+ var isChecked by remember(category.isUserProtected, category.isAdult) {+ mutableStateOf(category.isUserProtected || category.isAdult)}-+val borderColor = if (isFocused) MaterialTheme.colorScheme.primary else Color.Transparentval borderWidth = if (isFocused) 2.dp else 0.dp+Surface(- onClick = {+ onClick = {if (!category.isAdult) {- isChecked = !isChecked // Optimistic update- onToggle()+ isChecked = !isChecked+ onToggle()}},modifier = Modifier.fillMaxWidth().onFocusChanged { isFocused = it.isFocused }.border(borderWidth, borderColor, MaterialTheme.shapes.medium),- scale = ClickableSurfaceDefaults.scale(focusedScale = 1.02f),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),shape = ClickableSurfaceDefaults.shape(MaterialTheme.shapes.medium),colors = ClickableSurfaceDefaults.colors(containerColor = MaterialTheme.colorScheme.surfaceVariant,@@ -191,7 +157,7 @@ fun CategoryProtectionCard(verticalAlignment = Alignment.CenterVertically,horizontalArrangement = Arrangement.SpaceBetween) {- Column(+ androidx.compose.foundation.layout.Column(modifier = Modifier.weight(1f).padding(end = 16.dp)@@ -222,19 +188,8 @@ fun CategoryProtectionCard(androidx.compose.material3.Switch(checked = isChecked,- onCheckedChange = {- if (!category.isAdult) {- isChecked = it // Optimistic update- onToggle()- }- },- enabled = !category.isAdult,- colors = androidx.compose.material3.SwitchDefaults.colors(- checkedThumbColor = MaterialTheme.colorScheme.primary,- checkedTrackColor = MaterialTheme.colorScheme.primaryContainer,- uncheckedThumbColor = MaterialTheme.colorScheme.onSurfaceVariant,- uncheckedTrackColor = MaterialTheme.colorScheme.surfaceVariant- )+ onCheckedChange = null,+ enabled = !category.isAdult)}}@@ -242,21 +197,20 @@ fun CategoryProtectionCard(@Composableprivate fun TypeBadge(type: ContentType) {- val label = when (type) {- ContentType.LIVE -> "Live"- ContentType.MOVIE -> "Movies"- ContentType.SERIES -> "Series"- ContentType.SERIES_EPISODE -> "Episodes"+ val (label, background, contentColor) = when (type) {+ ContentType.LIVE -> Triple("LIVE", MaterialTheme.colorScheme.primary, MaterialTheme.colorScheme.onPrimary)+ ContentType.MOVIE -> Triple("MOVIE", MaterialTheme.colorScheme.secondary, MaterialTheme.colorScheme.onSecondary)+ ContentType.SERIES,+ ContentType.SERIES_EPISODE -> Triple("SERIES", MaterialTheme.colorScheme.tertiary, MaterialTheme.colorScheme.onTertiary)}- Surface(- shape = MaterialTheme.shapes.small,- colors = SurfaceDefaults.colors(- containerColor = MaterialTheme.colorScheme.primaryContainer,- contentColor = MaterialTheme.colorScheme.onPrimaryContainer- )++ Box(+ modifier = Modifier+ .background(background, RoundedCornerShape(8.dp))) {Text(text = label,+ color = contentColor,style = MaterialTheme.typography.labelSmall,modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp))diff --git a/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.ktindex 4dbe854e..4b4b69a3 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/welcome/WelcomeScreen.kt@@ -1,38 +1,50 @@package com.streamvault.app.ui.screens.welcome-import androidx.compose.foundation.Imageimport androidx.compose.foundation.background-import androidx.compose.foundation.layout.*-import androidx.compose.material3.*-import androidx.compose.runtime.*+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValueimport androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.graphics.Brushimport androidx.compose.ui.graphics.Color-import androidx.compose.ui.layout.ContentScale-import androidx.compose.ui.res.painterResourceimport androidx.compose.ui.res.stringResource-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp-import androidx.compose.ui.unit.spimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScope+import androidx.compose.material3.CircularProgressIndicator+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Textimport com.streamvault.app.R+import com.streamvault.app.ui.components.shell.StatusPill+import com.streamvault.app.ui.design.AppColorsimport com.streamvault.domain.repository.ProviderRepositoryimport dagger.hilt.android.lifecycle.HiltViewModel-import kotlinx.coroutines.flow.*-import kotlinx.coroutines.launchimport javax.inject.Inject+import kotlinx.coroutines.flow.MutableStateFlow+import kotlinx.coroutines.flow.StateFlow+import kotlinx.coroutines.flow.asStateFlow+import kotlinx.coroutines.flow.map+import kotlinx.coroutines.launch@HiltViewModelclass WelcomeViewModel @Inject constructor(private val providerRepository: ProviderRepository) : ViewModel() {- private val _hasProviders = MutableStateFlow(false)- val hasProviders: StateFlow<Boolean> = _hasProviders.asStateFlow()+ private val _hasProviders = MutableStateFlow<Boolean?>(null)+ val hasProviders: StateFlow<Boolean?> = _hasProviders.asStateFlow()init {viewModelScope.launch {@@ -52,92 +64,58 @@ fun WelcomeScreen(val hasProviders by viewModel.hasProviders.collectAsState()LaunchedEffect(hasProviders) {- if (hasProviders) {- onNavigateToHome()+ when (hasProviders) {+ true -> onNavigateToHome()+ false -> onNavigateToSetup()+ null -> Unit}}- Box(- modifier = Modifier.fillMaxSize()- ) {- // Background Image- Image(- painter = painterResource(id = R.drawable.welcome_bg),- contentDescription = null,- modifier = Modifier.fillMaxSize(),- contentScale = ContentScale.Crop- )-- // Gradient Overlay+ Box(modifier = Modifier.fillMaxSize()) {Box(modifier = Modifier.fillMaxSize().background(Brush.verticalGradient(colors = listOf(- Color.Black.copy(alpha = 0.3f),- Color.Black.copy(alpha = 0.8f)+ Color.Black.copy(alpha = 0.22f),+ AppColors.HeroTop,+ AppColors.HeroBottom))))- // Content - Align to bottom as background has text- Column(+ Surface(modifier = Modifier- .align(Alignment.BottomCenter)- .padding(bottom = 64.dp, start = 32.dp, end = 32.dp),- horizontalAlignment = Alignment.CenterHorizontally,- verticalArrangement = Arrangement.spacedBy(16.dp)+ .align(Alignment.Center)+ .padding(32.dp),+ shape = RoundedCornerShape(28.dp),+ colors = SurfaceDefaults.colors(containerColor = AppColors.Surface.copy(alpha = 0.9f))) {- if (hasProviders) {- Button(- onClick = onNavigateToHome,- modifier = Modifier- .width(200.dp)- .height(56.dp),- colors = ButtonDefaults.buttonColors(- containerColor = MaterialTheme.colorScheme.primary- )- ) {- Text(stringResource(id = R.string.welcome_enter_app), fontSize = 18.sp)- }-- OutlinedButton(- onClick = onNavigateToSetup,- modifier = Modifier- .width(200.dp)- .height(56.dp),- colors = ButtonDefaults.outlinedButtonColors(- contentColor = Color.White- ),- border = androidx.compose.foundation.BorderStroke(1.dp, Color.White.copy(alpha = 0.5f))- ) {- Text(stringResource(id = R.string.welcome_manage_providers))- }- } else {- Button(- onClick = onNavigateToSetup,- modifier = Modifier- .width(240.dp)- .height(56.dp),- colors = ButtonDefaults.buttonColors(- containerColor = MaterialTheme.colorScheme.primary- )- ) {- Text(stringResource(id = R.string.welcome_setup_provider), fontSize = 18.sp)- }+ Column(+ modifier = Modifier.padding(horizontal = 36.dp, vertical = 28.dp),+ horizontalAlignment = Alignment.CenterHorizontally+ ) {+ StatusPill(+ label = stringResource(R.string.app_name),+ containerColor = AppColors.BrandMuted+ )+ Spacer(modifier = Modifier.height(18.dp))+ CircularProgressIndicator(color = AppColors.Brand)+ Spacer(modifier = Modifier.height(18.dp))+ Text(+ text = stringResource(R.string.welcome_loading_title),+ style = MaterialTheme.typography.titleLarge,+ color = AppColors.TextPrimary+ )+ Spacer(modifier = Modifier.height(6.dp))+ Text(+ text = stringResource(R.string.welcome_loading_subtitle),+ style = MaterialTheme.typography.bodyLarge,+ color = AppColors.TextSecondary+ )}}-- // Version info at bottom- Text(- text = stringResource(id = R.string.welcome_version),- style = MaterialTheme.typography.labelMedium,- color = Color.White.copy(alpha = 0.3f),- modifier = Modifier- .align(Alignment.BottomCenter)- .padding(bottom = 24.dp)- )}}diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Color.kt b/app/src/main/java/com/streamvault/app/ui/theme/Color.ktindex 7e2292ec..ef2af9d2 100644--- a/app/src/main/java/com/streamvault/app/ui/theme/Color.kt+++ b/app/src/main/java/com/streamvault/app/ui/theme/Color.kt@@ -1,49 +1,47 @@package com.streamvault.app.ui.themeimport androidx.compose.ui.graphics.Color+import com.streamvault.app.ui.design.AppColors-// Broadcast-inspired premium palette with strong TV contrast.-val Primary = Color(0xFF3E8BFF)-val PrimaryLight = Color(0xFF74ABFF)+val Primary = AppColors.Brand+val PrimaryLight = AppColors.BrandStrongval PrimaryVariant = PrimaryLight-val PrimaryDark = Color(0xFF1F5EB6)-val PrimaryGlow = Color(0x403E8BFF)--val BackgroundDeep = Color(0xFF050A12)-val Background = Color(0xFF09101A)-val Surface = Color(0xFF111A27)-val SurfaceElevated = Color(0xFF172233)-val SurfaceHighlight = Color(0xFF263346)+val PrimaryDark = Color(0xFF356CB7)+val PrimaryGlow = AppColors.BrandMuted++val BackgroundDeep = AppColors.Canvas+val Background = AppColors.CanvasElevated+val Surface = AppColors.Surface+val SurfaceElevated = AppColors.SurfaceElevated+val SurfaceHighlight = AppColors.SurfaceEmphasisval SurfaceVariant = SurfaceElevated-val TextPrimary = Color(0xFFF4F8FF)-val TextSecondary = Color(0xFFB7C2D4)-val TextTertiary = Color(0xFF8693A8)-val TextDisabled = Color(0xFF5A6678)+val TextPrimary = AppColors.TextPrimary+val TextSecondary = AppColors.TextSecondary+val TextTertiary = AppColors.TextTertiary+val TextDisabled = AppColors.TextDisabled-// Legacy aliases kept for compatibility.val OnBackground = TextPrimaryval OnSurface = TextSecondaryval OnSurfaceVariant = TextSecondaryval OnSurfaceDim = TextTertiary-val AccentRed = Color(0xFFFF4D5D)-val AccentGreen = Color(0xFF43C98D)-val AccentAmber = Color(0xFFFFBE55)-val AccentCyan = Color(0xFF4FC8FF)+val AccentRed = AppColors.Live+val AccentGreen = AppColors.Success+val AccentAmber = AppColors.Warning+val AccentCyan = AppColors.Info-// Legacy aliases.val OnPrimary = Color(0xFFFFFFFF)-val Secondary = Color(0xFF63E2C9)+val Secondary = AppColors.Successval ErrorColor = AccentRedval SuccessColor = AccentGreenval LiveIndicator = AccentRedval WarningColor = AccentAmber-val GradientOverlayTop = Color(0x99050A12)-val GradientOverlayBottom = Color(0xE6050A12)+val GradientOverlayTop = AppColors.HeroTop+val GradientOverlayBottom = AppColors.HeroBottom-val FocusBorder = Color(0xFFE9F2FF)+val FocusBorder = AppColors.Focusval CardBackground = Surfaceval ProgressBar = Primary-val ProgressBarBackground = Color(0xFF233145)+val ProgressBarBackground = AppColors.SurfaceAccentdiff --git a/app/src/main/java/com/streamvault/app/ui/theme/Spacing.kt b/app/src/main/java/com/streamvault/app/ui/theme/Spacing.ktindex 54af9de5..6cb127e1 100644--- a/app/src/main/java/com/streamvault/app/ui/theme/Spacing.kt+++ b/app/src/main/java/com/streamvault/app/ui/theme/Spacing.kt@@ -1,23 +1,34 @@package com.streamvault.app.ui.theme-import androidx.compose.runtime.Composable-import androidx.compose.runtime.CompositionLocalProviderimport androidx.compose.runtime.staticCompositionLocalOfimport androidx.compose.ui.unit.Dp-import androidx.compose.ui.unit.dp+import com.streamvault.app.ui.design.AppSpacingdata class Spacing(- val xs: Dp = 8.dp,- val sm: Dp = 16.dp,- val md: Dp = 24.dp,- val lg: Dp = 32.dp,- val xl: Dp = 48.dp,- val xxl: Dp = 64.dp,-- // TV Overscan Safe Area- val safeTop: Dp = 32.dp,- val safeBottom: Dp = 32.dp,- val safeHoriz: Dp = 48.dp+ val xs: Dp,+ val sm: Dp,+ val md: Dp,+ val lg: Dp,+ val xl: Dp,+ val xxl: Dp,+ val safeTop: Dp,+ val safeBottom: Dp,+ val safeHoriz: Dp)-val LocalSpacing = staticCompositionLocalOf { Spacing() }+val LocalSpacing = staticCompositionLocalOf { defaultSpacing() }++fun defaultSpacing(): Spacing {+ val spacing = AppSpacing()+ return Spacing(+ xs = spacing.xs,+ sm = spacing.md,+ md = spacing.lg,+ lg = spacing.xl,+ xl = spacing.screenGutter,+ xxl = spacing.screenGutter + spacing.md,+ safeTop = spacing.safeTop,+ safeBottom = spacing.safeBottom,+ safeHoriz = spacing.screenGutter+ )+}diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt b/app/src/main/java/com/streamvault/app/ui/theme/Theme.ktindex 6d9842a1..e95e01ce 100644--- a/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt+++ b/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt@@ -4,6 +4,9 @@ import androidx.compose.runtime.Composableimport androidx.compose.runtime.CompositionLocalProviderimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.darkColorScheme+import com.streamvault.app.ui.design.AppShapes+import com.streamvault.app.ui.design.LocalAppShapes+import com.streamvault.app.ui.design.LocalAppSpacingprivate val DarkColorScheme = darkColorScheme(primary = Primary,@@ -19,7 +22,9 @@ private val DarkColorScheme = darkColorScheme(@Composablefun StreamVaultTheme(content: @Composable () -> Unit) {CompositionLocalProvider(- LocalSpacing provides Spacing()+ LocalSpacing provides defaultSpacing(),+ LocalAppSpacing provides com.streamvault.app.ui.design.AppSpacing(),+ LocalAppShapes provides AppShapes()) {MaterialTheme(colorScheme = DarkColorScheme,diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Type.kt b/app/src/main/java/com/streamvault/app/ui/theme/Type.ktindex c51e6e07..8df9ff14 100644--- a/app/src/main/java/com/streamvault/app/ui/theme/Type.kt+++ b/app/src/main/java/com/streamvault/app/ui/theme/Type.kt@@ -1,33 +1,8 @@package com.streamvault.app.ui.theme-import androidx.compose.ui.text.TextStyle-import androidx.compose.ui.text.font.Font-import androidx.compose.ui.text.font.FontFamily-import androidx.compose.ui.text.font.FontWeight-import androidx.compose.ui.unit.spimport androidx.tv.material3.Typography-import com.streamvault.app.R+import com.streamvault.app.ui.design.AppTypography+import com.streamvault.app.ui.design.InterFamily-val Inter = FontFamily(- Font(R.font.inter_regular, FontWeight.Normal),- Font(R.font.inter_medium, FontWeight.Medium),- Font(R.font.inter_semibold, FontWeight.SemiBold),- Font(R.font.inter_bold, FontWeight.Bold)-)--// ── 10-Foot UI TV Typography System ──────────────────────────────────-// Rules: No text smaller than 14sp (Label Large).-val StreamVaultTypography = Typography(- displayLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Bold, fontSize = 48.sp, lineHeight = 56.sp),- headlineLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Bold, fontSize = 32.sp, lineHeight = 40.sp),- headlineMedium= TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 28.sp, lineHeight = 36.sp),- titleLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 22.sp, lineHeight = 30.sp),- titleMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 18.sp, lineHeight = 26.sp),- titleSmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 16.sp, lineHeight = 24.sp),- bodyLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 18.sp, lineHeight = 26.sp),- bodyMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 16.sp, lineHeight = 24.sp),- bodySmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 14.sp, lineHeight = 20.sp),- labelLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 16.sp, lineHeight = 24.sp),- labelMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 14.sp, lineHeight = 20.sp),- labelSmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 14.sp, lineHeight = 20.sp), // Overridden to prevent tiny TV text-)+val Inter = InterFamily+val StreamVaultTypography: Typography = AppTypographydiff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 66ae16c8..7ebeb399 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -7,7 +7,7 @@<string name="nav_live_tv">Live TV</string><string name="nav_movies">Movies</string><string name="nav_series">Series</string>- <string name="nav_epg">TV Guide</string>+ <string name="nav_epg">Guide</string><string name="nav_settings">Settings</string><!-- Welcome -->@@ -15,6 +15,14 @@<string name="welcome_manage_providers">Manage Providers</string><string name="welcome_setup_provider">Setup Provider</string><string name="welcome_version">v1.0.0</string>+ <string name="welcome_loading_title">Preparing your library</string>+ <string name="welcome_loading_subtitle">Opening the right screen for this device.</string>+ <string name="welcome_tagline">Premium IPTV for the living room</string>+ <string name="welcome_subtitle">Lean back into live channels, catch-up viewing, movies, and series with a first-party Android TV experience.</string>+ <string name="welcome_feature_live">Fast live browsing with remote-first focus</string>+ <string name="welcome_feature_library">Large-library movies and series without the clutter</string>+ <string name="welcome_feature_player">Unified player overlays, guide access, and saved content</string>+ <string name="welcome_manage_hint">Swap providers, refresh metadata, or add a new source.</string><!-- Home --><string name="home_incorrect_pin">Incorrect PIN</string>@@ -30,8 +38,21 @@<string name="home_search_channels">Search channels...</string><string name="home_loading">Loading...</string><string name="home_no_channels_found">No channels found in this category</string>+ <string name="home_no_channels_found_subtitle">Try another category or search term.</string><string name="home_add_favorites_hint">Add channels to favorites to see them here</string><string name="home_recent_channels_hint">Watch a few live channels to build a recent list here</string>+ <string name="home_locked_short">LOCKED</string>+ <string name="live_shell_subtitle">Scan live categories quickly, keep navigation deterministic, and surface only the schedule data that matters on screen.</string>+ <string name="live_shell_context">%1$d categories • %2$d channels</string>+ <string name="live_shell_provider">Provider</string>+ <string name="live_shell_last_group">Last group</string>+ <string name="live_shell_split">Multiview</string>+ <string name="live_manage_groups">Manage multiview slots</string>+ <string name="live_channel_results">%1$d channels in view</string>+ <string name="live_reorder_title">Reordering %1$s</string>+ <string name="live_reorder_subtitle">D-pad moves the selected channel. Save the order when you are done.</string>+ <string name="live_empty_hint_favorites">Add channels to Favorites or a saved group to populate this rail.</string>+ <string name="live_empty_hint_recent">Start playback on a few channels and they will appear here.</string><string name="home_saved_subtitle">Favorites and custom live groups</string><string name="home_saved_empty_hint">Favorite a channel or add it to a custom live group to pin it here.</string><string name="home_delete_group_title">Delete Group?</string>@@ -54,7 +75,7 @@<string name="dashboard_recent_series">Recently Updated Series</string><string name="dashboard_search_library">Search Library</string><string name="dashboard_live_shortcuts">Live Shortcuts</string>- <string name="dashboard_live_shortcuts_subtitle">Return to saved groups, recent channels, and your last live context.</string>+ <string name="dashboard_live_shortcuts_subtitle">Favorites, recent channels, and last group.</string><string name="dashboard_provider_health_title">Provider Health</string><string name="dashboard_provider_status">Status</string><string name="dashboard_provider_source">Source</string>@@ -119,9 +140,13 @@<string name="movies_incorrect_pin">Incorrect PIN</string><string name="movies_loading">Loading movies...</string><string name="movies_no_found">No movies found</string>+ <string name="movies_no_found_subtitle">Try a different category or return to the full library shelves to surface more titles.</string><string name="movies_categories_title">Categories</string>+ <string name="movies_shell_subtitle">Curated shelves, saved groups, and full-library browsing without leaving the current provider context.</string><string name="movies_all_categories">All Categories</string><string name="movies_search_placeholder">Search movies...</string>+ <string name="movies_search_launch_title">Search the movie library</string>+ <string name="movies_search_launch_subtitle">Jump into the dedicated search surface without losing your current browse state.</string><string name="movies_group_created">Created group %1$s</string><string name="movies_group_renamed">Renamed group to %1$s</string><string name="movies_group_deleted">Deleted group %1$s</string>@@ -131,6 +156,8 @@<string name="movies_saved_empty_hint">Favorite a movie or add it to a custom group to see it here.</string><string name="movies_filter_subtitle">Refine the selected movie category without rebuilding the whole library.</string><string name="movies_library_lens_subtitle">Surface favorites, in-progress, top-rated, and fresh movies across the whole library.</string>+ <string name="movies_reorder_title">Reordering %1$s</string>+ <string name="movies_reorder_subtitle">Use the remote to move posters, then save the shelf order for this group.</string><string name="library_full_browse_title_movies">Browse Full Movie Library</string><string name="library_full_browse_subtitle">%1$d titles available in the current provider</string>@@ -138,9 +165,13 @@<string name="series_incorrect_pin">Incorrect PIN</string><string name="series_loading">Loading series...</string><string name="series_no_found">No series found</string>+ <string name="series_no_found_subtitle">Try another category or return to the full library to surface more series shelves.</string><string name="series_categories_title">Categories</string>+ <string name="series_shell_subtitle">Editorial shelves, saved groups, and paged series browsing tuned for large provider libraries.</string><string name="series_all_categories">All Categories</string><string name="series_search_placeholder">Search series...</string>+ <string name="series_search_launch_title">Search the series library</string>+ <string name="series_search_launch_subtitle">Open the command search view to find titles, episodes, or saved groups faster.</string><string name="series_group_created">Created group %1$s</string><string name="series_group_renamed">Renamed group to %1$s</string><string name="series_group_deleted">Deleted group %1$s</string>@@ -150,6 +181,8 @@<string name="series_saved_empty_hint">Favorite a series or add it to a custom group to see it here.</string><string name="series_filter_subtitle">Pivot between saved, in-progress, updated, and highly rated series.</string><string name="series_library_lens_subtitle">Surface favorites, in-progress, top-rated, and fresh series across the whole library.</string>+ <string name="series_reorder_title">Reordering %1$s</string>+ <string name="series_reorder_subtitle">Use the remote to move posters, then save the shelf order for this group.</string><string name="library_full_browse_title_series">Browse Full Series Library</string><string name="library_saved_title">Saved</string>@@ -187,6 +220,9 @@<string name="settings_providers_subtitle">Switch, sync, edit, and troubleshoot your IPTV sources.</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>+ <string name="settings_parental_groups_hint">Lock or unlock categories for the active provider.</string>+ <string name="settings_parental_groups_action">Manage</string><string name="settings_playback">Playback</string><string name="settings_playback_subtitle">Tune decoder and buffering behavior for smoother playback.</string><string name="settings_decoder_mode">Decoder Mode</string>@@ -201,6 +237,8 @@<string name="settings_developed_by">Developed by</string><string name="settings_developer_name">David Nashash</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><string name="settings_enter_new_pin">Enter New PIN</string><string name="settings_enter_pin">Enter PIN</string><string name="settings_select_level">Select Protection Level</string>@@ -298,7 +336,7 @@<string name="settings_recording_cancel">Cancel</string><!-- Favorites -->- <string name="favorites_title">Saved Library</string>+ <string name="favorites_title">Saved</string><string name="favorites_loading">Loading saved library...</string><string name="favorites_no_favorites">Saved library is empty</string><string name="favorites_empty_hint">Long-press on any channel, movie, or series to build your saved library</string>@@ -349,6 +387,8 @@<string name="favorites_sort_title_hint">Alphabetical browsing across sections</string><string name="favorites_jump_title">Jump to a section</string><string name="favorites_jump_subtitle">Shortcut directly to the saved group or system section you need.</string>+ <string name="saved_shell_subtitle">Pinned favorites, custom groups, and recent progress in one premium hub.</string>+ <string name="guide_shell_subtitle">Guide filters, schedule density, and focused program detail in one remote-first surface.</string><string name="favorites_reordering">Reordering</string><string name="favorites_reorder_mode">Reorder mode</string><string name="favorites_move_up">Up or Left: move earlier</string>@@ -358,6 +398,10 @@<!-- Search --><string name="search_title">Search</string>+ <string name="parental_group_shell_subtitle">Review protected live, movie, and series groups without leaving the premium settings shell.</string>+ <string name="search_screen_subtitle">Find channels, movies, and series without leaving the TV flow.</string>+ <string name="search_command_title">Command Search</string>+ <string name="search_command_subtitle">Start with a title, keyword, channel name, or series. Results stay grouped for fast remote navigation.</string><string name="search_incorrect_pin">Incorrect PIN</string><string name="search_type_to_search">Type to search...</string><string name="search_no_results">No results found for \'%1$s\'</string>@@ -377,9 +421,20 @@<!-- Provider Setup --><string name="setup_title_streamvault">StreamVault</string>+ <string name="setup_provider_title">Add a provider</string><string name="setup_edit_provider">Edit Provider</string><string name="setup_update_desc">Update your IPTV provider details</string><string name="setup_add_desc">Add your IPTV provider</string>+ <string name="setup_shell_eyebrow">Provider Onboarding</string>+ <string name="setup_shell_subtitle">Use Xtream or M3U. You can change it later.</string>+ <string name="setup_form_subtitle">Choose a source, enter the details, and continue. You can manage it later from Settings.</string>+ <string name="setup_source_type_label">Source Type</string>+ <string name="setup_info_xtream_title">Use Xtream when credentials are available</string>+ <string name="setup_info_xtream_body">Best when you have server, user, and password.</string>+ <string name="setup_info_m3u_title">Use M3U for URL or file-based playlists</string>+ <string name="setup_info_m3u_body">Use a playlist link or import a local file.</string>+ <string name="setup_info_manage_title">You can manage providers later</string>+ <string name="setup_info_manage_body">Refresh, edit, or replace it later from Settings.</string><string name="setup_xtream">Xtream Codes</string><string name="setup_m3u">M3U Playlist</string><string name="setup_name_hint">Playlist Name (Optional)</string>@@ -392,6 +447,7 @@<string name="setup_m3u_hint">M3U URL</string><string name="setup_tab_url">URL</string><string name="setup_tab_file">File</string>+ <string name="setup_choose_file">Choose M3U File</string><string name="setup_file_replace_hint">Press to replace file</string><string name="setup_file_select_title">Select M3U File</string><string name="setup_file_browse_hint">Browse local storage or USB</string>@@ -420,6 +476,12 @@<string name="player_close">Close</string><string name="player_play">Play</string><string name="player_pause">Pause</string>+ <string name="player_playback_label">Playback</string>+ <string name="player_more_controls">More controls</string>+ <string name="player_live_now">Now Playing</string>+ <string name="player_live_channel">Channel %1$d</string>+ <string name="player_rewind">Rewind</string>+ <string name="player_forward">Fast forward</string><string name="player_next">NEXT</string><string name="player_restart">Restart</string><string name="player_archive">Archive</string>@@ -441,19 +503,46 @@<string name="player_track_off">Off</string><string name="player_video_quality">Video Quality</string><string name="player_aspect_ratio_label">Aspect %1$s</string>+ <string name="player_channel_not_found">Channel not found</string>+ <string name="player_type_channel_number">Type channel number</string><string name="player_selected">Selected</string><string name="player_channel_list_title">Channels (%1$d)</string><string name="player_channel_selected">Now</string><string name="player_recent_channels">Recent</string><string name="player_last_group_label">Last: %1$s</string><string name="player_last_group_hint">Jump back to the last live group you were browsing.</string>- <string name="player_archive_badge">ARCHIVE</string>- <string name="player_catchup_badge">CATCH-UP</string>+ <string name="player_archive_badge">Archive</string>+ <string name="player_catchup_badge">Catch-up</string><string name="player_time_range_minutes">%1$s - %2$s | %3$d min</string><string name="player_next_label">Next:</string><string name="player_full_epg">Full EPG</string><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_restart_short">Restart</string>+ <string name="player_action_view">View</string>+ <string name="player_action_group">Group</string>+ <string name="player_action_recent_short">Recent</string>+ <string name="player_action_guide">Guide</string>+ <string name="player_action_split">Split</string>+ <string name="player_action_diagnostics">Diagnostics</string>+ <string name="player_diagnostics_title">Playback Diagnostics</string>+ <string name="player_diagnostics_provider">Provider</string>+ <string name="player_diagnostics_source">Source</string>+ <string name="player_diagnostics_decoder">Decoder</string>+ <string name="player_diagnostics_stream_class">Stream Class</string>+ <string name="player_diagnostics_playback_state">Playback State</string>+ <string name="player_diagnostics_archive">Archive</string>+ <string name="player_diagnostics_alternates">Alternate Streams</string>+ <string name="player_diagnostics_channel_errors">Channel Errors</string>+ <string name="player_diagnostics_resolution">Resolution</string>+ <string name="player_diagnostics_video_codec">Video Codec</string>+ <string name="player_diagnostics_audio_codec">Audio Codec</string>+ <string name="player_diagnostics_video_bitrate">Video Bitrate</string>+ <string name="player_diagnostics_dropped_frames">Dropped Frames</string>+ <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="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>@@ -503,6 +592,8 @@<string name="epg_view_scheduled_only_on">Scheduled only</string><string name="epg_view_scheduled_only_off">All loaded channels</string><string name="epg_view_scheduled_only_hint">Hide channels with no guide data</string>+ <string name="epg_show_options">Show guide options</string>+ <string name="epg_hide_options">Hide guide options</string><string name="epg_showing_channels">Showing %1$d of %2$d channels</string><string name="epg_schedule_summary">Guide data available on %1$d of %2$d channels</string><string name="epg_window_label">%1$s - %2$s</string>@@ -558,19 +649,26 @@<string name="player_no_archive">No archived programs found</string><string name="series_loading_details">Loading details...</string><string name="series_not_found">Series not found</string>+ <string name="series_detail_back">Back to library</string>+ <string name="series_plot_fallback">No plot available</string><string name="series_seasons">Seasons</string><string name="series_episodes">Episodes (%1$d)</string>- <string name="epg_now_playing">NOW PLAYING</string>- <string name="epg_no_data">No EPG Data</string>- <string name="epg_up_next">UP NEXT</string>+ <string name="epg_now_playing">Now Playing</string>+ <string name="epg_no_data">No EPG data</string>+ <string name="epg_up_next">Up Next</string><!-- Multi-View / Split Screen --><string name="multiview_add_to_split">Add to Split Screen</string>- <string name="multiview_queued">In Split Screen ✓</string>+ <string name="multiview_queued">In Split Screen</string><string name="multiview_planner_title">Split Screen Manager</string><string name="multiview_planner_empty">No channels in slots yet.\nLong-press a channel to add it.</string><string name="multiview_planner_clear">Clear All</string><string name="multiview_planner_launch">Launch Split Screen</string>+ <string name="multiview_planner_launch_disabled">Add channels first</string>+ <string name="multiview_planner_pick_slot">Choose a slot for %1$s.</string>+ <string name="multiview_planner_added">%1$s is ready for split screen.</string>+ <string name="multiview_planner_ready_subtitle">Review the active slots, replace any stream, and launch when ready.</string>+ <string name="multiview_planner_slot_hint">Select a slot to place this channel.</string><string name="multiview_empty_slot">Empty Slot</string><string name="multiview_stream_error">Stream Error</string><string name="multiview_nav">Split Screen</string>@@ -585,6 +683,7 @@<string name="multiview_audio_follow_focus">Follow Focus</string><string name="multiview_replace_title">Replace Focused Slot</string><string name="multiview_replace_empty">Use Live TV favorites or recent channels first so replacement choices appear here.</string>+ <string name="multiview_slot_label">Slot %1$d</string><string name="multiview_policy_summary">%1$s tier • %2$d active slot(s)</string><string name="multiview_policy_auto">Auto</string><string name="multiview_policy_conservative">Conservative</string>diff --git a/docs/code-review/DEAD_CODE_EDGE_CASE_MATRIX.md b/docs/code-review/DEAD_CODE_EDGE_CASE_MATRIX.mddeleted file mode 100644index fc289933..00000000--- a/docs/code-review/DEAD_CODE_EDGE_CASE_MATRIX.md+++ /dev/null@@ -1,91 +0,0 @@-# Dead Code, Reachability, and Edge-Case Matrix--## Progress Tracking (code-review branch)-- [x] `M3uParserTest` compilation fixed for new parser `ParseResult` contract.-- [x] `SyncManagerTest` fake DAO updated to implement `updateEpgUrl`.-- [x] Removed no-op behavior in `PreferencesRepository.clearDefaultViewMode`.-- [x] Player EPG collector fan-out fixed by consolidating under one cancellable parent job.-- [x] Duplicate EPG overlay paths consolidated.-- [x] Generated `domain/bin` tree removed from VCS.-- [x] Favorites N+1 resolution replaced with batched content lookups.-- [x] MultiView top-level back handling wired via `BackHandler`.-- [x] Search upgraded to FTS for channels/movies/series with SQL and UI result caps retained.-- [x] Local imported M3U files are trimmed on provider-list updates and post-save flows while preserving provider-referenced files.-- [x] Live player numeric channel entry implemented (buffer, preview, timeout commit, invalid feedback).-- [x] Player remote key semantics tightened (GUIDE/INFO/MENU support, layered Back behavior, no VOD zap on channel keys).-- [x] Home category rail now supports explicit DPAD-right handoff into content/search focus targets.-- [x] Player overlays migrated away from hardcoded/garbled icon text to localized string resources and ASCII-safe control labels.-- [x] Home screen now restores focus to last active category/channel after modal dialogs close (favorites/group/PIN/delete/category-options flows).-- [x] Player channel list and EPG overlays now persist last focused row/program and restore focus on reopen.-- [x] Provider edit flow no longer rehydrates stored passwords into UI state; blank password preserves existing encrypted secret.-- [x] Sensitive URL logging reduced by redacting discovered EPG URLs and alternative stream debug outputs.-- [x] Provider repository read paths now return redacted password fields instead of decrypted credential values.-- [x] Provider onboarding now persists sync outcome in provider status (`ACTIVE`/`ERROR`) for clearer failure semantics.-- [x] M3U sync now aborts on empty/no-playable payloads before DB replace-all operations.-- [x] Provider local file import now surfaces storage-full specific error messaging.-- [x] SyncManager now retries transient network failures with bounded exponential backoff for Xtream, M3U HTTP fetch, and EPG refresh.-- [x] Player lifecycle now reacts to foreground/background transitions and flushes VOD progress on stop/dispose boundaries.-- [x] Player decoder errors now trigger one-time software-decoder fallback before hard-fail.-- [x] Manual provider refresh now updates provider sync status (`ACTIVE`/`ERROR`) consistently with onboarding sync.-- [x] Sync pipeline now exposes degraded-but-complete outcomes via `SyncState.Partial` and provider `PARTIAL` status.-- [x] Settings now surfaces `PARTIAL` refresh outcomes with explicit warning snackbar and provider status badge.-- [x] Settings now includes per-section warning detail text (snackbar + provider card strip) for partial syncs.-- [x] Warning strips now include actionable section-retry controls with real backend handlers (`EPG`, `Movies`, `Series` where supported).-- [x] Live zapping now has a buffering-timeout watchdog with automatic fallback to the previous channel.-- [x] Settings popups (language/parental level) migrated from default alert style to premium TV dialog styling.-- [x] Player channel list overlay now shows group-local numbering and uses animated list scrolling without focus-scale jump.-- [x] Adult-content detection is now centralized with case-insensitive matching and reused by both M3U sync and Xtream mapping.-- [x] Xtream series and episode detail paths now inherit adult status from classified series categories instead of hardcoding `false`.-- [x] Parental-control category management now spans LIVE/MOVIE/SERIES and scopes protection writes by category type.--## C. Dead Code / Redundancy / Reachability--### Duplicated logic-- Resolved in `code-review`: duplicate EPG overlay file removed.- - Kept canonical implementation in `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt`.--### Unused or suspicious structures-- Potentially unused parser helpers:- - `data/src/main/java/com/streamvault/data/parser/M3uParser.kt:100` (`parseToChannels`)- - `data/src/main/java/com/streamvault/data/parser/M3uParser.kt:183` (`isVodEntry`)--### Unreachable / suspicious branches-- Parental control loading/state flow appears inconsistent and may represent dead branch behavior:- - `app/src/main/java/com/streamvault/app/ui/screens/settings/parental/ParentalControlGroupViewModel.kt:31-38,48`--### Simplification candidates-- Introduce shared badge composables and shared focus surface patterns.-- Remove duplicated overlay rendering paths.-- Delete generated source artifacts from repository and CI packaging.--## F. Edge Case Matrix--| Edge Case | Status | Evidence / Note |-|---|---|---|-| No internet during provider add | Covered well | Provider add flow now returns explicit error when initial sync fails (`ProviderRepositoryImpl.kt`). |-| Slow internet / high latency | Partially handled | Sync pipeline now retries transient failures with bounded exponential backoff; UX-level retry feedback/control is still basic. |-| Playlist partially loads | Partially handled | Initial sync failures surface explicitly; degraded section refreshes now mark provider `PARTIAL`, surface section-level warnings, and provide section-specific retry actions from Settings. |-| Invalid playlist URL/file | Covered well | Validation/error paths present in setup flow. |-| Empty playlist | Covered well | M3U sync now fails fast on empty/no-playable payloads and does not perform destructive replace-all writes. |-| Huge playlist (50k+ channels/items) | Partially handled | Favorites N+1 removed and FTS-backed search added; full stress/perf validation still pending. |-| Broken stream URL | Partially handled | Player now auto-falls back to previous channel when live zap stalls in buffering/error state; broader multi-strategy fallback UX is still limited. |-| Missing EPG | Partially handled | EPG optional paths exist, but stale/missing signaling is weak. |-| Corrupted provider response | Partially handled | Exceptions are handled and transient failures are retried; semantic validation/recovery for malformed payload subsets is still limited. |-| Resume after device sleep | Partially handled | Player observes lifecycle and now auto-pauses on `ON_STOP` with conditional resume on `ON_START`; still needs long-run device sleep stress validation. |-| Resume after process death | Partially handled | ViewModel/state restore is mixed; no clear end-to-end guarantee observed. |-| Returning from background during playback | Covered well | Player screen now wires lifecycle observer (`ON_STOP`/`ON_START`) and VM persists VOD progress + resumes only when session was playing pre-background. |-| Rapid channel switching | Partially handled | `PlayerViewModel.fetchEpg` now uses one cancellable parent job for all EPG collectors. |-| Repeated play/stop/open/close | Partially handled | Improved with lifecycle-driven pause/resume and progress flush; still requires endurance validation for long sessions/memory pressure. |-| Storage full on import/cache | Partially handled | Local M3U import now reports explicit storage-full error; broader cache/storage-pressure handling is still limited. |-| Permission issues on file import | Partially handled | Try/catch exists and setup now shows explicit import-failure feedback; retry/help UX is still basic. |-| Low memory conditions | Unknown | No targeted low-memory handling observed. |-| Unsupported codecs | Partially handled | Improved: decoder errors now attempt one software-decoder fallback automatically; still needs device-level codec compatibility test matrix. |-| Multiple input methods/remotes | Partially handled | D-pad, numeric entry, GUIDE/INFO/MENU remote keys, and back-stack behavior are improved; hardware keyboard-specific UX remains basic. |-| Provider metadata inconsistencies | Partially handled | Category-level adult classification is now centralized and propagated for M3U/Xtream, but provider naming remains heuristic when no explicit metadata exists. |-| Duplicate/empty categories | Partially handled | UI supports category lists; robust dedupe strategy unclear. |-| Large dataset search | Partially handled | FTS-backed search is in place with SQL/UI caps; ranking and stress tuning are still pending. |-| First launch vs returning user | Covered well | Welcome/setup split exists; still needs stronger failure-state signaling. |--## Tracking Notes-- Use this file as implementation checklist.-- Mark each row to `covered well` only after test evidence (unit/integration/manual scenario).diff --git a/docs/code-review/IPTV_APP_AUDIT.md b/docs/code-review/IPTV_APP_AUDIT.mddeleted file mode 100644index ce7a61ff..00000000--- a/docs/code-review/IPTV_APP_AUDIT.md+++ /dev/null@@ -1,481 +0,0 @@-# IPTV Android TV App Audit (Source-Level)--## Scope and Confidence-- Analysis type: source-level review (not APK-only); findings are based on current repository code.-- Confidence: high for issues with direct file/line evidence; medium for runtime behavior not fully exercised.-- Date: 2026-03-09-- Branch: code-review--## Progress Tracking (code-review branch)-- [x] Register Room migration `6 -> 7` in DI database builder.-- [x] Disable OkHttp logging in non-debug builds.-- [x] Fix Xtream API host handling by switching to dynamic `@Url` endpoint calls.-- [x] Stop returning silent success when initial provider sync fails.-- [x] Mask provider password input in setup UI.-- [x] Fix broken unit test compilation (`M3uParserTest`, `SyncManagerTest`).-- [x] Hash/salt parental PIN storage and remove PIN from backup export/import.-- [x] Encrypt provider password-at-rest with Keystore-backed AES-GCM (transparent decrypt on read).-- [x] Disable Android auto-backup (`allowBackup=false`).-- [x] Scope category protection DB updates by provider (prevents cross-provider lock updates).-- [x] Scope in-memory unlocked categories by provider (session unlock isolation fixed).-- [x] Add explicit forced refresh path that bypasses TTL for user-triggered sync.-- [x] Tie all player EPG collectors to one cancellable parent job (prevents zap-time collector buildup).-- [x] Remove generated `domain/bin` source tree from VCS and ignore it in `.gitignore`.-- [x] Consolidate duplicate EPG overlay implementation to a single component path.-- [x] Rework provider-scoped EPG persistence/query model.-- [x] Preserve remote content IDs separately (`streamId` / `seriesId` / `episodeId`) in domain mapping.-- [x] Stabilize sync identity by remapping local IDs from provider+remote ID lookups before provider replace-all writes.-- [x] Rework provider-scoped identity model for channels/movies/series/programs (including legacy ID normalization migration `8 -> 9`).-- [x] Add migration test coverage for Room upgrade paths including `9 -> 10` FTS schema migration.-- [x] Stop playback-history watch count inflation during periodic resume updates.-- [x] Implement series details fetch+persistence (Xtream seasons/episodes) with local fallback.-- [x] Replace favorites N+1 hydration with batched `IN` queries by content type.-- [x] Add top-level `BackHandler` integration to MultiView screen and clean broken overlay labels.-- [x] Replace `%LIKE%` search scans with provider-scoped FTS queries (plus SQL/UI result caps).-- [x] Add local imported M3U cleanup policy (retain latest files, delete stale imports).-- [x] Implement timed numeric channel entry (digit buffer + preview + delayed commit + invalid feedback) in player.-- [x] Add explicit network security policy via manifest `networkSecurityConfig`.-- [x] Harden Provider Setup local-file UX (localized labels + user-facing import failure messaging).-- [x] Clean Kotlin warnings in active TV flows (`HomeViewModel`, `MultiViewPlannerDialog`).-- [x] Polish player remote behavior: layered Back handling and GUIDE/INFO/MENU mappings; prevent VOD channel-zap key side effects.-- [x] Improve Home TV focus navigation from category rail to content/search via explicit DPAD-right handoff.-- [x] Normalize player overlay copy/icons to resource-driven TV labels (remove garbled/hardcoded symbols in controls, channel list, and EPG overlays).-- [x] Add Home focus restoration memory (return to last focused category/channel after dialog/pin/delete/options modal dismissal).-- [x] Add Player overlay focus restoration memory (channel list + EPG remember and restore last focused item across close/reopen).-- [x] Stop exposing stored Xtream passwords in edit UI; blank edit password now preserves existing encrypted secret.-- [x] Redact sensitive URL data from sync/player debug logging paths.-- [x] Stop returning decrypted provider passwords from repository read APIs (`getProviders`/`getProvider`/`getActiveProvider` now return redacted password fields).-- [x] Persist provider sync health on onboarding (`ACTIVE` on successful initial sync, `ERROR` on failed initial sync).-- [x] Guard M3U sync against empty/no-playable payloads before replace-all writes (prevents accidental data wipe on malformed/empty playlists).-- [x] Improve local M3U import error UX with explicit storage-full messaging.-- [x] Add transient retry/backoff for sync network paths (Xtream fetches, M3U HTTP download, and EPG refresh) to reduce failures on slow/unstable links.-- [x] Add lifecycle-aware player foreground/background handling (auto-pause/conditional resume + VOD progress flush on stop/dispose).-- [x] Add decoder-error recovery path (one-shot fallback to software decoder mode before failing playback).-- [x] Update provider sync health during manual refresh paths (`ACTIVE` on success, `ERROR` on failure).-- [x] Add partial-sync semantics (`SyncState.Partial` + provider `PARTIAL` status) for non-fatal degraded refreshes.-- [x] Surface partial-sync outcomes in Settings UX (provider status badge + warning snackbar on refresh).-- [x] Show per-section partial warning details in Settings refresh feedback and provider cards.-- [x] Add actionable partial-warning remediation buttons in Settings (`Retry EPG`, `Retry Movies`, `Retry Series`) backed by section-specific sync retries.-- [x] Add live zap buffering watchdog with automatic fallback to previous channel when channel switch stalls.-- [x] Replace old Settings selection popups with TV-styled premium dialogs (level/language selectors).-- [x] Improve player channel-list overlay with group-local numbering and smoother focus/scroll behavior during long-list navigation.-- [x] Centralize adult-content category classification with case-insensitive matching for M3U and Xtream.-- [x] Apply Xtream parental classification by category for series/items instead of leaving series permanently unprotected.-- [x] Expand parental category management to LIVE, Movies, and Series with type-scoped protection updates.--## A. Executive Summary-- Overall quality rating: 5.8/10 (strong ambition, fragile internals, TV UX partially mature)-- Main strengths:- - Clear module split (`app`, `data`, `domain`, `player`)- - Broad feature scope (Live, Movies, Series, EPG, multiview, parental controls)- - Compose TV-first UI foundation with focus handling in many screens-- Main weaknesses:- - Several critical data/network correctness risks- - Security/privacy posture is below production baseline- - High coupling between provider sync and local schema assumptions- - UI styling is inconsistent and partly non-native/polish-deficient for premium TV apps-- Biggest risks:- - Xtream connection flow may fail due base URL wiring- - DB migration path mismatch can break upgrades- - Cross-provider data corruption/overlap risk for IDs and EPG- - Memory/leak-like behavior from uncancelled collector jobs in player-- Biggest opportunities:- - Fix data model boundaries (provider-scoped IDs and EPG keys)- - Harden sync/retry/error states- - Improve premium TV UX consistency and focus ergonomics- - Implement secure credential storage and logging hardening--## B. Findings by Category--### 1) Xtream API base URL wiring is likely broken-- Severity: Critical-- Area: Reliability / Networking / IPTV-- Status: Done in `code-review` (dynamic `@Url` endpoint implementation)-- What is wrong:- - Retrofit service is created with fixed placeholder base URL (`https://placeholder.com/`). Xtream API methods are static relative paths and do not use dynamic `@Url`.-- Why it matters:- - Authentication/data calls can hit wrong host or fail for real providers.-- Evidence:- - `app/src/main/java/com/streamvault/app/di/NetworkModule.kt:49-53`- - `data/src/main/java/com/streamvault/data/remote/xtream/XtreamApiService.kt:17-21`- - `data/src/main/java/com/streamvault/data/remote/xtream/XtreamProvider.kt:23-25`- - `data/src/main/java/com/streamvault/data/sync/SyncManager.kt:110-114`-- Recommended fix:- - Either build Retrofit per-provider base URL, or change service methods to dynamic `@Url` and pass full endpoint per call.--### 2) Room migration registration mismatch-- Severity: Critical-- Area: Reliability / Storage-- Status: Done in `code-review` (registered missing migrations and added migration instrumentation test coverage including `9 -> 10`)-- What is wrong:- - DB version is 7 and `MIGRATION_6_7` exists, but DI builder registers migrations only to `5_6`.-- Why it matters:- - App upgrades from v6 can fail at startup.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/StreamVaultDatabase.kt:24,141-146`- - `app/src/main/java/com/streamvault/app/di/DatabaseModule.kt:26-31`-- Recommended fix:- - Register `StreamVaultDatabase.MIGRATION_6_7` in Hilt database module and add upgrade test.--### 3) External IDs are written into auto-generated primary keys-- Severity: Critical-- Area: Architecture / Data Integrity-- Status: Done in `code-review` (remote IDs are explicit domain fields; sync writes keep local PK internal; migration `8 -> 9` normalizes legacy local IDs and remaps favorites/history/episode links)-- What is wrong:- - Entities define `id` as auto-generated local PK but mappers set `id = externalStreamId`.-- Why it matters:- - Collisions and inconsistent identity across providers; broken references and updates.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/entity/Entities.kt:39-43,69-73,106-110`- - `data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt:64-67,114-117`-- Recommended fix:- - Keep local PK internal; store remote IDs in dedicated columns with provider-scoped unique indices.--### 4) EPG persistence is not provider-scoped and has unstable IDs-- Severity: Critical-- Area: IPTV / Data Integrity / Reliability-- Status: Done in `code-review` (program table now carries `provider_id`; DAO/repository/viewmodel queries are provider-scoped; migration `7 -> 8` added)-- What is wrong:- - Program table/query paths are not fully provider-scoped; mapper keeps parser IDs that can default to 0.-- Why it matters:- - EPG overlap, duplicate inserts, wrong now-playing data between providers.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/entity/Entities.kt:180-198`- - `data/src/main/java/com/streamvault/data/local/dao/Daos.kt:257-258`- - `data/src/main/java/com/streamvault/data/repository/EpgRepositoryImpl.kt:58-78`- - `data/src/main/java/com/streamvault/data/mapper/EntityMappers.kt:268-277`-- Recommended fix:- - Add provider key to program identity, define stable composite uniqueness, and enforce provider filter in queries.--### 5) Provider setup can succeed while initial sync failed-- Severity: High-- Area: Reliability / UX-- Status: Done in `code-review` (setup now returns error on initial sync failure; successful sync sets `ACTIVE`; degraded non-fatal sync sections now map to `PARTIAL`; hard failures map to `ERROR`, across onboarding and manual refresh paths)-- What is wrong:- - Exceptions during first sync are swallowed and setup still returns success.-- Why it matters:- - User sees provider as added but data is incomplete/empty.-- Evidence:- - `data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt:109-118,163-171`-- Recommended fix:- - Surface sync status explicitly and mark provider as `degraded` until first successful sync.--### 6) Parental lock operations are not provider-scoped-- Severity: High-- Area: Correctness / Security / IPTV-- Status: Done in `code-review` (DB write paths and in-memory unlock model are provider-scoped)-- What is wrong:- - Category lock updates match only category ID; memory unlock state also lacks provider dimension.-- Why it matters:- - Locks can apply incorrectly across providers with same category IDs.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/dao/Daos.kt:78-79,146-147,182-183,245-246`- - `data/src/main/java/com/streamvault/data/repository/CategoryRepositoryImpl.kt:26-33`- - `domain/src/main/java/com/streamvault/domain/manager/ParentalControlManager.kt:11-26`-- Recommended fix:- - Scope lock state by `(providerId, categoryId)` in DB and in-memory manager.--### 7) Player EPG collection jobs can accumulate during channel zapping-- Severity: High-- Area: Performance / Reliability-- Status: Done in `code-review` (single parent `epgJob` now owns now/next/history/upcoming collectors)-- What is wrong:- - `fetchEpg` cancels one job but spawns additional collectors that are not fully tied to a single cancellable handle.-- Why it matters:- - Increased memory/CPU and inconsistent UI updates during fast channel switching.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt:386-397,405-425`-- Recommended fix:- - Use one structured `channelEpgJob` per channel and cancel/restart atomically.--### 8) Series details loading appears incomplete-- Severity: High-- Area: IPTV / Correctness-- Status: Done in `code-review` (Xtream `getSeriesInfo` is fetched by remote `series_id`, persisted to local `series`/`episodes`, and returned with merged seasons/episodes; local-cache fallback on remote failure)-- What is wrong:- - Repository returns local series row only; detail VM expects seasons/episodes structure.-- Why it matters:- - Empty/partial series detail screen in real-world providers.-- Evidence:- - `data/src/main/java/com/streamvault/data/repository/SeriesRepositoryImpl.kt:75-78`- - `app/src/main/java/com/streamvault/app/ui/screens/series/SeriesDetailViewModel.kt:51-60`-- Recommended fix:- - Add remote details fetch + local relational persistence for seasons/episodes.--### 9) Credentials and PIN are stored unsafely-- Severity: High-- Area: Security / Privacy-- Status: Partially done in `code-review` (PIN hashed/salted, PIN removed from backup export/import, provider password-at-rest encrypted, edit flow no longer pre-fills stored password, provider repository read APIs now redact password fields by default, and sensitive stream/EPG URL logging is redacted; broader secrets hardening still pending)-- What is wrong:- - Provider credentials saved plaintext in Room; parental PIN stored plaintext with default `0000`; backup includes PIN.-- Why it matters:- - Device compromise or backups can expose sensitive account controls.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/entity/Entities.kt:18-20`- - `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt:46-49,69-72`- - `data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt:36-39,91-97`-- Recommended fix:- - Encrypt credentials with Android Keystore backed keys; hash PIN with strong KDF; remove secrets from backup payloads.--### 10) Network logging and backup flags are production-risky-- Severity: High-- Area: Security-- Status: Done in `code-review` (release logging disabled and `allowBackup=false`)-- What is wrong:- - OkHttp logging interceptor is BASIC globally; `allowBackup=true` in manifest.-- Why it matters:- - Metadata leakage and broader extraction surface.-- Evidence:- - `app/src/main/java/com/streamvault/app/di/NetworkModule.kt:33-36`- - `app/src/main/AndroidManifest.xml:18`-- Recommended fix:- - Disable network logging for release builds; review backup policy and sensitive exclusions.--### 11) Unit tests do not compile in current state-- Severity: High-- Area: Maintainability / Reliability-- Status: Done in `code-review` (`./gradlew test` passes)-- What is wrong:- - Parser test expects wrong return type; fake DAO missing new method.-- Why it matters:- - CI quality gate is broken; regression risk is high.-- Evidence:- - `data/src/test/java/com/streamvault/data/parser/M3uParserTest.kt:36-41`- - `data/src/main/java/com/streamvault/data/parser/M3uParser.kt:53`- - `data/src/test/java/com/streamvault/data/sync/SyncManagerTest.kt:38-50`-- Recommended fix:- - Update tests to new parser contract and DAO interface; enforce CI on PR.--### 12) Manual refresh is not truly forced-- Severity: Medium-- Area: UX / Reliability-- Status: Done in `code-review` (`ProviderRepository.refreshProviderData(force=true)` wired from user-triggered refresh actions)-- What is wrong:- - Settings refresh path can still be gated by TTL checks in sync manager.-- Why it matters:- - User requests refresh but stale data remains.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt:53-55,86-89`- - `data/src/main/java/com/streamvault/data/sync/SyncManager.kt:122-193`-- Recommended fix:- - Add explicit `force=true` path that bypasses TTL for user-triggered refresh.--### 13) Playback history watch count is inflated-- Severity: Medium-- Area: Data Quality / UX-- Status: Done in `code-review` (periodic resume updates now preserve existing `watchCount` instead of incrementing on each tick)-- What is wrong:- - Resume updates every 5 seconds may increase watch count repeatedly for same session.-- Why it matters:- - Incorrect popularity/recent metrics and resume UX noise.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt:363-381`- - `data/src/main/java/com/streamvault/data/repository/PlaybackHistoryRepositoryImpl.kt:31-40`-- Recommended fix:- - Increment watch count on session start/end events, not periodic progress ticks.--### 14) Search path is not scalable for large datasets-- Severity: Medium-- Area: Performance / IPTV-- Status: Done in `code-review` (provider-scoped FTS search implemented for channels/movies/series; SQL and UI caps remain in place)-- What is wrong:- - Previous implementation used `%query%` LIKE scans without FTS/index strategy, which was expensive on large datasets.-- Why it matters:- - Large playlists will lag and hurt remote responsiveness.-- Evidence:- - `data/src/main/java/com/streamvault/data/local/dao/Daos.kt:51-52,96-97,158-159`- - `app/src/main/java/com/streamvault/app/ui/screens/search/SearchScreen.kt:93-100`-- Recommended fix:- - Add Room FTS tables or prefix indexing, debounce, and result limits.--### 15) Favorites screen has N+1 lookup behavior-- Severity: Medium-- Area: Performance-- Status: Done in `code-review` (FavoritesViewModel now batch-resolves channel/movie/series records through `get*ByIds` flow combines)-- What is wrong:- - For each favorite, additional repository lookups are performed.-- Why it matters:- - Slow loading and unnecessary DB work with large favorites list.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt:37-65`-- Recommended fix:- - Replace with joined query returning fully typed favorite payloads in one flow.--### 16) TV key behavior is incomplete for numeric channel input-- Severity: Medium-- Area: Android TV UX-- Status: Done in `code-review` (live player now supports buffered numeric entry with preview, timeout auto-commit, Enter commit, and invalid-input feedback; `0` retains last-channel quick recall when buffer is empty; remote GUIDE/INFO/MENU behavior and Back stack were tightened for TV expectations)-- What is wrong:- - Supports `KEYCODE_0` recall behavior but no robust direct numeric entry workflow.-- Why it matters:- - Power users with remotes expect fast channel number zapping.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt:285-287`-- Recommended fix:- - Implement timed numeric buffer + candidate preview + confirm/fallback behavior.--### 17) MultiView screen back handling appears incomplete-- Severity: Medium-- Area: Android TV UX / Navigation-- Status: Done in `code-review` (explicit `BackHandler` wired to `onBack`; focused-slot overlays cleaned)-- What is wrong:- - Screen API includes `onBack` but no clear local `BackHandler` integration at top-level.-- Why it matters:- - Potential inconsistent exit behavior for remote back key.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/multiview/MultiViewScreen.kt:33-35`-- Recommended fix:- - Add explicit `BackHandler` contract and focus-safe exit path.--### 18) Provider setup password field is visible text-- Severity: Medium-- Area: Security / UX-- Status: Done in `code-review` (password masking added)-- What is wrong:- - Password input is plain text field without masking.-- Why it matters:- - Credential exposure on-screen in shared living-room environments.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt:176-178`-- Recommended fix:- - Add visual transformation and optional reveal toggle.--### 19) Local file-imported playlists may accumulate-- Severity: Medium-- Area: Storage / Maintainability-- Status: Done in `code-review` (cleanup now runs on every provider-list change and after successful provider save/edit; stale `m3u_*.m3u` files are trimmed while preserving currently referenced local playlists)-- What is wrong:- - M3U import writes timestamped files under app files without visible cleanup lifecycle.-- Why it matters:- - Wasted storage and stale artifacts.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt:73-76`-- Recommended fix:- - Track ownership and garbage-collect old imported playlists.--### 20) Potential cleartext compatibility ambiguity-- Severity: Low-- Area: Security / Compatibility-- Status: Done in `code-review` (explicit `network_security_config` added and wired in manifest)-- What is wrong:- - No explicit network security config policy for HTTP-only providers.-- Why it matters:- - Either runtime failures for HTTP providers or unintended broad cleartext allowance later.-- Evidence:- - Manifest/config inspection (no explicit cleartext policy observed in app manifest).-- Recommended fix:- - Define network security config with minimal allowed domains/policies.--### 21) Duplicate EPG overlay implementations-- Severity: Low-- Area: Maintainability / Redundancy-- Status: Done in `code-review` (removed redundant `EpgOverlay.kt`; only `PlayerScreen` overlay remains)-- What is wrong:- - EPG overlay logic exists in separate files and can drift.-- Why it matters:- - Inconsistent UX and duplicated bug fixes.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt:1343`- - `app/src/main/java/com/streamvault/app/ui/screens/player/EpgOverlay.kt:27`-- Recommended fix:- - Consolidate into a single reusable overlay component.--### 22) Generated `domain/bin` sources are committed-- Severity: Low-- Area: Maintainability / Hygiene-- Status: Done in `code-review` (tree removed from VCS; `domain/bin/` ignored)-- What is wrong:- - Repository includes generated duplicate source tree.-- Why it matters:- - Confusion, stale code, noisy diffs.-- Evidence:- - `domain/bin/main/...`-- Recommended fix:- - Remove generated outputs from VCS and enforce ignore rules.--### 23) Player lifecycle handling was not foreground-aware-- Severity: Medium-- Area: Reliability / Android TV-- Status: Done in `code-review` (screen lifecycle now pauses on background, conditionally resumes on foreground, and flushes VOD progress on stop/dispose)-- What is wrong:- - Playback/progress tracking paths were not tied to screen lifecycle events, so background/sleep transitions could continue stale state updates.-- Why it matters:- - Leads to unstable resume behavior, unnecessary background writes, and weaker resilience when returning to playback after sleep/home transitions.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt:135-146`- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt:392-434,780`-- Recommended fix:- - Observe lifecycle (`ON_STOP`/`ON_START`) in player screen, pause/resume intentionally, and persist VOD progress at lifecycle boundaries.--### 24) Decoder failures had no runtime fallback strategy-- Severity: Medium-- Area: Reliability / Playback-- Status: Done in `code-review` (decoder errors now trigger one-time software-decoder fallback and replay attempt)-- What is wrong:- - Decoder errors previously surfaced directly to error UI with no automatic recovery strategy.-- Why it matters:- - IPTV providers often mix problematic streams/codecs; immediate hard-fail hurts playback continuity and perceived quality.-- Evidence:- - `app/src/main/java/com/streamvault/app/ui/screens/player/PlayerViewModel.kt:127-134,275-276`-- Recommended fix:- - On decoder failure, attempt one bounded fallback path (software decoder) before surfacing hard failure.--## D. Premium App Gap Analysis--### What premium IPTV apps do better-- Provider onboarding trust flow: visible connectivity test, masked credentials, clear error categories, and first-sync progress with recover actions.-- Live TV channel zap ergonomics: direct number input, quick channel list overlay, instant last-channel switch, predictable back behavior.-- EPG reliability: resilient merge strategy, conflict resolution, timezone handling, clear stale/partial indicators.-- Large dataset handling: fast indexed search, lazy loading, aggressive caching, incremental rendering.-- Playback experience: clean overlays, stable focus paths, subtitle/audio controls, reliable resume and error recovery.--### What this app currently lacks-- Robust provider-scoped data model for IDs and EPG.-- Production-grade secrets handling and release logging policy.-- Mature first-sync state model (success/degraded/failed).-- High-confidence performance strategy for very large playlists.-- Fully premium visual consistency across setup, navigation, and playback overlays.--### What changes would have highest impact-1. Fix data identity and EPG scoping (prevents silent corruption and wrong content display).-2. Fix Xtream networking host handling and migration chain (prevents hard failures).-3. Harden provider setup + sync status model (prevents false success).-4. Ship secure credential/PIN handling (trust and compliance baseline).-5. Unify TV interaction model (focus, back, key handling, overlays) and polished visual system.--## E. Optimization Opportunities (Prioritized)-1. Done in `code-review`: provider-scoped DB indices for channels/programs + FTS search tables.-2. High impact: structured concurrency cleanup in player EPG observers.-3. High impact: batch queries for favorites/history instead of per-item lookups.-4. Medium impact: add force-refresh pathway bypassing TTL for explicit user action.-5. Medium impact: reduce recomposition pressure in large grids via stable item models and `derivedStateOf` guards.-6. Medium impact: optimize image loading policies for logos/posters (size hints, placeholders, cache strategy).-7. Medium impact: incremental EPG ingestion pipeline with bounded memory and checkpointing.-8. Low impact: remove dead/duplicate code paths and generated `domain/bin` tree.--## G. Refactoring Plan--### 1) Quick wins (1-3 days)-- Register missing migration in DI.-- Fix broken tests (`M3uParserTest`, `SyncManagerTest`).-- Mask password input in provider setup.-- Disable verbose/network logging in release.-- Add explicit UI messaging when initial sync fails.--### 2) Medium effort (3-10 days)-- Introduce forced refresh path and sync state model (`idle/running/partial/failed/success`).-- Consolidate EPG overlay component.-- Add provider-aware parental lock keying.-- Replace N+1 favorites and broad search with optimized DAO queries.--### 3) High-impact architectural changes (2-6 weeks)-- Rework entity identity model: local PK + provider-scoped remote IDs and constraints.-- Rebuild EPG persistence schema for provider/channel scoping and dedupe.-- Re-architect Xtream service host strategy.-- Add encrypted secret storage and secure backup strategy.--### 4) Nice-to-have premium upgrades-- Numeric channel input with timed buffer and visual confirmation.-- Rich channel zap mini-guide and fast category switching.-- Better fallback handling for broken logos/metadata.-- Premium visual polish pass across all major screens and overlays.diff --git a/docs/code-review/PREMIUM_TV_AUDIT_2026-03-11.md b/docs/code-review/PREMIUM_TV_AUDIT_2026-03-11.mddeleted file mode 100644index 23e04f33..00000000--- a/docs/code-review/PREMIUM_TV_AUDIT_2026-03-11.md+++ /dev/null@@ -1,408 +0,0 @@-# StreamVault Premium TV Audit--Branch: `session/premium-audit-2026-03-11`-Base: `master`-Method: source-level audit plus targeted implementation pass-Confidence: `confirmed` for code-backed findings, `likely` for runtime/perf behavior inferred from structure, `assumption` where device-level validation is still missing--## A. Executive Product Assessment-- Overall quality: `7.5/10`-- Biggest strengths:- - `confirmed`: strong feature surface for an Android TV IPTV app: Live TV, Movies, Series, EPG, favorites, custom groups, parental control, resume history, multiview, numeric zapping, audio/subtitle switching.- - `confirmed`: clean module split across `app`, `data`, `domain`, and `player`.- - `confirmed`: the player stack is already better than average IPTV apps: Media3, error recovery, alternative-stream fallback, numeric input, diagnostics, catch-up entry points.-- Biggest weaknesses:- - `confirmed`: several flows looked complete but were context-fragile. Search and Favorites were launching player with incomplete provider/category/internal IDs until this branch.- - `confirmed`: the full-screen EPG was visually present but functionally weak: placeholder click handlers and only now-playing data.- - `confirmed`: Movies and Series were still doing extra UI-side filtering/grouping work instead of using repository search for typed queries.- - `confirmed`: the app now has a real dashboard-style Home screen instead of treating the Live TV browser as the landing surface; recent-live workflows still exist, but the extra `Recent` / `Last Channel` / `Last Group` chips were intentionally pulled back out of the Live TV browse header because that surface was getting jammed and low quality.-- Why it still does not fully feel premium:- - `confirmed`: some screens are polished while others still expose placeholder behavior, hardcoded copy, or weaker empty/error states, though Movies/Series category copy and group-management affordances are stronger after this pass.- - `likely`: huge-library responsiveness will still be uneven because Live is more optimized than VOD/Series browsing.- - `likely`: full premium feel needs one more pass on information architecture, cross-screen consistency, and power-user workflows.-- Top opportunities:- 1. Finish Live TV information architecture: better recent-channel memory, better full EPG, better catch-up and stale-guide handling.- 2. Rework VOD/Series browsing for very large libraries beyond the first search optimization already implemented.- 3. Make favorites/groups and multi-provider workflows feel intentional instead of merely available.- 4. Unify TV-native polish across Search, Favorites, Settings, Series detail, and EPG.--## B. Full Feature Inventory-| Feature | Status | Notes |-|---|---|---|-| Xtream provider login | Full | `confirmed`: auth, sync, edit, active-provider switching exist. |-| M3U URL import | Full | `confirmed`: validation and sync path exist. |-| Local M3U file import | Full | `confirmed`: file picker, local copy, cleanup policy, storage-full messaging exist. |-| Multi-provider support | Full | `confirmed`: multiple providers, active provider, refresh, edit, delete. |-| Welcome/onboarding | Partial | `confirmed`: welcome split and auto-bypass exist; still basic for premium onboarding and trust-building. |-| Home dashboard | Partial | `confirmed`: Home now has a real premium direction: featured hero state, dashboard stats, provider-health surfacing, provider-warning drill-down, live-memory shortcut cards, favorite channels, recent channels, continue watching, and fresh Movies/Series shelves, plus category-aware deep links back into Live TV; it is much stronger, but still needs deeper personalization to feel fully premium. |-| Sync status / partial refresh warnings | Full | `confirmed`: provider status, partial warning actions, section retries exist. |-| Live TV categories | Full | `confirmed`: provider categories plus virtual favorites/groups/recent remain in the category rail; the browse surface was simplified in this pass so Live TV is back to being a channel browser instead of a pseudo-home screen. |-| Movies catalog | Full | `confirmed`: category rail, hero banner, continue watching, favorites/groups, a reachable saved-shortcuts strip for Favorites/custom groups, repository-backed all-library lens rows for Favorites, Continue Watching, Top Rated, and Fresh content, and a query-backed full-library browse mode. |-| Series catalog | Full | `confirmed`: category rail, continue watching, favorites/groups, detail screen, a reachable saved-shortcuts strip for Favorites/custom groups, repository-backed all-library lens rows for Favorites, Continue Watching, Top Rated, and Fresh content, and a query-backed full-library browse mode. |-| Series detail / seasons / episodes | Full | `confirmed`: series detail loads seasons/episodes and plays episodes. |-| Full-screen EPG | Full | `confirmed`: now actionable, category-aware, schedule-based, clearer about stale/missing data, exposes visible time-window controls and window labels, includes a dense aligned timeline grid with shared half-hour markers, current-time line, and time-scaled program placement, supports direct day browsing, has `Scheduled only` cleanup mode, guide-mode filters for timeline, anchor-time, and archive-ready browsing, now adds density/layout controls, full-window paging, persisted guide defaults, a favorite-channel-only mode, exact return-route handoff back from player, and a real TV-style program side panel with provider/channel/replay/progress metadata, surrounding schedule context, and stale-guide refresh. |-| Player EPG overlay | Full | `confirmed`: current/next/upcoming/history overlays exist. |-| Favorites | Partial | `confirmed`: the standalone saved-library route is now reachable from Home and behaves like a real hub with overview stats, type filters, sort presets, provider scope, section-jump chips, Continue Watching, Recent Live rows, higher-level saved presets including `Home Shelf`, and in-hub management actions; it is no longer effectively dead code, but it still lacks deeper merged-provider behavior and final cross-surface polish. |-| Custom virtual groups | Partial | `confirmed`: create/add/remove/delete/reorder/rename now exist in Live TV, Movies, and Series category sidebars, and saved shortcut cards can now long-press directly into those management flows; the overall saved-library UX is still fragmented across screens. |-| Continue watching | Partial | `confirmed`: movies and series continue-watching exists; live now has a separate recent-channels workflow instead of resume-style continue watching. |-| Resume playback | Full | `confirmed`: movies and series episodes resume with prompt. |-| Search | Partial | `confirmed`: FTS-backed search exists across Live/Movies/Series, Search exposes recent-query shortcuts with clear-history controls, and it now has visible no-provider/min-query states plus results-summary chips for one-click narrowing; it still lacks deeper filtering and stronger power-user UX. |-| Numeric channel entry | Full | `confirmed`: timed input, preview, invalid feedback, last-channel on `0`. |-| Channel zapping | Full | `confirmed`: next/previous, overlays, watchdog fallback, last channel. |-| Audio track switching | Full | `confirmed`: track discovery and selection exist. |-| Subtitle switching | Full | `confirmed`: subtitle track selection with disable option exists. |-| Video quality switching | Partial | `confirmed`: implemented as alternative-stream selection, not full adaptive/manual quality UX. |-| Catch-up / replay | Partial | `confirmed`: catch-up URL building and archive entry exist, and guide/player now expose provider-aware replay reasoning plus richer failure messages; provider compatibility handling and deeper archive intelligence still need more work. |-| Multiview / split screen | Full | `confirmed`: 4-slot multiview now includes slot manager, focused audio, saved presets, focused-slot replace/remove actions, audio pinning, device-tier performance modes, active-slot caps, staged decoder startup, runtime telemetry snapshots, sustained-load throttling, low-memory standby behavior, and thermal-aware slot reduction on supported Android TV devices. Manual lower-end device profiling is still required for final acceptance, but the in-app protection layer is now implemented. |-| Parental control | Full | `confirmed`: PIN, lock levels, category protection for Live/Movies/Series exist. |-| Backup / restore | Partial | `confirmed`: backup now includes expanded preferences, providers, playback history, promoted groups, and multiview presets, and Settings now exposes restore preview/conflict UX with section toggles and conflict-strategy selection; broader media/library validation and post-import reporting are still limited. |-| Settings | Partial | `confirmed`: provider, playback, parental, language, and backup controls already existed; this pass improves hierarchy with an overview card, section descriptions, cleaner provider status/warning copy, a real provider diagnostics panel with per-domain sync timestamps/counts and capability summaries, plus backup preview/import planning and a DVR status section, but deeper organization is still needed. |-| Localization | Full | `confirmed`: many translations and RTL handling exist. |-| Diagnostics overlay | Partial | `confirmed`: player stats now include provider/source, decoder mode, stream class, playback state, archive support, alternate stream count, channel error history, last failure reason, recovery actions, and troubleshooting hints; it is substantially stronger, but still not a dedicated end-to-end troubleshooting center. |-| Channel history / recent channels | Partial | `confirmed`: Live TV still exposes a reachable `Recent` category in the sidebar, and Player still surfaces recent channels plus remembered `Last Group` context inside playback overlays; the extra Live TV header shortcuts were removed because they cluttered browsing. |-| External player support | Missing | `confirmed`: no external player path found. |-| Recording | Partial | `confirmed`: local live DVR v1 now has a real recording manager, scheduled/manual recording state, reachable Player actions for record/stop/schedule, and a Settings surface for storage plus job management; it is still limited to direct stream URLs and does not yet include a recordings browser or background-robust scheduling. |-| Playlist merge / cross-provider unified library | Missing | `confirmed`: one active provider model, not merged unified browsing. |--## C. Partial / Incomplete Feature Report-- Favorites and custom groups- - `confirmed`: storage and group membership are implemented.- - `confirmed`: the main user path is the in-context category rails for Live, Movies, and Series, not the standalone Favorites route.- - `confirmed`: Home now exposes the standalone saved-library route directly, so users have a real landing-surface entry point into that broader saved view.- - `confirmed`: Live TV, Movies, and Series now support rename/delete/reorder management for custom groups directly from category long-press actions, with visible on-screen feedback.- - `confirmed`: rename persistence had a real bug in Movies/Series because the UI was passing virtual negative IDs instead of stored group IDs; this branch fixes that.- - `confirmed`: Movies and Series expose saved shortcuts in the main browse surface, but Live TV was deliberately simplified again after user review, so saved groups now stay primarily in the category rail there instead of competing with the channel grid.- - `confirmed`: Movies and Series now keep saved shortcuts visible when you are inside a saved category, and they expose an explicit `Browse All` return path from that same strip instead of forcing a sidebar bounce.- - `confirmed`: saved shortcut cards in Movies and Series can now long-press directly into group-management flows, so users do not have to backtrack to the sidebar just to rename, delete, or reorder a saved group.- - `confirmed`: reorder mode now uses the long-pressed saved category itself in Live TV, Movies, and Series instead of accidentally reordering whatever category happened to be open or whatever preview shelf data was already on screen.- - `confirmed`: Movies and Series saved-category views now show an inline saved-group context card with item counts plus direct `Manage` and `Browse All` actions, so saved views feel like intentional destinations instead of generic filtered grids.- - `confirmed`: saved shortcut ordering is cleaner now: no duplicate `Favorites`, and empty groups are no longer surfaced as if they were meaningful saved destinations.- - `confirmed`: the standalone Saved Library screen now exposes a proper overview card, type filters, quick section jumps, direct Continue Watching plus Recent Live rows, visible browse sort presets for manual order, recent activity, and alphabetical browsing, and higher-level saved presets like `Watch Next`, `Live Recall`, Movies, Series, and Custom Groups.- - `confirmed`: the Saved Library hub now also exposes managed custom-group actions directly inside the route itself: remove from current saved context, move items between groups, merge groups, delete groups, and pin or unpin live groups for Home surfacing.- - `confirmed`: Home now respects promoted live groups from the Saved Library hub, so the cross-surface saved model is no longer purely passive.- - `confirmed`: the Saved Library hub now supports current-provider versus all-provider scoping without leaving the route.- - `confirmed`: the Saved Library hub now also exposes a dedicated `Home Shelf` preset so live favorites and promoted live groups can be reviewed as a real dashboard policy, not just hidden long-press state.- - Still incomplete: current-provider scope is real, but `All Providers` is still a cross-provider filter over saved/history data, not a true merged-provider browse model, and saved-group policy controls still stop at Home promotion.- - Production-grade finish: keep unifying favorites, recents, continue watching, and custom groups into one coherent library model while adding true merged-provider behavior, stronger preset policy, and richer in-place actions.-- Recent channels / live history- - `confirmed`: live playback now records into history and Live TV exposes a dedicated `Recent` virtual category in the category rail.- - `confirmed`: `Recent` now stays visible in the Live TV category rail even before it has any channel history, so the feature is actually discoverable from reachable UI.- - `confirmed`: this pass removes the extra Live TV header shortcuts for `Recent`, `Last Channel`, and `Last Group`; those controls were making the browse surface feel jammed instead of premium.- - `confirmed`: Home now surfaces live memory where it belongs: recent channels plus quick-access shortcuts for Favorites, Recent, Last Group, and populated custom live groups.- - `confirmed`: Player still surfaces recent channels and the remembered `Last Group`, so the live-memory model remains available where it is more contextually appropriate.- - `confirmed`: Player now surfaces recent channels through the live info/channel-list flow instead of trapping recents on Home only.- - `confirmed`: Player now also exposes the remembered `Last Group` through the live info overlay and channel-list header, so the browsing-memory model carries into playback instead of stopping at the Live TV screen.- - Still incomplete: no top-nav shortcut, no richer timeline/history presentation, and no broader recall model outside Live TV, Player, Home, and Saved Library.- - Production-grade finish: add recent-channel row/shortcut entry points, mini-guide recall, and broader provider-aware surfacing across Live TV, Player, and any future landing surface.-- Full-screen EPG- - `confirmed`: was placeholder-heavy and only now-playing based.- - `confirmed`: earlier work added actionable channel launch and program detail dialog plus short schedule loading.- - `confirmed`: this pass adds category filtering, guide summary metadata, retry handling, stale/missing-data messaging, visible time-window controls, direct day browsing, half-hour and prime-time jumps, a shared aligned timeline grid with current-time line, time-scaled program placement, a `Scheduled only` mode that hides channels with no guide data, and guide modes for anchor-time and archive-ready browsing.- - `confirmed`: the full guide now launches archive-capable programs directly into catch-up playback instead of stopping at a read-only detail dialog.- - `confirmed`: the guide now exposes layout-density controls for compact, comfortable, and larger-screen browsing.- - `confirmed`: the guide now exposes full-window paging actions, so users can move across broader timeline blocks without chaining repeated small jumps.- - `confirmed`: favorite live channels now get visible overlay treatment inside the guide grid, and program dialogs now explain archive availability more clearly by distinguishing archive-ready programs from provider-level catch-up support and fully unavailable replay.- - `confirmed`: the guide side panel now also includes provider-source metadata and a provider troubleshooting card that explains replay template issues, missing stream ids, stale guide risk, and other provider-specific replay blockers more explicitly.- - `confirmed`: full-guide launches now preserve exact category, anchor-time, and favorites-only context into Player and can navigate back through the same guide route instead of dropping users into a generic guide state.- - `confirmed`: the program detail surface now exposes channel, provider, language, replay state, progress, stale-guide refresh, and nearby schedule context through a dedicated TV-style side panel instead of a thin alert dialog.- - Still incomplete: deeper archive reasoning is materially better now, but it is still bounded by provider metadata quality rather than guide-surface mechanics alone.-- Movies and Series browsing- - `confirmed`: rows, hero content, category rails, continue watching, and dialogs exist.- - `confirmed`: typed search path previously relied on extra UI-side filtering over full collections.- - `confirmed`: this pass moves typed query mode onto repository-backed search flows, shifts selected-category loading onto category-scoped repository queries, and changes all-library rows into preview shelves with accurate category counts instead of treating every category row as a full in-memory list.- - `confirmed`: Movies and Series now expose real `See All` actions per row, and selected-category views use dedicated full-list loads while all-category mode stays preview-oriented.- - `confirmed`: selected Movies and Series categories now expose visible filter and sort chips for favorites, resume/in-progress, unwatched or updated content, top-rated content, and ordering by library, title, freshness, or rating, but the UI now suppresses that control stack for very small non-saved categories where it was crowding out the actual titles.- - `confirmed`: selected Movies and Series categories now load in bounded pages with explicit `Load more` affordances and visible loaded-count feedback, so large provider categories no longer dump their full contents into the UI at once.- - `confirmed`: all-library mode now adds repository-backed lens rows for Favorites, Continue Watching, Top Rated, and Fresh content instead of relying only on broad category maps.- - `confirmed`: Movies and Series now expose a query-backed `Browse Full Library` mode from the all-library surface, so full-provider paging is no longer limited to category-specific views.- - Still incomplete: there is still no full-library section virtualization, no provider-scoped advanced sort/filter surface, and no repository-backed multi-facet retrieval model beyond the current lens layer, full-library browse mode, and selected-category view.-- Search- - `confirmed`: search results work and now launch player with correct context.- - `confirmed`: Search now keeps recent queries in reachable UI so repeat searches are faster on TV remotes.- - `confirmed`: Search now avoids blank result panes by surfacing explicit no-provider and minimum-query states, and the results side now exposes one-click content-type narrowing with visible counts.- - `confirmed`: Search now restores focus back to the main query field after PIN interruptions, which makes repeated TV search sessions less awkward.- - `confirmed`: Search now renders those empty and readiness states through the same elevated empty-state treatment instead of a plainer one-off layout, which improves consistency with the rest of the premium TV direction.- - Still incomplete: no top-level filter/sort presets, no provider scoping toggle, and no deeper power-user shortcuts beyond text entry, recent queries, and content-type narrowing.-- Catch-up / archive- - `confirmed`: program archive and restart actions exist.- - `confirmed`: the full guide now exposes a direct catch-up handoff into Player for archive-capable programs instead of only offering live-channel launch.- - `confirmed`: Player now surfaces explicit typed in-player recovery notices when catch-up context is missing or a provider does not return a replay stream, instead of failing silently.- - `confirmed`: the player diagnostics overlay now also carries provider/source, stream-class, playback state, archive support status, alternate-stream count, channel error history, last failure reason, recent recovery actions, and troubleshooting hints, so archive failures are not just raw error toasts anymore.- - `confirmed`: catch-up failure messages now distinguish between missing archive support, missing replay template, missing replay stream id, and provider replay rejection more clearly.- - `confirmed`: the live playback error surface now exposes a direct `Last Channel` recovery action alongside retry when a previous live channel exists, which is a more TV-native recovery path than forcing users to back out manually.- - `likely`: real-world provider reliability will still vary because catch-up templates/providers are messy and provider-specific degradation handling is still limited.- - Production-grade finish: provider-specific replay failure reasons and richer archive metadata.-- Home dashboard- - `confirmed`: Home is no longer just a hero plus static rows; it now exposes provider-health context directly and reorders its shelves around the current feature/action focus.- - `confirmed`: this makes the landing surface feel more responsive to actual user state instead of forcing one fixed rail order all the time.- - `confirmed`: Home now also surfaces active-provider warnings with a direct Settings drill-down instead of burying those issues only inside Settings.- - Still incomplete: no editorial curation and no user-configurable layout.-- Multiview- - `confirmed`: working slot playback exists.- - `confirmed`: the multiview screen now has focused-slot replace/remove actions plus audio pinning so users can keep one tile audible while moving focus elsewhere.- - `confirmed`: multiview now auto-detects a device performance tier, exposes a visible performance-mode selector, caps active simultaneous slots by policy, and holds extra slots in standby instead of trying to decode everything at once on weaker hardware.- - `confirmed`: multiview now samples live slot telemetry, exposes a visible runtime profiling summary, tracks dropped-frame/buffering/error pressure, and dynamically reduces active decoders when sustained load, memory pressure, or thermal status demand it.-- Provider diagnostics- - `confirmed`: Home already exposed warning and health surfacing, and Settings already had warning-driven retry actions.- - `confirmed`: this pass turns the provider card into a real diagnostics entry point with sync-domain timestamps, item counts, last sync status, provider source/expiry/connection/archive summaries, and provider capability notes.- - Still incomplete: no dedicated diagnostics route and no historical sync logs.-- Backup / restore- - `confirmed`: backup now carries expanded preferences, provider definitions, playback history, promoted groups, and multiview presets.- - `confirmed`: Settings now inspects a backup before import, shows section counts/conflicts, lets users choose keep-versus-replace behavior, and supports selective section import.- - Still incomplete: import reporting is still summary-level, not a detailed conflict-by-conflict report, and broader media/library validation is limited.- - Production-grade finish: add integrity reporting, richer skipped-item diagnostics, and clearer partial-restore messaging.--## D. Premium Gap Analysis-- What premium IPTV apps do better- - `confirmed`: they preserve playback context consistently across every launch path. StreamVault had gaps in Search and Favorites until this pass.- - `confirmed`: they make the guide actionable and central to Live TV, not a secondary placeholder screen.- - `likely`: they use stronger VOD/Series information architecture for huge libraries, often with faster facet/filter systems than StreamVault currently exposes.- - `likely`: they surface recent channels, better favorites/group workflows, and clearer provider health/troubleshooting.-- What this app still lacks- - External player support.- - Deeper full-guide personalization and overlays on top of the current timeline/return-context model.- - Unified multi-provider or merged-library workflows.- - A fuller recordings browser and more robust DVR scheduling lifecycle.-- Highest impact remaining changes- 1. Deepen Favorites into a stronger saved-library hub with better management presets and saved views.- 2. Extend recent channels into a stronger live-memory model anchored in Home and Player, not jammed into the Live TV browse header.- 3. Upgrade full-screen EPG from the current strong timeline surface into a more personalized and overlay-rich guide.- 4. Push Movies/Series from the current lens layer and selected-category paging into deeper repository-backed multi-facet retrieval and large-library virtualization.--## E. UI / UX Findings-- TV navigation issues- - `confirmed`: Search and Favorites player launches were missing context, which broke zap/EPG behavior from those entry points.- - `confirmed`: full-screen EPG row/program clicks were placeholders.-- Focus issues- - `confirmed`: many screens already manage focus well; Home and Player are stronger than average.- - `likely`: Search, Favorites, Settings, and Series detail still need a consistency pass to reach the same standard.-- Discoverability issues- - `confirmed`: custom groups, replay, diagnostics, and some long-press actions are more discoverable to expert users than first-time TV users.-- Visual hierarchy issues- - `confirmed`: Home/Player/Movies feel more premium than EPG/Favorites/Series detail.- - `confirmed`: some screens still use hardcoded or generic copy instead of a shared premium tone, though Settings is noticeably stronger after the overview/section polish pass.-- Workflow friction- - `confirmed`: recent-live browsing now lives in the Live TV category rail plus Player overlays, and Home now adds category-aware live shortcuts and a recent-channels row without polluting the Live TV browse screen.- - `confirmed`: favorites/group workflows are improved in the category rails users actually use, Movies/Series still expose saved shortcuts directly in the main browse surface with long-press management and inline saved-group context cards, Home now exposes a direct saved-library entry point, and the Saved Library route now also covers Continue Watching and Recent Live; Live TV was intentionally simplified after review so saved groups do not crowd the main browse area there.- - `confirmed`: the guide now behaves like a real aligned schedule surface with shared time markers, denser jump controls, and properly scaled program placement across rows, which is a major quality jump over the earlier pseudo-timeline list.- - `confirmed`: the guide now offers visible density/layout choices and full-window paging, so users can trade channel density against readability and move across broader time blocks without repetitive step-jumping.- - `confirmed`: Movies and Series now expose a visible Library Lens row in all-library mode, so Favorites, Continue Watching, Top Rated, and Fresh content are reachable without drilling into raw categories first.- - `confirmed`: Search no longer drops into a blank pane when prerequisites are missing, and result narrowing is now possible from the results side instead of forcing users back to the left-side tab chips only.- - `confirmed`: Settings now exposes a clearer top-level overview and section subtitles, so it reads more like a control center than a long undifferentiated list.- - `confirmed`: Settings now also gives the no-provider case a proper empty state instead of a bare line of copy, and Player overlays now explain the channel-list and mini-guide actions more clearly from within playback.-- Premium polish issues- - `confirmed`: loading/error/empty states are inconsistent.- - `likely`: transitions and screen-to-screen rhythm still need one dedicated polish pass.--## F. Performance & Reliability Findings-- Bottlenecks- - `confirmed`: Movies and Series were still doing redundant UI-side filtering for search.- - `confirmed`: full-library grouping for VOD/Series was too eager; this pass shifts selected-category loads to category-scoped repository queries and changes all-category browsing into lighter preview shelves.- - `confirmed`: selected provider-category views no longer need to load the entire category at once; they now use bounded page loads with explicit expansion.- - `likely`: full-screen EPG should stay bounded; the current pass limits guide loading to a visible subset for safety while rendering that window as a denser aligned grid.-- Risks- - `confirmed`: favorites/global routes had broken playback context before this pass.- - `confirmed`: live channel identity inside Player was going stale after zaps before this pass; that is now fixed.- - `likely`: current "all categories" VOD/Series presentations still scale worse than Live TV.- - `confirmed`: the app now contains runtime multiview telemetry and thermal/load guards, but `likely` lower-end Android TV hardware still needs manual profiling sessions to validate sustained behavior under real decoder, thermal, and memory pressure.-- Optimization opportunities- - Introduce richer image sizing/prefetch policies for posters/backdrops/logos.- - Add recent-query and cached-result layers for search.- - Consider a dedicated guide cache/view model for longer-range EPG timeline navigation.-- Scalability concerns- - `confirmed`: Live is still architecturally ahead of VOD/Series in large-library readiness, but the gap is smaller now that Movies/Series use preview shelves, category-scoped exact loads, bounded page loads, and repository-backed all-library lens rows.- - `likely`: 50k+ VOD/Series libraries will still need a deeper data-flow rewrite beyond this pass, especially for full-library paging, virtualization, and richer multi-facet retrieval across mixed provider/category surfaces.--## G. Missing Features Roadmap-### Core expected-- Merged-provider Saved Library behavior and final management polish- - User value: high- - UX impact: high- - Complexity: medium- - Effort: medium-- Deeper recent channels / live history workflows- - User value: high- - UX impact: high- - Complexity: medium- - Effort: medium-- Premium full-screen guide overlays and personalization- - User value: high- - UX impact: high- - Complexity: medium-high- - Effort: medium-large--### Premium-- Repository-backed full-library VOD/Series paging and deeper multi-facet retrieval- - User value: high- - UX impact: high- - Complexity: high- - Effort: medium-large-- Provider diagnostics and troubleshooting center- - User value: medium- - UX impact: medium- - Complexity: medium- - Effort: medium-- Backup/restore integrity reporting and detailed conflict diagnostics- - User value: medium- - UX impact: medium- - Complexity: medium- - Effort: medium--### Exceptional / differentiating-- Unified multi-provider merged library- - User value: high- - UX impact: high- - Complexity: high- - Effort: large-- Channel surfing memory model- - Notes: recent channels, smart last-groups, mini-guide recall, provider-aware history- - User value: high- - Effort: medium-- Advanced multiview control layer- - Notes: slot presets, audio pinning, quick replace/remove, and device-tier runtime resource profiles are now implemented; remaining gap is real-device tuning on weaker Android TV hardware.- - User value: medium-high- - Effort: medium-large-- DVR / recording- - Notes: local live DVR v1 now exists; remaining gap is a recordings browser, more robust scheduling lifecycle, and broader protocol/provider support- - User value: high- - Effort: large--## H. Changes Implemented-- `confirmed`: created session branch `session/premium-audit-2026-03-11`.-- `confirmed`: tightened the internal player launch contract by adding route helpers for Live, Movie, and Episode playback.-- `confirmed`: fixed Search player navigation so it now preserves `providerId`, `categoryId`, `internalId`, and content type.-- `confirmed`: fixed Favorites player navigation so live/movie launches retain provider and playback context instead of using `-1` fallbacks, including grouped-live playback context.-- `confirmed`: enriched `FavoriteUiModel` with provider/category/EPG context and launch metadata needed for correct playback behavior.-- `confirmed`: made full-screen EPG actionable by wiring channel launch and program detail dialog instead of leaving TODO click handlers.-- `confirmed`: upgraded full-screen EPG data loading from "now playing only" to a bounded schedule window per visible channel.-- `confirmed`: added Live category filtering to the full-screen EPG instead of always loading the first global channel slice.-- `confirmed`: added guide summary/status UI for channel coverage, last refresh timing, and stale-data warnings.-- `confirmed`: upgraded EPG empty/error states with retry actions and clearer no-provider/no-category feedback.-- `confirmed`: added visible guide time controls for jumping backward, jumping forward, returning to now, and moving to tomorrow.-- `confirmed`: added direct day-navigation controls to the TV Guide so users can move across dates without chaining repeated time-window jumps.-- `confirmed`: added a `Scheduled only` guide mode so large or messy provider guides can hide empty channels instead of mixing no-data rows into the main schedule view.-- `confirmed`: added guide-mode chips for full timeline browsing, anchor-time browsing, and archive-ready rows so the guide can pivot between broad exploration and IPTV-specific catch-up hunting.-- `confirmed`: added guide density/layout chips so users can switch between compact, comfortable, and larger-row guide presentations from the TV Guide itself.-- `confirmed`: added full-window guide paging actions so users can move across larger guide blocks without repeatedly stacking half-hour and three-hour jumps.-- `confirmed`: added a clear guide-window label so the EPG shows which time range is currently loaded.-- `confirmed`: added a visible timeline-style ruler to the TV Guide so the loaded window reads more like a real guide surface instead of a plain list of program cards.-- `confirmed`: added live progress treatment to currently airing guide cards, including progress bars and remaining-time labels.-- `confirmed`: upgraded the full-screen guide into an aligned timeline grid with shared half-hour markers, a persistent current-time line, and time-scaled program placement across channel rows.-- `confirmed`: added denser guide time navigation with half-hour jumps and a direct `Prime Time` jump alongside the existing day/window controls.-- `confirmed`: added archive-ready program labeling inside the full guide so catch-up-capable entries are visually distinct without opening Player first.-- `confirmed`: persisted TV Guide density, mode, favorite-channel-only filtering, and anchor-time defaults so the guide reopens in the user’s last working state instead of resetting each session.-- `confirmed`: added a favorite-channel-only guide source filter so the full guide can collapse down to pinned live channels without changing categories.-- `confirmed`: extended the full-guide navigation contract so guide category, anchor time, and favorites-only state can be passed through player launches as an exact return route.-- `confirmed`: moved Movies and Series typed search mode onto repository-backed search flows instead of re-filtering the full in-memory list.-- `confirmed`: added repository-backed preview queries and count flows for Movies and Series so all-library browsing can stay preview-oriented while selected categories load their full contents on demand.-- `confirmed`: moved Movies and Series selected-category views onto dedicated category-scoped repository loading instead of relying on the all-library grouped map as the working dataset.-- `confirmed`: turned Movies and Series category rows into true preview shelves with actionable `See All` controls and accurate category/library counts.-- `confirmed`: added repository-backed page loading for selected provider categories in Movies and Series, plus visible `Loaded X of Y` feedback and `Load more` actions on the grid surfaces.-- `confirmed`: introduced explicit `LibraryBrowseQuery` and `PagedResult` contracts plus repository-backed browse methods for Movies and Series so category paging is no longer just a UI convention.-- `confirmed`: added a visible query-backed `Browse Full Library` mode to Movies and Series so users can page through the full provider catalog without drilling into categories first.-- `confirmed`: added recent-search shortcuts and clear-history controls to the Search screen so repeat searches are reachable without retyping.-- `confirmed`: added SearchViewModel coverage for recent-query history behavior.-- `confirmed`: upgraded Search empty-state behavior so it now shows explicit no-provider, ready-to-search, and no-results messaging instead of leaving the results pane visually blank.-- `confirmed`: added results-summary chips to Search so users can narrow to Live TV, Movies, or Series directly from the results side with visible counts.-- `confirmed`: added SearchViewModel coverage for provider/query readiness state under the debounced search flow.-- `confirmed`: upgraded Settings with a top-level overview card, section subtitles, and cleaner provider warning/status copy so the screen feels more deliberate and TV-native.-- `confirmed`: upgraded Settings provider cards into a real diagnostics surface with per-domain sync timestamps and counts, last sync status, capability summaries, and the existing retry actions in one place.-- `confirmed`: reduced a broad hero selection flattening path in Movies to a first-item-per-category scan.-- `confirmed`: added a shared virtual-category contract for Favorites and Recent channels.-- `confirmed`: rebuilt the Favorites screen into real saved-library sections: global favorites plus populated Live/Movie/Series custom groups.-- `confirmed`: added section-scoped reorder behavior in Favorites instead of global flat-list reorder only.-- `confirmed`: turned the standalone Saved Library route into a real hub with overview stats, type filters, and section-jump chips now that Home exposes it.-- `confirmed`: expanded the Saved Library hub with Continue Watching and Recent Live rows so the route now unifies saved items with playback recall workflows instead of only listing favorites/groups.-- `confirmed`: added Saved Library sort presets for manual order, recent activity, and alphabetical browsing without breaking the existing manual reorder flow.-- `confirmed`: tied Saved Library recent sorting to playback-history activity so the new sort presets reflect actual use instead of static metadata.-- `confirmed`: added higher-level Saved Library preset views for `All Saved`, `Watch Next`, `Live Recall`, Movies, Series, and Custom Groups so the hub now behaves more like a recall dashboard than a flat saved list.-- `confirmed`: added a managed custom-groups row to the Saved Library hub with direct long-press actions for merge, delete, reorder, and Home promotion, plus item-level remove and move-between-group actions without leaving the hub.-- `confirmed`: changed Saved Library group clicks to jump within the hub itself instead of bouncing users out to other top-level screens, keeping the route as the canonical cross-type management surface.-- `confirmed`: added provider scoping inside the Saved Library hub so users can switch between current-provider and all-provider saved/history views without leaving the screen.-- `confirmed`: added a dedicated `Home Shelf` saved preset so promoted live groups and dashboard-eligible live favorites can be reviewed and managed intentionally.-- `confirmed`: added recent-live history recording and surfaced it as a Live TV virtual category with proper playlist/zap context.-- `confirmed`: made the Live TV `Recent` category permanently visible in the sidebar, even when empty, so the feature is discoverable from reachable UI.-- `confirmed`: added provider-scoped `Last Group` memory for Live TV and Player, then intentionally removed the extra Live TV header shortcuts after review so the browse screen is no longer acting like a cluttered pseudo-home.-- `confirmed`: surfaced recent live channels inside Player via a visible quick action and a recent row in the channel list overlay.-- `confirmed`: surfaced the remembered live `Last Group` inside Player through both the live info overlay and the channel-list header, so browsing memory carries into playback UI too.-- `confirmed`: updated Player state on channel changes so live playback context, title, and URL do not go stale after zapping.-- `confirmed`: fixed the Player channel-list selection highlight so it tracks the currently tuned channel instead of the original route channel ID after zapping.-- `confirmed`: added a non-resume playback history write path for live sessions while keeping VOD resume writes separate.-- `confirmed`: filtered Movies and Series continue-watching rows so newly recorded live history does not pollute VOD surfaces.-- `confirmed`: added custom-group rename/manage actions directly to Movies and Series category sidebars instead of treating the standalone Favorites route as the primary workflow.-- `confirmed`: added the same custom-group rename flow to the reachable Live TV category rail for parity with Movies and Series.-- `confirmed`: fixed custom-group rename persistence so Movies, Series, and Live TV now map virtual category IDs back to the real stored group IDs before renaming.-- `confirmed`: kept the built-in `Favorites` bucket fixed/reserved and limited rename management to true custom groups.-- `confirmed`: added visible snackbar feedback for Movies and Series group create/rename/delete actions.-- `confirmed`: replaced more hardcoded Movies/Series category sidebar copy with string resources.-- `confirmed`: removed a broad `flatten()` hero-pick path in Series in favor of the same first-item-per-category scan used in Movies.-- `confirmed`: added reachable saved-shortcuts strips to the Movies and Series main browse surfaces so Favorites and populated custom groups are one-click targets instead of being buried only in the sidebar.-- `confirmed`: added empty-state guidance to those saved-shortcut strips so users can tell how to populate saved items before the shortcuts appear.-- `confirmed`: fixed Movie/Series saved shortcut construction so `Favorites` is no longer duplicated, empty groups are filtered out, and an explicit `Browse All` shortcut is available from the same strip.-- `confirmed`: kept the saved shortcut strips visible in saved-category Movies/Series views so switching between Favorites, custom groups, and the full library no longer depends on going back to the sidebar, while normal provider categories stay visually cleaner.-- `confirmed`: added direct long-press management from saved shortcut cards in Movies and Series, plus an on-screen hint so saved groups are not browse-only shortcuts anymore.-- `confirmed`: added inline saved-group context cards to selected Movies and Series saved views with direct `Manage` and `Browse All` actions plus visible item counts.-- `confirmed`: added category-scoped Movies and Series facet/sort chips so users can narrow selected categories by favorites, resume state, unwatched or updated content, and rating without forcing a full-library load.-- `confirmed`: trimmed the selected-category VOD/Series chrome so normal provider categories no longer show the full Saved block, and small categories now skip the bulky facet/sort stack that was pushing the actual titles off-screen.-- `confirmed`: added repository-backed all-library Library Lens rows to Movies and Series for Favorites, Continue Watching, Top Rated, and Fresh content so premium discovery is no longer limited to raw category rails.-- `confirmed`: created a real dashboard-style Home screen and split Live TV into its own dedicated top-level route instead of using the Live browser as the landing page.-- `confirmed`: expanded Home into a richer landing surface with featured hero state, library stats, live shortcut cards, recent live channels, and category-aware deep links back into Live TV groups.-- `confirmed`: added provider-health surfacing to Home so the dashboard now exposes provider status, source type, sync recency, expiry context, and connection count without sending users into Settings first.-- `confirmed`: made Home shelf ordering more adaptive by biasing the row order toward the current hero/feature context instead of leaving the dashboard static.-- `confirmed`: added provider-warning surfacing on Home with a direct Settings drill-down so partial sync issues are visible from the landing surface.-- `confirmed`: reinforced Home-to-diagnostics flow by making the provider-health card itself expose the diagnostics drill-down action instead of relying only on warning states.-- `confirmed`: extended the player route contract with optional archive-window parameters so the full TV Guide can launch directly into catch-up playback.-- `confirmed`: added a full-guide `Play Catch-up` action for archive-capable programs instead of limiting program dialogs to live-channel launch only.-- `confirmed`: added an in-player archive failure notice so missing catch-up URLs or invalid replay context are surfaced to the user instead of failing silently.-- `confirmed`: added favorite-channel badging directly inside the guide grid and upgraded the program dialog with provider-level archive hints plus stale-guide replay caveats so archive-heavy browsing gives clearer context before playback starts.-- `confirmed`: added a direct saved-library entry point from Home and promoted the standalone Favorites route into an actual reachable product surface instead of leaving it effectively hidden.-- `confirmed`: simplified the Live TV browse surface by removing the added saved/recent/last-group shortcut strip from the content area.-- `confirmed`: added category-aware `Live TV` route deep links so Home shortcuts can open Favorites, Recent, Last Group, and custom live groups directly instead of always landing on the generic Live view.-- `confirmed`: fixed focus restoration after closing category/group option dialogs so the previously focused group stays active in Live TV, Movies, and Series.-- `confirmed`: fixed category reorder targeting so Live TV, Movies, and Series now reorder the long-pressed saved category instead of the currently open category or a partial preview list.-- `confirmed`: replaced the inline custom-group creation mode inside the add-to-group dialog with a dedicated create-group dialog to reduce keyboard/back-flow conflicts.-- `confirmed`: removed nested-dialog stacking during group creation so the Add-to-Group sheet now yields to dedicated create/split dialogs instead of keeping multiple active dialog layers alive under the TV keyboard.-- `confirmed`: tightened Create Group dialog behavior by trimming names, disabling empty confirmation, and hiding the software keyboard on confirm/dismiss.-- `confirmed`: tightened PIN dialog behavior by showing the numeric keyboard on entry and hiding it on submit/dismiss so TV modal transitions leave less keyboard residue behind.-- `confirmed`: restored Search focus to the main query field on entry and after PIN dismissal so repeated search/refine flows behave more like a TV-native search surface.-- `confirmed`: upgraded the player error surface with an explicit `Last Channel` recovery action for live playback instead of leaving recovery at `Retry` plus a passive back hint only.-- `confirmed`: replaced plain player notice strings with typed recovery notices that can expose `Retry`, `Alternate Stream`, `Last Channel`, and `Open Guide` actions directly from the playback surface.-- `confirmed`: added session-level alternate-stream failure memory so the player deprioritizes already-failed alternates during the same viewing session before surfacing fallback actions.-- `confirmed`: expanded the in-player diagnostics overlay with provider/source, decoder mode, stream class, playback state, archive support, alternate-stream count, channel error history, last failure reason, recovery actions, and troubleshooting hints so the player now shows actual troubleshooting context instead of only raw codec/bitrate stats.-- `confirmed`: added exact guide-return behavior from player notices so `Open Guide` can navigate back to the originating full-guide route instead of only opening a generic overlay.-- `confirmed`: replaced the old guide alert dialog with a TV-style program side panel that adds provider/channel/language/replay/progress metadata, nearby schedule context, and a direct stale-guide refresh action.-- `confirmed`: updated Player back behavior so transient player notices dismiss before playback exits, which makes the overlay stack feel less abrupt on the remote.-- `confirmed`: added clearer inline guidance to the Player channel list and mini-guide overlays, and upgraded the Settings no-provider surface to the same elevated empty-state treatment used elsewhere.-- `confirmed`: added multiview presets backed by preferences so common split-screen slot layouts can be saved and restored.-- `confirmed`: added focused-slot multiview controls for replace, remove, and audio pinning, so split-screen management no longer depends only on the planner dialog or focus-follow audio.-- `confirmed`: added a device-tier multiview performance policy with persisted Auto / Conservative / Balanced / Maximum modes, effective active-slot caps, staged decoder startup, and standby messaging for slots held back on weaker devices.-- `confirmed`: added telemetry-backed multiview protection with dropped-frame/buffering/error sampling, runtime profiling summaries, low-memory standby handling, and thermal-aware slot throttling on supported Android TV versions.-- `confirmed`: expanded Settings provider diagnostics with source, expiry, connection, and archive summaries instead of only capability text plus sync counts.-- `confirmed`: expanded the guide side panel with provider-specific replay troubleshooting so catch-up blockers like missing templates, missing replay stream ids, and stale guide risk are explained in-place.-- `confirmed`: upgraded catch-up failure reasoning in Player so replay errors describe the likely provider-side blocker instead of collapsing into one generic replay failure message.-- `confirmed`: expanded backup/restore into version 2 data bundles that now include providers, playback history, promoted live groups, guide preferences, and multiview presets.-- `confirmed`: upgraded Settings backup import into a real preview/conflict flow with section counts, conflict counts, keep-vs-replace strategy, and per-section import toggles before applying a restore.-- `confirmed`: wired the existing recording manager into DI and shipped local live DVR v1 with manual recording, scheduled recording, storage state, persisted recording jobs, and stop/cancel actions.-- `confirmed`: added reachable DVR UI in Player for `Record`, `Stop Recording`, and `Schedule`, and added a Settings recording section that surfaces storage health, active jobs, scheduled jobs, and failure reasons.-- `confirmed`: added navigation contract tests for Live/Movie/Episode routes.-- `confirmed`: added route tests covering full-guide route context and player return-route preservation.-- `confirmed`: added HomeViewModel coverage for the new recent-live virtual category behavior, including empty-history visibility.-- `confirmed`: `./gradlew test` passes after the changes.--## I. Recommended Next Roadmap-1. Quick wins- - Refine the new Home dashboard with deeper personalization on top of the new hero/health/warning/shortcut structure.- - Tighten Saved Library policy controls beyond provider scoping and Home promotion.-2. Medium effort / high value- - Move Movies/Series from the current browse-query foundation and selected-category paging into repository-backed multi-facet retrieval and deeper full-library paging.- - Deeper Settings reorganization around Provider, Playback, Library, and Privacy beyond the new overview/section polish.- - Stronger Search UX with saved queries and result shortcuts.- - Expand the typed player recovery model into a fuller diagnostics and recovery panel with deeper provider-account troubleshooting context.-3. Major premium upgrades- - DVR recordings browser plus stronger scheduling lifecycle beyond in-app state.- - Backup/restore integrity reporting and conflict-by-conflict diagnostics.- - Advanced archive overlays and personalization on top of the new aligned timeline grid.-4. Standout differentiators- - Manual multiview profiling and tuning on real lower-end Android TV hardware now that the in-app telemetry/protection layer exists.- - Unified multi-provider browsing.- - Live-TV surfer mode with recent-channel intelligence and ultra-fast recall.diff --git a/docs/qa/ANDROID_TV_FINAL_CERTIFICATION.md b/docs/qa/ANDROID_TV_FINAL_CERTIFICATION.mdnew file mode 100644index 00000000..128d63b5--- /dev/null+++ b/docs/qa/ANDROID_TV_FINAL_CERTIFICATION.md@@ -0,0 +1,113 @@+# Android TV Final Certification Checklist++Date: 2026-03-12+Branch: `ui-change`+Build under test: `appDebug`++## Severity+- `ship blocker`: must be fixed before release+- `polish defect`: should be fixed before release unless explicitly waived+- `minor follow-up`: acceptable for post-release follow-up++## Environment+- Device:+- Android TV version:+- Input device:+- Build fingerprint:+- Tester:++## Global Checks+- [ ] App launches without layout jumps or placeholder flashes.+- [ ] Initial focus is visible on every major route.+- [ ] `Back` behavior is deterministic and never traps focus.+- [ ] Focus is restored after dialogs and sheets close.+- [ ] Focus ring, text size, and contrast are readable from TV distance.+- [ ] No clipped titles, buttons, or badges on 1080p and 4K outputs.+- [ ] RTL layout mirrors rails, overlays, and aligned metadata correctly.+- [ ] Search fields behave correctly with remote and soft keyboard input.++## Welcome And Onboarding+- [ ] Welcome screen first focus lands on the primary onboarding action.+- [ ] Provider setup is fully navigable with remote only.+- [ ] Xtream and playlist flows preserve validation and error messaging.+- [ ] Long forms do not lose focus when validation errors appear.++## Dashboard+- [ ] Hero, shortcuts, continue-watching, and provider health are all reachable by D-pad.+- [ ] Shelf-to-shelf traversal does not skip or trap focus.+- [ ] Provider health messaging remains readable at TV distance.++## Live TV+- [ ] Category rail initial focus is correct.+- [ ] Rail-to-channel-pane crossing is stable in both directions.+- [ ] Large channel lists remain smooth while scrolling.+- [ ] Channel search and category search both preserve focus correctly.+- [ ] Reorder mode is remote-friendly and exits cleanly with `Back`.+- [ ] Group rename/delete flows restore focus to the triggering item.+- [ ] Multiview entry works from live browse and returns cleanly.+- [ ] Locked channels clearly communicate protected state.++## Movies And Series+- [ ] Landing state is navigable without hidden focus jumps.+- [ ] Category selection enters the paged grid correctly.+- [ ] `Back` exits selected-category browse before leaving the route.+- [ ] Load-more behavior remains correct and focusable.+- [ ] Long-press actions still work on posters and shortcuts.+- [ ] Locked titles remain readable and visually distinct.++## Series Detail+- [ ] Hero CTA, season rail, and episodes are all reachable by remote only.+- [ ] Season changes keep focus in a predictable place.+- [ ] Episode rows preserve hierarchy and readable metadata.++## Saved+- [ ] Preset chips, provider scope, and grouped shelves are all reachable.+- [ ] Manage or reorder mode is visually distinct from browse mode.+- [ ] Continue-watching and live recall sections keep consistent focus styling.++## Guide+- [ ] Filter strip, timeline grid, and details panel all have deterministic focus.+- [ ] Focused program details always match the selected program cell.+- [ ] Archive-ready states are clearly communicated.+- [ ] Timeline scrolling remains performant on dense schedules.++## Settings And Parental Controls+- [ ] Provider cards, diagnostics, and management actions are all reachable.+- [ ] Backup and restore actions are understandable without pointer input.+- [ ] Parental group management keeps correct focus after PIN or dialog dismissal.++## Player+- [ ] Controls open with the intended primary focus target.+- [ ] Transport, quick actions, and side overlays feel like one system.+- [ ] Channel list overlay restores focus when reopened.+- [ ] Guide and info overlays close in the correct `Back` order.+- [ ] Track selection dialog and diagnostics sheet are fully remote-operable.+- [ ] Resume prompt, numeric channel input, and error notices render cleanly.+- [ ] Live playback, VOD playback, and archive playback all preserve the same control language.++## Large Library Validation+- [ ] Live browse remains responsive with representative 50k-100k channel data.+- [ ] Movie browse remains on the paged library path under large datasets.+- [ ] Series browse remains on the paged library path under large datasets.+- [ ] No route shows whole-list loading or focus lag under large datasets.++## Findings+| Area | Severity | Result | Notes |+| --- | --- | --- | --- |+| Welcome | | | |+| Dashboard | | | |+| Live TV | | | |+| Movies | | | |+| Series | | | |+| Series Detail | | | |+| Saved | | | |+| Guide | | | |+| Settings | | | |+| Player | | | |+| RTL | | | |+| Accessibility | | | |++## Sign-Off+- [ ] No unresolved ship blockers remain.+- [ ] All polish defects are fixed or explicitly waived.+- [ ] Final build/test bar has been re-run after the last fix.diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex cea3e7b6..03f1ea19 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -24,6 +24,8 @@ junit = "4.13.2"truth = "1.4.4"kxml2 = "2.3.0"mockito-kotlin = "5.4.0"+androidx-test-ext-junit = "1.2.1"+espresso = "3.6.1"[libraries]# Compose BOM@@ -94,6 +96,8 @@ truth = { group = "com.google.truth", name = "truth", version.ref = "truth" }coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }kxml2 = { group = "net.sf.kxml", name = "kxml2", version.ref = "kxml2" }mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version.ref = "mockito-kotlin" }+androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }+espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso" }[plugins]android-application = { id = "com.android.application", version.ref = "agp" }