StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
feat: add selectable app themes
David Nashasheda63878c45d
diff --git a/app/src/main/java/com/streamvault/app/MainActivity.kt b/app/src/main/java/com/streamvault/app/MainActivity.ktindex db107adb..5e92150a 100644--- a/app/src/main/java/com/streamvault/app/MainActivity.kt+++ b/app/src/main/java/com/streamvault/app/MainActivity.kt@@ -26,6 +26,7 @@ import com.streamvault.app.ui.time.toUiTimeFormatimport com.streamvault.feature.live.presentation.time.LocalLiveTimeFormatimport com.streamvault.core.ui.time.LocalUiTimeFormatimport com.streamvault.domain.repository.ProviderRepository+import com.streamvault.domain.model.AppThemeimport dagger.hilt.android.AndroidEntryPointimport javax.inject.Inject@@ -192,6 +193,7 @@ class MainActivity : ComponentActivity(), CatalogPlatformHost {setContent {val appLanguage by preferencesRepository.appLanguage.collectAsState(initial = "system")val appTimeFormat by preferencesRepository.appTimeFormat.collectAsState(initial = com.streamvault.domain.model.AppTimeFormat.SYSTEM)+ val appTheme by preferencesRepository.appTheme.collectAsState(initial = AppTheme.DEFAULT)val databaseStartupState by databaseStartupCoordinator.state.collectAsState()val currentContext = LocalContext.current@@ -236,7 +238,7 @@ class MainActivity : ComponentActivity(), CatalogPlatformHost {LocalLiveTimeFormat provides appTimeFormat,LocalUiTimeFormat provides appTimeFormat.toUiTimeFormat()) {- StreamVaultTheme {+ StreamVaultTheme(themeId = appTheme.storageValue) {when (val state = databaseStartupState) {DatabaseStartupState.Opening -> DatabaseStartupScreen(state = state)is DatabaseStartupState.Failed -> DatabaseStartupScreen(diff --git a/app/src/main/java/com/streamvault/app/tvinput/TvInputSetupActivity.kt b/app/src/main/java/com/streamvault/app/tvinput/TvInputSetupActivity.ktindex deb81da1..782a2e61 100644--- a/app/src/main/java/com/streamvault/app/tvinput/TvInputSetupActivity.kt+++ b/app/src/main/java/com/streamvault/app/tvinput/TvInputSetupActivity.kt@@ -46,7 +46,9 @@ import com.streamvault.core.ui.theme.Primaryimport com.streamvault.core.ui.theme.StreamVaultThemeimport com.streamvault.core.ui.theme.SurfaceElevatedimport com.streamvault.domain.model.LegacyProvider as Provider+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.repository.ProviderRepository+import com.streamvault.data.preferences.PreferencesRepositoryimport dagger.hilt.android.AndroidEntryPointimport dagger.hilt.android.lifecycle.HiltViewModelimport javax.inject.Inject@@ -59,6 +61,9 @@ import kotlinx.coroutines.launch@AndroidEntryPointclass TvInputSetupActivity : ComponentActivity() {+ @Inject+ lateinit var preferencesRepository: PreferencesRepository+private val viewModel: TvInputSetupViewModel by viewModels()override fun onCreate(savedInstanceState: Bundle?) {@@ -67,7 +72,8 @@ class TvInputSetupActivity : ComponentActivity() {?: ComponentName(this, StreamVaultTvInputService::class.java).flattenToShortString()viewModel.startSetup(inputId)setContent {- StreamVaultTheme {+ val appTheme by preferencesRepository.appTheme.collectAsStateWithLifecycle(initialValue = AppTheme.DEFAULT)+ StreamVaultTheme(themeId = appTheme.storageValue) {TvInputSetupRoute(onOpenProviderSetup = {startActivity(diff --git a/core/ui/src/main/java/com/streamvault/core/ui/design/AppColors.kt b/core/ui/src/main/java/com/streamvault/core/ui/design/AppColors.ktindex c0826450..bbfb54bd 100644--- a/core/ui/src/main/java/com/streamvault/core/ui/design/AppColors.kt+++ b/core/ui/src/main/java/com/streamvault/core/ui/design/AppColors.kt@@ -1,33 +1,50 @@package com.streamvault.core.ui.design+import androidx.compose.runtime.MutableState+import androidx.compose.runtime.mutableStateOfimport androidx.compose.ui.graphics.Color+/**+ * State-backed compatibility facade for the shared app palette.+ *+ * Existing UI components can keep using named colors while Compose observes+ * palette changes made by the single application theme root.+ */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)+ private val activeState: MutableState<AppPalette> = mutableStateOf(AppPalette.classicBlue())++ var current: AppPalette+ get() = activeState.value+ set(value) {+ activeState.value = value+ }++ val Canvas: Color get() = current.canvas+ val CanvasElevated: Color get() = current.canvasElevated+ val Surface: Color get() = current.surface+ val SurfaceElevated: Color get() = current.surfaceElevated+ val SurfaceEmphasis: Color get() = current.surfaceEmphasis+ val SurfaceAccent: Color get() = current.surfaceAccent++ val Brand: Color get() = current.brand+ val BrandMuted: Color get() = current.brandMuted+ val BrandStrong: Color get() = current.brandStrong+ val OnPrimary: Color get() = current.onPrimary+ val Focus: Color get() = current.focus++ val TextPrimary: Color get() = current.textPrimary+ val TextSecondary: Color get() = current.textSecondary+ val TextTertiary: Color get() = current.textTertiary+ val TextDisabled: Color get() = current.textDisabled++ val Live: Color get() = current.live+ val Success: Color get() = current.success+ val Warning: Color get() = current.warning+ val Info: Color get() = current.info++ val Divider: Color get() = current.divider+ val Outline: Color get() = current.outline++ val HeroTop: Color get() = current.heroTop+ val HeroBottom: Color get() = current.heroBottom}diff --git a/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt b/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.ktnew file mode 100644index 00000000..bab5c61a--- /dev/null+++ b/core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt@@ -0,0 +1,92 @@+package com.streamvault.core.ui.design++import androidx.compose.ui.graphics.Color++/** Complete color palette for one selectable application theme. */+data class AppPalette(+ val canvas: Color,+ val canvasElevated: Color,+ val surface: Color,+ val surfaceElevated: Color,+ val surfaceEmphasis: Color,+ val surfaceAccent: Color,+ val brand: Color,+ val brandMuted: Color,+ val brandStrong: Color,+ val onPrimary: Color,+ val focus: Color,+ val textPrimary: Color,+ val textSecondary: Color,+ val textTertiary: Color,+ val textDisabled: Color,+ val live: Color,+ val success: Color,+ val warning: Color,+ val info: Color,+ val divider: Color,+ val outline: Color,+ val heroTop: Color,+ val heroBottom: Color+) {+ companion object {+ const val CLASSIC_BLUE_ID = "classic_blue"+ const val M3_PURPLE_ID = "m3_purple"++ fun forTheme(themeId: String?): AppPalette = when (themeId?.trim()?.lowercase()) {+ M3_PURPLE_ID -> m3Purple()+ else -> classicBlue()+ }++ fun classicBlue(): AppPalette = AppPalette(+ canvas = Color(0xFF07111B),+ canvasElevated = Color(0xFF0B1622),+ surface = Color(0xFF0F1B29),+ surfaceElevated = Color(0xFF162338),+ surfaceEmphasis = Color(0xFF1D2E46),+ surfaceAccent = Color(0xFF223754),+ brand = Color(0xFF69A8FF),+ brandMuted = Color(0x335FA4FF),+ brandStrong = Color(0xFF8BBCFF),+ onPrimary = Color.White,+ focus = Color(0xFFF4F8FF),+ textPrimary = Color(0xFFF5F7FB),+ textSecondary = Color(0xFFBBC6D8),+ textTertiary = Color(0xFF7F8DA5),+ textDisabled = Color(0xFF566173),+ live = Color(0xFFFF5C61),+ success = Color(0xFF4FD39A),+ warning = Color(0xFFFFC766),+ info = Color(0xFF57C9FF),+ divider = Color(0x1AF4F8FF),+ outline = Color(0x264C6D95),+ heroTop = Color(0xCC07111B),+ heroBottom = Color(0xF207111B)+ )++ fun m3Purple(): AppPalette = AppPalette(+ canvas = Color(0xFF0A0A0D),+ canvasElevated = Color(0xFF0E0E12),+ surface = Color(0xFF141419),+ surfaceElevated = Color(0xFF1B1B21),+ surfaceEmphasis = Color(0xFF232329),+ surfaceAccent = Color(0xFF2A2A31),+ brand = Color(0xFFD0BCFF),+ brandMuted = Color(0x33D0BCFF),+ brandStrong = Color(0xFFEADDFF),+ onPrimary = Color(0xFF381E72),+ focus = Color(0xFF8A8A92),+ textPrimary = Color(0xFFF5F7FB),+ textSecondary = Color(0xFFC2C2C8),+ textTertiary = Color(0xFF8A8A92),+ textDisabled = Color(0xFF606068),+ live = Color(0xFFFF5C61),+ success = Color(0xFF4FD39A),+ warning = Color(0xFFFFC766),+ info = Color(0xFF57C9FF),+ divider = Color(0x1AF4F8FF),+ outline = Color(0x26FFFFFF),+ heroTop = Color(0xCC0A0A0D),+ heroBottom = Color(0xF20A0A0D)+ )+ }+}diff --git a/core/ui/src/main/java/com/streamvault/core/ui/theme/Color.kt b/core/ui/src/main/java/com/streamvault/core/ui/theme/Color.ktindex 166362bb..2b7ade7d 100644--- a/core/ui/src/main/java/com/streamvault/core/ui/theme/Color.kt+++ b/core/ui/src/main/java/com/streamvault/core/ui/theme/Color.kt@@ -1,38 +1,37 @@package com.streamvault.core.ui.theme-import androidx.compose.ui.graphics.Colorimport com.streamvault.core.ui.design.AppColors-val Primary = AppColors.Brand-val PrimaryLight = AppColors.BrandStrong-val PrimaryGlow = AppColors.BrandMuted+val Primary get() = AppColors.Brand+val PrimaryLight get() = AppColors.BrandStrong+val PrimaryGlow get() = AppColors.BrandMuted-val BackgroundDeep = AppColors.Canvas-val Background = AppColors.CanvasElevated-val Surface = AppColors.Surface-val SurfaceElevated = AppColors.SurfaceElevated-val SurfaceHighlight = AppColors.SurfaceEmphasis+val BackgroundDeep get() = AppColors.Canvas+val Background get() = AppColors.CanvasElevated+val Surface get() = AppColors.Surface+val SurfaceElevated get() = AppColors.SurfaceElevated+val SurfaceHighlight get() = AppColors.SurfaceEmphasis-val TextPrimary = AppColors.TextPrimary-val TextSecondary = AppColors.TextSecondary-val TextTertiary = AppColors.TextTertiary-val TextDisabled = AppColors.TextDisabled+val TextPrimary get() = AppColors.TextPrimary+val TextSecondary get() = AppColors.TextSecondary+val TextTertiary get() = AppColors.TextTertiary+val TextDisabled get() = AppColors.TextDisabled-val OnBackground = TextPrimary-val OnSurface = TextPrimary-val OnSurfaceDim = TextTertiary+val OnBackground get() = TextPrimary+val OnSurface get() = TextPrimary+val OnSurfaceDim get() = TextTertiary-val AccentRed = AppColors.Live-val AccentGreen = AppColors.Success-val AccentAmber = AppColors.Warning-val AccentCyan = AppColors.Info+val AccentRed get() = AppColors.Live+val AccentGreen get() = AppColors.Success+val AccentAmber get() = AppColors.Warning+val AccentCyan get() = AppColors.Info-val OnPrimary = Color(0xFFFFFFFF)-val Secondary = AppColors.Success-val ErrorColor = AccentRed+val OnPrimary get() = AppColors.OnPrimary+val Secondary get() = AppColors.Success+val ErrorColor get() = AccentRed-val GradientOverlayTop = AppColors.HeroTop-val GradientOverlayBottom = AppColors.HeroBottom+val GradientOverlayTop get() = AppColors.HeroTop+val GradientOverlayBottom get() = AppColors.HeroBottom-val FocusBorder = AppColors.Focus-val ProgressBarBackground = AppColors.SurfaceAccent+val FocusBorder get() = AppColors.Focus+val ProgressBarBackground get() = AppColors.SurfaceAccentdiff --git a/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt b/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.ktindex ddc05268..6d196b90 100644--- a/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt+++ b/core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt@@ -2,36 +2,50 @@ package com.streamvault.core.ui.themeimport androidx.compose.runtime.Composableimport androidx.compose.runtime.CompositionLocalProvider+import androidx.compose.runtime.SideEffect+import androidx.compose.ui.graphics.Colorimport androidx.tv.material3.MaterialThemeimport androidx.tv.material3.darkColorSchemeimport com.streamvault.core.ui.design.AppColors+import com.streamvault.core.ui.design.AppPaletteimport com.streamvault.core.ui.design.AppShapesimport com.streamvault.core.ui.design.LocalAppShapesimport com.streamvault.core.ui.design.LocalAppSpacingimport com.streamvault.core.ui.design.rememberAppTypography-private val DarkColorScheme = darkColorScheme(- primary = AppColors.Brand,- onPrimary = OnPrimary,- surface = AppColors.Surface,- onSurface = AppColors.TextPrimary,- surfaceVariant = AppColors.SurfaceElevated,- onSurfaceVariant = AppColors.TextSecondary,- background = AppColors.CanvasElevated,- onBackground = AppColors.TextPrimary,- error = AppColors.Live,- onError = OnPrimary-)-@Composable-fun StreamVaultTheme(content: @Composable () -> Unit) {+fun StreamVaultTheme(+ themeId: String = AppPalette.CLASSIC_BLUE_ID,+ content: @Composable () -> Unit+) {+ val palette = AppPalette.forTheme(themeId)val typography = rememberAppTypography()+ SideEffect {+ AppColors.current = palette+ }CompositionLocalProvider(LocalAppSpacing provides com.streamvault.core.ui.design.AppSpacing(),LocalAppShapes provides AppShapes()) {MaterialTheme(- colorScheme = DarkColorScheme,+ colorScheme = darkColorScheme(+ primary = palette.brand,+ onPrimary = palette.onPrimary,+ secondary = palette.success,+ onSecondary = Color(0xFF003320),+ tertiary = palette.info,+ onTertiary = Color(0xFF00344A),+ surface = palette.surface,+ onSurface = palette.textPrimary,+ surfaceVariant = palette.surfaceElevated,+ onSurfaceVariant = palette.textSecondary,+ background = palette.canvasElevated,+ onBackground = palette.textPrimary,+ error = palette.live,+ onError = palette.onPrimary,+ errorContainer = palette.live.copy(alpha = 0.20f),+ onErrorContainer = Color(0xFFFFDCDE)+ ),typography = typography,content = content)diff --git a/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt b/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.ktnew file mode 100644index 00000000..90905c74--- /dev/null+++ b/core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt@@ -0,0 +1,34 @@+package com.streamvault.core.ui.design++import androidx.compose.ui.graphics.Color+import com.google.common.truth.Truth.assertThat+import org.junit.Test++class AppPaletteTest {++ @Test+ fun `classic blue preserves the existing palette`() {+ val palette = AppPalette.forTheme("classic_blue")++ assertThat(palette.brand).isEqualTo(Color(0xFF69A8FF))+ assertThat(palette.canvas).isEqualTo(Color(0xFF07111B))+ assertThat(palette.surface).isEqualTo(Color(0xFF0F1B29))+ assertThat(palette.onPrimary).isEqualTo(Color.White)+ }++ @Test+ fun `m3 purple uses a distinct primary and neutral surface palette`() {+ val palette = AppPalette.forTheme("m3_purple")++ assertThat(palette.brand).isEqualTo(Color(0xFFD0BCFF))+ assertThat(palette.canvas).isEqualTo(Color(0xFF0A0A0D))+ assertThat(palette.surface).isEqualTo(Color(0xFF141419))+ assertThat(palette.onPrimary).isEqualTo(Color(0xFF381E72))+ }++ @Test+ fun `unknown theme IDs resolve to classic blue`() {+ assertThat(AppPalette.forTheme("unknown")).isEqualTo(AppPalette.forTheme("classic_blue"))+ assertThat(AppPalette.forTheme(null)).isEqualTo(AppPalette.forTheme("classic_blue"))+ }+}diff --git a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.ktindex 09d2fc45..8c6844db 100644--- a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt+++ b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt@@ -202,6 +202,7 @@ class BackupManagerImpl @Inject constructor(put("parentalPinSalt", parentalPinBackup?.saltBase64 ?: "")put("appLanguage", preferencesRepository.appLanguage.first())put("appTimeFormat", preferencesRepository.appTimeFormat.first().storageValue)+ put("appTheme", preferencesRepository.appTheme.first().storageValue)put("defaultViewMode", preferencesRepository.defaultViewMode.first().orEmpty())put("appLandingDestination", preferencesRepository.appLandingDestination.first().storageValue)put(@@ -3143,6 +3144,7 @@ class BackupManagerImpl @Inject constructor(put("parentalPinSalt", parentalPinBackup?.saltBase64.orEmpty())put("appLanguage", preferencesRepository.appLanguage.first())put("appTimeFormat", preferencesRepository.appTimeFormat.first().storageValue)+ put("appTheme", preferencesRepository.appTheme.first().storageValue)put("defaultViewMode", preferencesRepository.defaultViewMode.first().orEmpty())put("appLandingDestination", preferencesRepository.appLandingDestination.first().storageValue)put("appTopLevelDestinations", preferencesRepository.appTopLevelDestinations.first().joinToString(",") { it.storageValue })@@ -3604,6 +3606,11 @@ class BackupManagerImpl @Inject constructor(com.streamvault.domain.model.AppTimeFormat.fromStorage(savedFormat))}+ prefs["appTheme"]?.takeIf { it.isNotBlank() }?.let { savedTheme ->+ preferencesRepository.setAppTheme(+ com.streamvault.domain.model.AppTheme.fromStorage(savedTheme)+ )+ }prefs["defaultViewMode"]?.takeIf { it.isNotBlank() }?.let { preferencesRepository.setDefaultViewMode(it) }prefs["appLandingDestination"]?.takeIf { it.isNotBlank() }?.let { savedDestination ->diff --git a/data/src/main/java/com/streamvault/data/manager/PreferenceBackupRegistry.kt b/data/src/main/java/com/streamvault/data/manager/PreferenceBackupRegistry.ktindex 15b03a70..957d1f02 100644--- a/data/src/main/java/com/streamvault/data/manager/PreferenceBackupRegistry.kt+++ b/data/src/main/java/com/streamvault/data/manager/PreferenceBackupRegistry.kt@@ -13,7 +13,7 @@ internal object PreferenceBackupRegistry {"last_active_provider_id", "active_live_source_type", "active_live_source_id","default_view_mode", "parental_control_level", "parental_pin_hash", "parental_pin_salt","default_category_id", "app_language", "app_landing_destination", "app_top_level_destinations",- "app_home_dashboard_shelves", "app_time_format", "live_tv_channel_mode", "live_tv_auto_hide_categories",+ "app_home_dashboard_shelves", "app_time_format", "app_theme", "live_tv_channel_mode", "live_tv_auto_hide_categories","show_live_source_switcher", "show_favorites_category", "show_all_channels_category","show_recent_channels_category", "live_tv_category_filters", "live_tv_quick_filter_visibility","hide_decorative_live_rows", "live_channel_numbering_mode", "live_channel_grouping_mode",@@ -86,7 +86,7 @@ internal object PreferenceBackupRegistry {"vodVariantSelections_")private val globalKeys = setOf(- "parentalControlLevel", "parentalPinHash", "parentalPinSalt", "appLanguage", "appTimeFormat",+ "parentalControlLevel", "parentalPinHash", "parentalPinSalt", "appLanguage", "appTimeFormat", "appTheme","defaultViewMode", "appLandingDestination", "appTopLevelDestinations", "appHomeDashboardShelves","remoteShortcutPreferences", "liveTvCategoryFilters", "liveTvQuickFilterVisibility", "liveTvChannelMode","liveTvAutoHideCategories",diff --git a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.ktindex f5a8f656..a45c8a32 100644--- a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt+++ b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt@@ -32,6 +32,7 @@ import com.streamvault.domain.model.ActiveLiveSourceimport com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.LiveChannelGroupingModeimport com.streamvault.domain.model.LiveChannelObservedQualityimport com.streamvault.domain.model.LiveStreamFormatMode@@ -147,6 +148,8 @@ internal fun parseTimeshiftBackendPreference(saved: String?): TimeshiftBackendPrsaved?.let { value -> TimeshiftBackendPreference.entries.firstOrNull { it.name == value } }?: TimeshiftBackendPreference.AUTOMATIC+internal fun parseAppThemePreference(saved: String?): AppTheme = AppTheme.fromStorage(saved)+@Singletonclass PreferencesRepository @Inject constructor(@ApplicationContext private val context: Context,@@ -192,6 +195,7 @@ class PreferencesRepository @Inject constructor(val APP_TOP_LEVEL_DESTINATIONS = stringPreferencesKey("app_top_level_destinations")val APP_HOME_DASHBOARD_SHELVES = stringPreferencesKey("app_home_dashboard_shelves")val APP_TIME_FORMAT = stringPreferencesKey("app_time_format")+ val APP_THEME = stringPreferencesKey("app_theme")val LIVE_TV_CHANNEL_MODE = stringPreferencesKey("live_tv_channel_mode")val LIVE_TV_AUTO_HIDE_CATEGORIES = booleanPreferencesKey("live_tv_auto_hide_categories")val SHOW_LIVE_SOURCE_SWITCHER = booleanPreferencesKey("show_live_source_switcher")@@ -1590,6 +1594,16 @@ class PreferencesRepository @Inject constructor(}}+ override val appTheme: Flow<AppTheme> = context.dataStore.data.map { preferences ->+ parseAppThemePreference(preferences[PreferencesKeys.APP_THEME]?.trim())+ }++ override suspend fun setAppTheme(theme: AppTheme) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.APP_THEME] = theme.storageValue+ }+ }+override val liveTvChannelMode: Flow<String?> = context.dataStore.data.map { preferences ->preferences[PreferencesKeys.LIVE_TV_CHANNEL_MODE]}diff --git a/data/src/test/java/com/streamvault/data/preferences/PreferencesRepositoryThemeTest.kt b/data/src/test/java/com/streamvault/data/preferences/PreferencesRepositoryThemeTest.ktnew file mode 100644index 00000000..7a1e79a3--- /dev/null+++ b/data/src/test/java/com/streamvault/data/preferences/PreferencesRepositoryThemeTest.kt@@ -0,0 +1,19 @@+package com.streamvault.data.preferences++import com.google.common.truth.Truth.assertThat+import com.streamvault.domain.model.AppTheme+import org.junit.Test++class PreferencesRepositoryThemeTest {++ @Test+ fun `parseAppThemePreference defaults to classic blue`() {+ assertThat(parseAppThemePreference(null)).isEqualTo(AppTheme.CLASSIC_BLUE)+ assertThat(parseAppThemePreference("invalid")).isEqualTo(AppTheme.CLASSIC_BLUE)+ }++ @Test+ fun `parseAppThemePreference restores a stored theme`() {+ assertThat(parseAppThemePreference("m3_purple")).isEqualTo(AppTheme.M3_PURPLE)+ }+}diff --git a/docs/superpowers/plans/2026-09-08-multiple-themes.md b/docs/superpowers/plans/2026-09-08-multiple-themes.mdnew file mode 100644index 00000000..11490642--- /dev/null+++ b/docs/superpowers/plans/2026-09-08-multiple-themes.md@@ -0,0 +1,130 @@+# Multiple Themes Implementation Plan++> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans (inline execution is approved for this branch). Steps use checkbox (`- [ ]`) syntax for tracking.++**Goal:** Add two selectable palette themes, persist the choice, apply it at both app entry points, expose it in Settings, and round-trip it through portable backups.++**Architecture:** The domain defines stable theme IDs and fallback parsing. DataStore and the existing SettingsPreferences/snapshot flow carry the enum; core UI resolves the ID into a state-backed palette facade and Material TV color scheme without taking a dependency on domain. MainActivity and TvInputSetupActivity pass the persisted storage ID into StreamVaultTheme.++**Tech Stack:** Kotlin/JVM, Android DataStore Preferences, Jetpack Compose for TV, Material 3 TV, existing JUnit/Truth/robolectric test setup.++**Spec:** `docs/superpowers/specs/2026-09-08-multiple-themes-design.md`++## Global Constraints++- `classic_blue` is the default and preserves the existing palette.+- `m3_purple` is palette-only; typography, shapes, spacing, layout, and behavior remain shared.+- Invalid or missing theme values fall back to `classic_blue`.+- Core UI must remain independent of `:domain`, `:data`, `:app`, and feature modules.+- Portable backups must include the theme and restore it tolerantly.+- Write tests before production code for each new behavior and run the smallest targeted test task after each cycle.++---++### Task 1: Domain theme ID model++**Files:**+- Create: `domain/src/main/java/com/streamvault/domain/model/AppTheme.kt`+- Test: `domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt`++**Interfaces:**+- Produces `AppTheme.CLASSIC_BLUE`, `AppTheme.M3_PURPLE`, `AppTheme.DEFAULT`, `AppTheme.storageValue`, and `AppTheme.fromStorage(value: String?): AppTheme`.++- [ ] **Step 1: Write the failing tests** for stable IDs, case-insensitive parsing, and fallback for null/unknown/blank input.+- [ ] **Step 2: Run `:domain:test` for `AppThemeTest` and confirm the failure is caused by the missing model.**+- [ ] **Step 3: Add the enum with explicit storage values and a tolerant parser.**+- [ ] **Step 4: Re-run the focused test and confirm it passes.**++### Task 2: Core UI palette resolver and reactive theme++**Files:**+- Create or modify: `core/ui/src/main/java/com/streamvault/core/ui/design/AppPalette.kt`+- Modify: `core/ui/src/main/java/com/streamvault/core/ui/design/AppColors.kt`+- Modify: `core/ui/src/main/java/com/streamvault/core/ui/theme/Color.kt`+- Modify: `core/ui/src/main/java/com/streamvault/core/ui/theme/Theme.kt`+- Test: `core/ui/src/test/java/com/streamvault/core/ui/design/AppPaletteTest.kt`++**Interfaces:**+- Produces `AppPalette.forTheme(themeId: String): AppPalette` and `StreamVaultTheme(themeId: String = "classic_blue", content: @Composable () -> Unit)`.++- [ ] **Step 1: Write failing palette tests** proving classic blue retains the current brand/surface colors, M3 purple changes the primary/surface colors, and an unknown ID resolves to classic blue.+- [ ] **Step 2: Run `:core:ui:testDebugUnitTest` for the palette test and confirm the expected missing-symbol failure.**+- [ ] **Step 3: Implement the two complete palettes and state-backed `AppColors` getters.**+- [ ] **Step 4: Change top-level color aliases to computed getters and build the Material TV color scheme from the selected palette.**+- [ ] **Step 5: Re-run the focused core UI test and `:core:ui:check` to verify both behavior and the existing module boundary.**++### Task 3: Persist theme through the settings contract and DataStore++**Files:**+- Modify: `domain/src/main/java/com/streamvault/domain/settings/SettingsPreferences.kt`+- Modify: `data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt`+- Test: `data/src/test/java/com/streamvault/data/preferences/PreferencesRepositoryThemeTest.kt`++**Interfaces:**+- Adds `SettingsPreferences.appTheme: Flow<AppTheme>` and `setAppTheme(theme: AppTheme)`.+- Stores the value under the stable DataStore key `app_theme` with default `classic_blue`.++- [ ] **Step 1: Write a repository test** for default theme and persisted theme round-trip using the existing DataStore test pattern.+- [ ] **Step 2: Run the focused data test and confirm the contract/key is missing.**+- [ ] **Step 3: Add the contract property/setter and DataStore implementation.**+- [ ] **Step 4: Re-run the focused data test.**++### Task 4: Settings snapshot, ViewModel setter, and selector dialog++**Files:**+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceModels.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsUiStateModel.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsStateBindings.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapper.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsViewModel.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogState.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsContentPane.kt`+- Modify: `feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogs.kt`+- Modify: `feature/settings/src/main/res/values/strings.xml`+- Tests: existing settings snapshot/contract tests plus a focused selector state test if needed by the existing patterns.++**Interfaces:**+- Adds `SettingsUiState.appTheme: AppTheme` and a `SettingsViewModel.setAppTheme(theme: AppTheme)` command.+- Adds a saved `showThemeDialog` flag and a selector row in the existing Browsing category.++- [ ] **Step 1: Update existing snapshot tests/fixtures first** so they assert the default theme and fail until the flow is wired.+- [ ] **Step 2: Run the focused settings tests and confirm the new field is not propagated.**+- [ ] **Step 3: Thread `appTheme` through snapshot defaults, combine bindings, mapper, and ViewModel setter.**+- [ ] **Step 4: Add localized labels and a TV-friendly single-choice dialog using the existing dialog/state patterns.**+- [ ] **Step 5: Add the selector row in the Browsing settings section and connect it through `SettingsContentPane`/`SettingsScreenDialogs`.**+- [ ] **Step 6: Run the focused settings unit tests and the feature boundary verification.**++### Task 5: Apply the selected theme at app entry points++**Files:**+- Modify: `app/src/main/java/com/streamvault/app/MainActivity.kt`+- Modify: `app/src/main/java/com/streamvault/app/tvinput/TvInputSetupActivity.kt`++- [ ] **Step 1: Add entry-point tests or update existing Compose smoke fixtures** to pass a selected theme ID into `StreamVaultTheme`.+- [ ] **Step 2: Collect `preferencesRepository.appTheme` in both activities and pass `themeId = appTheme.storageValue`.**+- [ ] **Step 3: Run the relevant app compile/unit target and verify no stale `StreamVaultTheme` call sites are broken.**++### Task 6: Portable backup and restore++**Files:**+- Modify: `data/src/main/java/com/streamvault/data/manager/PreferenceBackupRegistry.kt`+- Modify: `data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt`+- Modify: `data/src/test/java/com/streamvault/data/manager/PreferenceBackupRegistryTest.kt`+- Modify: `data/src/test/java/com/streamvault/data/manager/BackupManagerImplTest.kt` only where existing snapshot expectations require it.++- [ ] **Step 1: Add a failing registry assertion** that `app_theme` is portable and `appTheme` is admitted as a global backup key.+- [ ] **Step 2: Run the focused registry test and confirm the key is not yet admitted.**+- [ ] **Step 3: Export `appTheme` in both backup snapshot builders and restore it through `AppTheme.fromStorage`/`setAppTheme`.**+- [ ] **Step 4: Re-run registry and targeted backup tests, including malformed-value coverage.**++### Task 7: Integration verification and graph refresh++**Files:**+- Modify: `docs/superpowers/plans/2026-09-08-multiple-themes.md` to mark completed steps.+- Generated: `graphify-out/` via `graphify update .`.++- [ ] **Step 1: Run domain, core UI, settings, and targeted data unit tests.**+- [ ] **Step 2: Run `:app:compileDebugKotlin` or the narrowest successful app verification target.**+- [ ] **Step 3: Run `graphify update .` from the worktree root.**+- [ ] **Step 4: Inspect `git diff`, `git status`, and the final test output for accidental scope, stale files, or generated changes.**diff --git a/docs/superpowers/specs/2026-09-08-multiple-themes-design.md b/docs/superpowers/specs/2026-09-08-multiple-themes-design.mdnew file mode 100644index 00000000..4644b8eb--- /dev/null+++ b/docs/superpowers/specs/2026-09-08-multiple-themes-design.md@@ -0,0 +1,44 @@+# Multiple Themes Design++## Goal++Add a user-selectable palette theme to StreamVault. The existing blue/navy palette remains the default, and the M3 purple-on-black palette becomes a second selectable theme.++## Scope++- Theme selection is a persisted application preference.+- Settings exposes a single theme selector in the Browsing section, directly below the existing view-mode-style app preferences.+- The first release changes colors, Material color roles, and focus treatment only. Typography, shapes, spacing, layout density, and behavior remain shared.+- Theme selection applies to the main app and the TV input setup activity.+- Backup export and restore include the selected theme.+- Unknown or missing stored values safely fall back to the blue default.+- This slice does not add remote theme packages, user-authored colors, per-screen themes, or runtime plugin loading.++## Theme IDs++Theme IDs are stable storage values, not enum ordinals:++| ID | Display name | Palette |+| --- | --- | --- |+| `classic_blue` | Classic blue | Current StreamVault blue/navy palette |+| `m3_purple` | M3 purple | Purple primary with neutral black surfaces |++## Architecture++The domain layer owns the stable `AppTheme` ID enum and its tolerant storage parser. The data layer exposes it through `SettingsPreferences`, stores it in DataStore, and includes it in the existing portable backup registry and backup codec. The settings feature observes and writes the enum through its existing preference snapshot/view-model flow.++The core UI layer owns the color palettes because it is intentionally independent of the domain and app modules. `StreamVaultTheme(themeId: String)` resolves the requested palette, updates the existing `AppColors` facade through Compose state, and constructs the Material TV color scheme from that palette. Existing color call sites remain source-compatible, while top-level aliases become computed getters so they follow palette changes. The app entry points collect the domain preference and pass its stable storage value to core UI.++## Safety and compatibility++- The default is the current palette, so upgrades do not change appearance for users without a stored theme.+- Invalid backup values are ignored by the domain parser and resolve to the default.+- No network, permission, reflection, dynamic code, credential, or provider behavior is introduced.+- Backup keys follow existing portable preference conventions and are not device-bound.++## Verification++- Unit tests cover theme ID parsing/defaulting and palette resolution.+- Settings tests cover snapshot propagation and the setter contract.+- Backup registry tests cover portable admission.+- Targeted Gradle unit tests are run for domain, core UI, feature settings, and data; existing unrelated baseline failures are reported separately.diff --git a/domain/src/main/java/com/streamvault/domain/model/AppTheme.kt b/domain/src/main/java/com/streamvault/domain/model/AppTheme.ktnew file mode 100644index 00000000..030e8b2c--- /dev/null+++ b/domain/src/main/java/com/streamvault/domain/model/AppTheme.kt@@ -0,0 +1,17 @@+package com.streamvault.domain.model++enum class AppTheme(val storageValue: String) {+ CLASSIC_BLUE("classic_blue"),+ M3_PURPLE("m3_purple");++ companion object {+ val DEFAULT: AppTheme = CLASSIC_BLUE++ fun fromStorage(value: String?): AppTheme {+ val normalized = value?.trim().orEmpty()+ return entries.firstOrNull { theme ->+ theme.storageValue.equals(normalized, ignoreCase = true)+ } ?: DEFAULT+ }+ }+}diff --git a/domain/src/main/java/com/streamvault/domain/settings/SettingsPreferences.kt b/domain/src/main/java/com/streamvault/domain/settings/SettingsPreferences.ktindex 05f5c28b..83622a42 100644--- a/domain/src/main/java/com/streamvault/domain/settings/SettingsPreferences.kt+++ b/domain/src/main/java/com/streamvault/domain/settings/SettingsPreferences.kt@@ -9,6 +9,7 @@ import com.streamvault.domain.model.DecoderModeimport com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.LiveChannelGroupingModeimport com.streamvault.domain.model.LiveStreamFormatModeimport com.streamvault.domain.model.LiveVariantPreferenceMode@@ -299,6 +300,10 @@ interface SettingsPreferences {suspend fun setAppTimeFormat(format: AppTimeFormat)+ val appTheme: Flow<AppTheme>++ suspend fun setAppTheme(theme: AppTheme)+val liveTvChannelMode: Flow<String?>suspend fun setLiveTvChannelMode(mode: String)diff --git a/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt b/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.ktnew file mode 100644index 00000000..cded1335--- /dev/null+++ b/domain/src/test/java/com/streamvault/domain/model/AppThemeTest.kt@@ -0,0 +1,30 @@+package com.streamvault.domain.model++import com.google.common.truth.Truth.assertThat+import org.junit.Test++class AppThemeTest {++ @Test+ fun `storage values are stable and distinct`() {+ assertThat(AppTheme.CLASSIC_BLUE.storageValue).isEqualTo("classic_blue")+ assertThat(AppTheme.M3_PURPLE.storageValue).isEqualTo("m3_purple")+ assertThat(AppTheme.entries.map(AppTheme::storageValue)).containsExactly(+ "classic_blue",+ "m3_purple"+ ).inOrder()+ }++ @Test+ fun `fromStorage accepts case and surrounding whitespace`() {+ assertThat(AppTheme.fromStorage(" M3_PURPLE ")).isEqualTo(AppTheme.M3_PURPLE)+ }++ @Test+ fun `fromStorage falls back to classic blue for missing or unknown values`() {+ assertThat(AppTheme.DEFAULT).isEqualTo(AppTheme.CLASSIC_BLUE)+ assertThat(AppTheme.fromStorage(null)).isEqualTo(AppTheme.CLASSIC_BLUE)+ assertThat(AppTheme.fromStorage(" ")).isEqualTo(AppTheme.CLASSIC_BLUE)+ assertThat(AppTheme.fromStorage("old_theme")).isEqualTo(AppTheme.CLASSIC_BLUE)+ }+}diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.ktindex e692b529..2b8886fb 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsBrowsingSection.kt@@ -40,6 +40,7 @@ import com.streamvault.core.ui.theme.OnSurfaceDimimport com.streamvault.core.ui.theme.Primaryimport com.streamvault.domain.model.CategorySortModeimport com.streamvault.domain.model.ContentType+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.LiveChannelGroupingModeimport com.streamvault.domain.model.RemoteColorButtonimport com.streamvault.domain.model.RemoteShortcutProfile@@ -68,6 +69,7 @@ public fun LazyListScope.settingsBrowsingSection(onShowGuideDefaultCategoryDialogChange: (Boolean) -> Unit,onShowTimeFormatDialogChange: (Boolean) -> Unit,onShowVodViewModeDialogChange: (Boolean) -> Unit,+ onShowThemeDialogChange: (Boolean) -> Unit,onShowVodDuplicateHandlingDialogChange: (Boolean) -> Unit,onShowVodVariantPreferenceDialogChange: (Boolean) -> Unit,onCategorySortDialogTypeChange: (String?) -> Unit,@@ -267,6 +269,11 @@ public fun LazyListScope.settingsBrowsingSection(value = stringResource(uiState.vodViewMode.labelResId()),onClick = { onShowVodViewModeDialogChange(true) })+ ClickableSettingsRow(+ label = stringResource(R.string.settings_theme),+ value = stringResource(uiState.appTheme.labelResId()),+ onClick = { onShowThemeDialogChange(true) }+ )SwitchSettingsRow(label = stringResource(R.string.settings_vod_complete_on_open),value = stringResource(@@ -583,3 +590,8 @@ private fun RemoteColorButton.accentColor(): Color = when (this) {RemoteColorButton.YELLOW -> AccentAmberRemoteColorButton.BLUE -> AccentCyan}++private fun AppTheme.labelResId(): Int = when (this) {+ AppTheme.CLASSIC_BLUE -> R.string.settings_theme_classic_blue+ AppTheme.M3_PURPLE -> R.string.settings_theme_m3_purple+}diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsContentPane.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsContentPane.ktindex e48f1004..3e2a3ff7 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsContentPane.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsContentPane.kt@@ -125,10 +125,10 @@ public fun SettingsContentPane(guideDefaultCategoryLabel = screenLabels.guideDefaultCategoryLabel,timeFormatLabel = screenLabels.timeFormatLabel,appLanguageLabel = screenLabels.appLanguageLabel,- onShowLiveTvModeDialogChange = { dialogState.showLiveTvModeDialog = it },- onShowLiveTvFiltersDialogChange = { dialogState.showLiveTvFiltersDialog = it },- onShowLiveTvQuickFilterVisibilityDialogChange = { dialogState.showLiveTvQuickFilterVisibilityDialog = it },- onShowLiveChannelNumberingDialogChange = { dialogState.showLiveChannelNumberingDialog = it },+ onShowLiveTvModeDialogChange = { dialogState.showLiveTvModeDialog = it },+ onShowLiveTvFiltersDialogChange = { dialogState.showLiveTvFiltersDialog = it },+ onShowLiveTvQuickFilterVisibilityDialogChange = { dialogState.showLiveTvQuickFilterVisibilityDialog = it },+ onShowLiveChannelNumberingDialogChange = { dialogState.showLiveChannelNumberingDialog = it },onShowLiveChannelGroupingDialogChange = { dialogState.showLiveChannelGroupingDialog = it },onShowGroupedChannelLabelDialogChange = { dialogState.showGroupedChannelLabelDialog = it },onShowLiveVariantPreferenceDialogChange = { dialogState.showLiveVariantPreferenceDialog = it },@@ -137,15 +137,16 @@ public fun SettingsContentPane(onShowLandingScreenDialogChange = { dialogState.showLandingScreenDialog = it },onShowGuideDefaultCategoryDialogChange = { dialogState.showGuideDefaultCategoryDialog = it },onShowTimeFormatDialogChange = { dialogState.showTimeFormatDialog = it },- onShowVodViewModeDialogChange = { dialogState.showVodViewModeDialog = it },- onShowVodDuplicateHandlingDialogChange = { dialogState.showVodDuplicateHandlingDialog = it },- onShowVodVariantPreferenceDialogChange = { dialogState.showVodVariantPreferenceDialog = it },- onCategorySortDialogTypeChange = { dialogState.categorySortDialogType = it },- onShowLanguageDialogChange = { dialogState.showLanguageDialog = it },- onRemoteShortcutDialogTargetChange = {- dialogState.selectedRemoteShortcutTargetKey = it?.storageKey()- }- )+ onShowVodViewModeDialogChange = { dialogState.showVodViewModeDialog = it },+ onShowThemeDialogChange = { dialogState.showThemeDialog = it },+ onShowVodDuplicateHandlingDialogChange = { dialogState.showVodDuplicateHandlingDialog = it },+ onShowVodVariantPreferenceDialogChange = { dialogState.showVodVariantPreferenceDialog = it },+ onCategorySortDialogTypeChange = { dialogState.categorySortDialogType = it },+ onShowLanguageDialogChange = { dialogState.showLanguageDialog = it },+ onRemoteShortcutDialogTargetChange = {+ dialogState.selectedRemoteShortcutTargetKey = it?.storageKey()+ }+ )} else if (dialogState.selectedCategory == 3) {settingsPrivacySection(uiState = uiState,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.ktindex 2d86de01..1e1c8ffa 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceDialogs.kt@@ -6,6 +6,7 @@ import androidx.compose.runtime.rememberimport androidx.compose.ui.res.stringResourceimport com.streamvault.feature.settings.Rimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTopLevelDestinationimport com.streamvault.domain.model.CategorySortMode@@ -31,6 +32,8 @@ public fun SettingsPreferenceDialogs(onShowPlaybackSpeedDialogChange: (Boolean) -> Unit,showTimeFormatDialog: Boolean,onShowTimeFormatDialogChange: (Boolean) -> Unit,+ showThemeDialog: Boolean,+ onShowThemeDialogChange: (Boolean) -> Unit,showAudioVideoOffsetDialog: Boolean,onShowAudioVideoOffsetDialogChange: (Boolean) -> Unit,showAudioDecoderModeDialog: Boolean,@@ -126,6 +129,25 @@ public fun SettingsPreferenceDialogs(onShowLiveTranslationEndpointDialogChange = onShowLiveTranslationEndpointDialogChange)+ if (showThemeDialog) {+ PremiumSelectionDialog(+ title = stringResource(R.string.settings_select_theme),+ onDismiss = { onShowThemeDialogChange(false) }+ ) {+ AppTheme.entries.forEachIndexed { index, theme ->+ LevelOption(+ level = index,+ text = context.getString(theme.labelResId()),+ currentLevel = if (uiState.appTheme == theme) index else -1,+ onSelect = {+ viewModel.setAppTheme(theme)+ onShowThemeDialogChange(false)+ }+ )+ }+ }+ }+if (showTopNavigationDialog) {TopNavigationDialog(currentDestinations = uiState.appTopLevelDestinations,@@ -374,3 +396,8 @@ private fun AppLandingDestination.labelResId(): Int = when (this) {AppLandingDestination.PLUGINS -> R.string.nav_pluginsAppLandingDestination.SETTINGS -> R.string.nav_settings}++private fun AppTheme.labelResId(): Int = when (this) {+ AppTheme.CLASSIC_BLUE -> R.string.settings_theme_classic_blue+ AppTheme.M3_PURPLE -> R.string.settings_theme_m3_purple+}diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceModels.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceModels.ktindex 5beb8cbf..9c3e8b78 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceModels.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceModels.kt@@ -6,6 +6,7 @@ import com.streamvault.domain.model.LiveTvChannelModeimport com.streamvault.domain.model.LiveTvQuickFilterVisibilityModeimport com.streamvault.domain.model.VodViewModeimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTopLevelDestination@@ -52,6 +53,7 @@ data class SettingsPreferenceSnapshot(val appTopLevelDestinations: List<AppTopLevelDestination>,val appHomeDashboardShelves: List<AppHomeDashboardShelf>,val appTimeFormat: AppTimeFormat,+ val appTheme: AppTheme,val preferredAudioLanguage: String,val playerMediaSessionEnabled: Boolean,val playerFastRetryOnTransientFailures: Boolean,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapper.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapper.ktindex 66d94c3f..a94ede1a 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapper.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapper.kt@@ -15,6 +15,7 @@ fun SettingsUiState.applyPreferenceSnapshot(appTopLevelDestinations = snapshot.appTopLevelDestinations,appHomeDashboardShelves = snapshot.appHomeDashboardShelves,appTimeFormat = snapshot.appTimeFormat,+ appTheme = snapshot.appTheme,preferredAudioLanguage = snapshot.preferredAudioLanguage,playerMediaSessionEnabled = snapshot.playerMediaSessionEnabled,playerFastRetryOnTransientFailures = snapshot.playerFastRetryOnTransientFailures,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogState.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogState.ktindex 1ec3042b..6196e7ac 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogState.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogState.kt@@ -13,6 +13,7 @@ class SettingsScreenDialogState(private val showLevelDialogState: MutableState<Boolean>,private val showLanguageDialogState: MutableState<Boolean>,private val showTimeFormatDialogState: MutableState<Boolean>,+ private val showThemeDialogState: MutableState<Boolean>,private val showLiveTvModeDialogState: MutableState<Boolean>,private val showLiveTvQuickFilterVisibilityDialogState: MutableState<Boolean>,private val showLiveChannelNumberingDialogState: MutableState<Boolean>,@@ -78,6 +79,7 @@ class SettingsScreenDialogState(var showLevelDialog by showLevelDialogStatevar showLanguageDialog by showLanguageDialogStatevar showTimeFormatDialog by showTimeFormatDialogState+ var showThemeDialog by showThemeDialogStatevar showLiveTvModeDialog by showLiveTvModeDialogStatevar showLiveTvQuickFilterVisibilityDialog by showLiveTvQuickFilterVisibilityDialogStatevar showLiveChannelNumberingDialog by showLiveChannelNumberingDialogState@@ -211,6 +213,7 @@ fun rememberSettingsScreenDialogState(): SettingsScreenDialogState {val showLevelDialogState = rememberSaveable { mutableStateOf(false) }val showLanguageDialogState = rememberSaveable { mutableStateOf(false) }val showTimeFormatDialogState = rememberSaveable { mutableStateOf(false) }+ val showThemeDialogState = rememberSaveable { mutableStateOf(false) }val showLiveTvModeDialogState = rememberSaveable { mutableStateOf(false) }val showLiveTvQuickFilterVisibilityDialogState = rememberSaveable { mutableStateOf(false) }val showLiveChannelNumberingDialogState = rememberSaveable { mutableStateOf(false) }@@ -285,6 +288,7 @@ fun rememberSettingsScreenDialogState(): SettingsScreenDialogState {showLevelDialogState = showLevelDialogState,showLanguageDialogState = showLanguageDialogState,showTimeFormatDialogState = showTimeFormatDialogState,+ showThemeDialogState = showThemeDialogState,showLiveTvModeDialogState = showLiveTvModeDialogState,showLiveTvQuickFilterVisibilityDialogState = showLiveTvQuickFilterVisibilityDialogState,showLiveChannelNumberingDialogState = showLiveChannelNumberingDialogState,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogs.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogs.ktindex 2d24e37c..2278a6ab 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogs.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsScreenDialogs.kt@@ -190,6 +190,8 @@ public fun SettingsScreenDialogs(onShowPlaybackSpeedDialogChange = { dialogState.showPlaybackSpeedDialog = it },showTimeFormatDialog = dialogState.showTimeFormatDialog,onShowTimeFormatDialogChange = { dialogState.showTimeFormatDialog = it },+ showThemeDialog = dialogState.showThemeDialog,+ onShowThemeDialogChange = { dialogState.showThemeDialog = it },showAudioVideoOffsetDialog = dialogState.showAudioVideoOffsetDialog,onShowAudioVideoOffsetDialogChange = { dialogState.showAudioVideoOffsetDialog = it },showAudioDecoderModeDialog = dialogState.showAudioDecoderModeDialog,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsStateBindings.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsStateBindings.ktindex b6a25fee..c5f71137 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsStateBindings.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsStateBindings.kt@@ -10,6 +10,7 @@ import com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTopLevelDestinationimport com.streamvault.domain.settings.SettingsPreferencesimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.AudioOutputPreferenceimport com.streamvault.domain.model.ChannelNumberingModeimport com.streamvault.domain.model.DecoderMode@@ -50,6 +51,7 @@ fun observeSettingsPreferenceSnapshot(appTopLevelDestinations = AppTopLevelDestination.defaultOrder,appHomeDashboardShelves = AppHomeDashboardShelf.defaultOrder,appTimeFormat = AppTimeFormat.SYSTEM,+ appTheme = AppTheme.DEFAULT,preferredAudioLanguage = "auto",playerMediaSessionEnabled = true,playerFastRetryOnTransientFailures = false,@@ -217,6 +219,8 @@ fun observeSettingsPreferenceSnapshot(snapshot.copy(xtreamBase64TextCompatibility = compatibilityEnabled)}.combine(preferencesRepository.liveTvChannelMode) { snapshot, liveTvChannelMode ->snapshot.copy(liveTvChannelMode = LiveTvChannelMode.fromStorage(liveTvChannelMode))+ }.combine(preferencesRepository.appTheme) { snapshot, appTheme ->+ snapshot.copy(appTheme = appTheme)}.combine(preferencesRepository.liveTvAutoHideCategories) { snapshot, liveTvAutoHideCategories ->snapshot.copy(liveTvAutoHideCategories = liveTvAutoHideCategories)}.combine(preferencesRepository.showLiveSourceSwitcher) { snapshot, showLiveSourceSwitcher ->diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsUiStateModel.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsUiStateModel.ktindex 37f3990b..142ef284 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsUiStateModel.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsUiStateModel.kt@@ -18,6 +18,7 @@ import com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTopLevelDestinationimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.AudioOutputPreferenceimport com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.CategorySortMode@@ -77,6 +78,7 @@ data class SettingsUiState(val appTopLevelDestinations: List<AppTopLevelDestination> = AppTopLevelDestination.defaultOrder,val appHomeDashboardShelves: List<AppHomeDashboardShelf> = AppHomeDashboardShelf.defaultOrder,val appTimeFormat: AppTimeFormat = AppTimeFormat.SYSTEM,+ val appTheme: AppTheme = AppTheme.DEFAULT,val preferredAudioLanguage: String = "auto",val playerMediaSessionEnabled: Boolean = true,val playerFastRetryOnTransientFailures: Boolean = false,diff --git a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsViewModel.kt b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsViewModel.ktindex 89e4979b..52372b76 100644--- a/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsViewModel.kt+++ b/feature/settings/src/main/java/com/streamvault/feature/settings/presentation/SettingsViewModel.kt@@ -668,6 +668,12 @@ class SettingsViewModel @Inject constructor(}}+ fun setAppTheme(theme: com.streamvault.domain.model.AppTheme) {+ viewModelScope.launch {+ preferencesRepository.setAppTheme(theme)+ }+ }+fun setPreventStandbyDuringPlayback(prevent: Boolean) {viewModelScope.launch {preferencesRepository.setPreventStandbyDuringPlayback(prevent)diff --git a/feature/settings/src/main/res/values/strings.xml b/feature/settings/src/main/res/values/strings.xmlindex 62d4781f..5485f404 100644--- a/feature/settings/src/main/res/values/strings.xml+++ b/feature/settings/src/main/res/values/strings.xml@@ -39,6 +39,10 @@<string name="settings_vod_view_mode_modern_desc">Shelf-based browsing with featured rows and category previews.</string><string name="settings_vod_view_mode_classic">Classic</string><string name="settings_vod_view_mode_classic_desc">Category list on the left with a stacked poster grid on the right.</string>+ <string name="settings_theme">Theme</string>+ <string name="settings_select_theme">Select theme</string>+ <string name="settings_theme_classic_blue">Classic blue</string>+ <string name="settings_theme_m3_purple">M3 purple</string><string name="settings_live_channel_numbering_mode">Live TV Channel Numbering</string><string name="settings_live_channel_numbering_mode_subtitle">Choose whether live channels use their position in the current group or keep the original numbers from the provider.</string><string name="settings_live_channel_numbering_group">Per Group</string>diff --git a/feature/settings/src/test/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapperTest.kt b/feature/settings/src/test/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapperTest.ktindex 476e9eeb..babb3257 100644--- a/feature/settings/src/test/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapperTest.kt+++ b/feature/settings/src/test/java/com/streamvault/feature/settings/presentation/SettingsPreferenceSnapshotMapperTest.kt@@ -4,6 +4,7 @@ import com.google.common.truth.Truth.assertThatimport com.streamvault.domain.model.AppHomeDashboardShelfimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTimeFormat+import com.streamvault.domain.model.AppThemeimport com.streamvault.domain.model.AppTopLevelDestinationimport com.streamvault.domain.model.AudioOutputPreferenceimport com.streamvault.domain.model.ChannelNumberingMode@@ -41,6 +42,7 @@ class SettingsPreferenceSnapshotMapperTest {assertThat(mappedState.appUpdate.isUpdateAvailable).isTrue()assertThat(mappedState.liveTvAutoHideCategories).isFalse()+ assertThat(mappedState.appTheme).isEqualTo(AppTheme.M3_PURPLE)}private fun cachedReleaseSnapshot() = SettingsPreferenceSnapshot(@@ -53,6 +55,7 @@ class SettingsPreferenceSnapshotMapperTest {appTopLevelDestinations = AppTopLevelDestination.defaultOrder,appHomeDashboardShelves = AppHomeDashboardShelf.defaultOrder,appTimeFormat = AppTimeFormat.SYSTEM,+ appTheme = AppTheme.M3_PURPLE,preferredAudioLanguage = "auto",playerMediaSessionEnabled = true,playerFastRetryOnTransientFailures = false,