diff --git a/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt b/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt index f5a7e19..3e505f5 100644 --- a/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt +++ b/app/src/main/java/me/ash/reader/ui/component/DynamicSVGImage.kt @@ -27,7 +27,7 @@ fun DynamicSVGImage( val useDarkTheme = LocalDarkTheme.current.isDarkTheme() val tonalPalettes = LocalTonalPalettes.current var size by remember { mutableStateOf(IntSize.Zero) } - val pic by remember(tonalPalettes, size) { + val pic by remember(useDarkTheme, tonalPalettes, size) { mutableStateOf( PictureDrawable( SVG.getFromString(svgImageString.parseDynamicColor(tonalPalettes, useDarkTheme)) diff --git a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt index 6e91c70..812fe0d 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/read/ReadPage.kt @@ -2,7 +2,6 @@ package me.ash.reader.ui.page.home.read import android.util.Log import androidx.compose.animation.* -import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState @@ -77,7 +76,7 @@ fun ReadPage( } Scaffold( - modifier = Modifier.background(MaterialTheme.colorScheme.surface), + containerColor = MaterialTheme.colorScheme.surface, topBar = {}, content = { Box(Modifier.fillMaxSize()) { diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/SettingItem.kt b/app/src/main/java/me/ash/reader/ui/page/settings/SettingItem.kt index 00d2644..8cd111e 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/SettingItem.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/SettingItem.kt @@ -19,6 +19,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import me.ash.reader.ui.theme.palette.LocalTonalPalettes +import me.ash.reader.ui.theme.palette.onDark @Composable fun SettingItem( @@ -31,6 +33,8 @@ fun SettingItem( onClick: () -> Unit, action: (@Composable () -> Unit)? = null ) { + val tonalPalettes = LocalTonalPalettes.current + Surface( modifier = modifier .clickable { onClick() } @@ -71,7 +75,8 @@ fun SettingItem( Divider( modifier = Modifier .padding(start = 16.dp) - .size(1.dp, 32.dp) + .size(1.dp, 32.dp), + color = tonalPalettes neutralVariant 80 onDark (tonalPalettes neutralVariant 30), ) } Box(Modifier.padding(start = 16.dp)) { diff --git a/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkTheme.kt b/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkTheme.kt index a927f23..83c0d11 100644 --- a/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkTheme.kt +++ b/app/src/main/java/me/ash/reader/ui/page/settings/color/DarkTheme.kt @@ -81,10 +81,10 @@ fun DarkTheme( } Subtitle( modifier = Modifier.padding(horizontal = 24.dp), - text = "其他", + text = stringResource(R.string.other), ) SettingItem( - title = "Amoled 的深色主题", + title = stringResource(R.string.amoled_dark_theme), onClick = { (!amoledDarkTheme).put(context, scope) }, diff --git a/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt b/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt index db48ae6..4ea8945 100644 --- a/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt +++ b/app/src/main/java/me/ash/reader/ui/theme/palette/DynamicTonalPalette.kt @@ -6,6 +6,7 @@ import androidx.compose.material3.darkColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color +import me.ash.reader.data.preference.LocalAmoledDarkTheme import me.ash.reader.data.preference.LocalDarkTheme @Composable @@ -41,6 +42,8 @@ fun dynamicLightColorScheme(): ColorScheme { @Composable fun dynamicDarkColorScheme(): ColorScheme { val palettes = LocalTonalPalettes.current + val amoledDarkTheme = LocalAmoledDarkTheme.current + return darkColorScheme( primary = palettes primary 80, onPrimary = palettes primary 20, @@ -57,7 +60,7 @@ fun dynamicDarkColorScheme(): ColorScheme { onTertiaryContainer = palettes tertiary 90, background = palettes neutral 10, onBackground = palettes neutral 90, - surface = palettes neutral 10, + surface = palettes neutral if (amoledDarkTheme.value) 0 else 10, onSurface = palettes neutral 90, surfaceVariant = palettes neutralVariant 30, onSurfaceVariant = palettes neutralVariant 80, diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 38abbc8..2d0ad90 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -102,6 +102,10 @@ 样式 深色主题 跟随系统设置 + 开启 + 关闭 + Amoled 深色主题 + 其他 色调海拔 字体 基本字体 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8376cc5..423803c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -103,6 +103,10 @@ Style Dark Theme Use Device Theme + On + Off + Other + Amoled Dark Theme Tonal Elevation Fonts Basic Fonts