From cc522bb0b70be75e484149361071b3f13ded5f07 Mon Sep 17 00:00:00 2001 From: Seb3thehacker Date: Mon, 26 Oct 2026 23:33:59 -0700 Subject: [PATCH] theme: the phone app follows the App theme setting too, so Light is light everywhere --- .../app/seb3thehacker/gearslip/ui/GearslipApp.kt | 3 +-- .../app/seb3thehacker/gearslip/ui/GearslipTheme.kt | 13 ++++++++++++- .../app/seb3thehacker/gearslip/ui/HomeScreen.kt | 3 +-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipApp.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipApp.kt index a858e2f..7a56472 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipApp.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipApp.kt @@ -3,7 +3,6 @@ package app.seb3thehacker.gearslip.ui import androidx.core.view.WindowCompat import androidx.compose.ui.platform.LocalView import androidx.compose.runtime.SideEffect -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.windowInsetsTopHeight import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.background @@ -105,7 +104,7 @@ fun GearslipApp(onDisconnect: () -> Unit, onRequestCallScreening: () -> Unit) { // On a debug build, Home's yellow header runs up behind the status bar, whose icons then go dark. val debugHeader = BuildConfig.DEBUG && screen == Screen.HOME val view = LocalView.current - val darkTheme = isSystemInDarkTheme() + val darkTheme = gearslipDark() SideEffect { val window = (view.context as? Activity)?.window ?: return@SideEffect WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = debugHeader || !darkTheme diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipTheme.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipTheme.kt index 7e4bff2..ab21e4e 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipTheme.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/GearslipTheme.kt @@ -17,9 +17,20 @@ import app.seb3thehacker.gearslip.car.theme.withTintedSurfaces @Composable fun GearslipTheme(content: @Composable () -> Unit) { val context = LocalContext.current - val dark = isSystemInDarkTheme() + val dark = gearslipDark() // The car's Dark mode setting, so the phone and the car screen stay one look. val darkStyle by app.seb3thehacker.gearslip.car.CarSettings.darkStyle.collectAsState() val scheme = (if (dark) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)).withTintedSurfaces(dark, darkStyle) MaterialTheme(colorScheme = scheme, content = content) } + +/** Whether the phone app is dark: the car's App theme setting, so Light means light everywhere. */ +@Composable +fun gearslipDark(): Boolean { + val theme by app.seb3thehacker.gearslip.car.CarSettings.appTheme.collectAsState() + return when (theme) { + app.seb3thehacker.gearslip.car.AppTheme.PHONE -> isSystemInDarkTheme() + app.seb3thehacker.gearslip.car.AppTheme.LIGHT -> false + app.seb3thehacker.gearslip.car.AppTheme.DARK -> true + } +} diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeScreen.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeScreen.kt index 1771415..fc36ecd 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeScreen.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/ui/HomeScreen.kt @@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.size import android.content.Context import androidx.compose.material3.ButtonDefaults import androidx.compose.ui.graphics.Color -import androidx.compose.foundation.isSystemInDarkTheme import app.seb3thehacker.gearslip.car.CarSettings import app.seb3thehacker.gearslip.car.BluetoothAudioCheck import android.provider.Settings @@ -202,7 +201,7 @@ private fun BluetoothMissingCard() { val context = LocalContext.current // Yellow, not the theme's error red: music is missing, but nothing is broken. Material has no // warning colour, so these are fixed amber tones for light and dark. - val dark = isSystemInDarkTheme() + val dark = gearslipDark() val container = if (dark) Color(0xFF4A3B00) else Color(0xFFFFE08A) val content = if (dark) Color(0xFFFFE08A) else Color(0xFF3A2E00) Spacer(Modifier.height(16.dp))