From 064f1d1f8d2acc1ee7849d7f7e145498e2861f9e Mon Sep 17 00:00:00 2001 From: jjangddu Date: Wed, 1 Apr 2026 11:48:51 +0900 Subject: [PATCH] fix: disable dark mode and dynamic color to fix Samsung foldable display issues Force light theme only, block Samsung Force Dark Mode via forceDarkAllowed=false, and add explicit text colors to prevent invisible text on light backgrounds. Co-Authored-By: Claude Opus 4.6 --- .../medilightv2android/ui/theme/Theme.kt | 31 +++---------------- .../views/monitoring/PiezoMonitoringView.kt | 2 +- .../views/monitoring/VivamyoMonitoringView.kt | 2 +- app/src/main/res/values/themes.xml | 4 ++- 4 files changed, 9 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/example/medilightv2android/ui/theme/Theme.kt b/app/src/main/java/com/example/medilightv2android/ui/theme/Theme.kt index 3753eda..9f4c480 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/theme/Theme.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/theme/Theme.kt @@ -1,21 +1,8 @@ package com.example.medilightv2android.ui.theme -import android.app.Activity -import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.darkColorScheme -import androidx.compose.material3.dynamicDarkColorScheme -import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable -import androidx.compose.ui.platform.LocalContext - -private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 -) private val LightColorScheme = lightColorScheme( primary = Purple40, @@ -35,23 +22,13 @@ private val LightColorScheme = lightColorScheme( @Composable fun Medilightv2androidTheme( - darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, content: @Composable () -> Unit ) { - val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - - darkTheme -> DarkColorScheme - else -> LightColorScheme - } - + // Always use light color scheme — app is designed for light mode only. + // Dynamic color and dark theme disabled to prevent Samsung Force Dark Mode + // and Material You from overriding custom MediLight colors. MaterialTheme( - colorScheme = colorScheme, + colorScheme = LightColorScheme, typography = Typography, content = content ) diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt index 343ecc6..c05bab4 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt @@ -372,7 +372,7 @@ private fun InfoCard(title: String, value: String, unit: String, color: Color, m horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(6.dp) ) { - Text(value, fontSize = 20.sp, fontWeight = FontWeight.Bold) + Text(value, fontSize = 20.sp, fontWeight = FontWeight.Bold, color = Color(0xFF1C1B1F)) if (unit.isNotEmpty()) Text(unit, fontSize = 11.sp, color = MlSecondaryText) Text(title, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = MlSecondaryText) } diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/VivamyoMonitoringView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/VivamyoMonitoringView.kt index eb8659f..8dabcb1 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/VivamyoMonitoringView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/VivamyoMonitoringView.kt @@ -404,7 +404,7 @@ private fun MetricBox(title: String, value: Double, unit: String, color: Color, Spacer(modifier = Modifier.width(4.dp)) Text(title, fontSize = 11.sp, fontWeight = FontWeight.SemiBold, color = MlSecondaryText) } - Text(String.format("%.1f", value), fontSize = 22.sp, fontWeight = FontWeight.Bold, modifier = Modifier.fillMaxWidth(), textAlign = androidx.compose.ui.text.style.TextAlign.End) + Text(String.format("%.1f", value), fontSize = 22.sp, fontWeight = FontWeight.Bold, color = Color(0xFF1C1B1F), modifier = Modifier.fillMaxWidth(), textAlign = androidx.compose.ui.text.style.TextAlign.End) Text(unit, fontSize = 10.sp, color = MlSecondaryText, modifier = Modifier.fillMaxWidth(), textAlign = androidx.compose.ui.text.style.TextAlign.End) } } diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 907f61e..568f6ff 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,5 +1,7 @@ - \ No newline at end of file