Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 733052ad authored by Chaohui Wang's avatar Chaohui Wang
Browse files

[Spa] Remove SettingsColorScheme.background

Which uses the palette, should use material color instead.

Use surfaceContainer instead.

Fix: 335673545
Test: manual - gallery
Test: manual - with Settings
Change-Id: I8d4f837d287efa04606b7b6aaf5359b2f4519625
parent cdf3a135
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -47,3 +47,7 @@ val ColorScheme.divider: Color

val ColorScheme.surfaceTone: Color
    get() = primary.copy(SettingsOpacity.SurfaceTone)

/** The overall background color in Settings. */
val ColorScheme.settingsBackground: Color
    get() = surfaceContainer
+0 −5
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext

data class SettingsColorScheme(
    val background: Color = Color.Unspecified,
    val categoryTitle: Color = Color.Unspecified,
    val surface: Color = Color.Unspecified,
    val surfaceHeader: Color = Color.Unspecified,
@@ -65,7 +64,6 @@ internal fun settingsColorScheme(isDarkTheme: Boolean): SettingsColorScheme {
internal fun dynamicLightColorScheme(context: Context): SettingsColorScheme {
    val tonalPalette = dynamicTonalPalette(context)
    return SettingsColorScheme(
        background = tonalPalette.neutral95,
        categoryTitle = tonalPalette.primary40,
        surface = tonalPalette.neutral99,
        surfaceHeader = tonalPalette.neutral90,
@@ -88,7 +86,6 @@ internal fun dynamicLightColorScheme(context: Context): SettingsColorScheme {
internal fun dynamicDarkColorScheme(context: Context): SettingsColorScheme {
    val tonalPalette = dynamicTonalPalette(context)
    return SettingsColorScheme(
        background = tonalPalette.neutral10,
        categoryTitle = tonalPalette.primary90,
        surface = tonalPalette.neutral20,
        surfaceHeader = tonalPalette.neutral30,
@@ -102,7 +99,6 @@ internal fun dynamicDarkColorScheme(context: Context): SettingsColorScheme {
internal fun darkColorScheme(): SettingsColorScheme {
    val tonalPalette = tonalPalette()
    return SettingsColorScheme(
        background = tonalPalette.neutral10,
        categoryTitle = tonalPalette.primary90,
        surface = tonalPalette.neutral20,
        surfaceHeader = tonalPalette.neutral30,
@@ -116,7 +112,6 @@ internal fun darkColorScheme(): SettingsColorScheme {
internal fun lightColorScheme(): SettingsColorScheme {
    val tonalPalette = tonalPalette()
    return SettingsColorScheme(
        background = tonalPalette.neutral95,
        categoryTitle = tonalPalette.primary40,
        surface = tonalPalette.neutral99,
        surfaceHeader = tonalPalette.neutral90,
+4 −5
Original line number Diff line number Diff line
@@ -29,12 +29,11 @@ import androidx.compose.runtime.ReadOnlyComposable
@Composable
fun SettingsTheme(content: @Composable () -> Unit) {
    val isDarkTheme = isSystemInDarkTheme()
    val settingsColorScheme = settingsColorScheme(isDarkTheme)
    val colorScheme = materialColorScheme(isDarkTheme).copy(
        background = settingsColorScheme.background,
    )

    MaterialTheme(colorScheme = colorScheme, typography = rememberSettingsTypography()) {
    MaterialTheme(
        colorScheme = materialColorScheme(isDarkTheme),
        typography = rememberSettingsTypography(),
    ) {
        CompositionLocalProvider(
            LocalColorScheme provides settingsColorScheme(isDarkTheme),
            LocalContentColor provides MaterialTheme.colorScheme.onSurface,
+2 −1
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.unit.dp
import com.android.settingslib.spa.framework.theme.SettingsDimension
import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.framework.theme.settingsBackground
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.roundToInt
@@ -140,7 +141,7 @@ private fun Title(title: String, maxLines: Int = Int.MAX_VALUE) {

@Composable
private fun topAppBarColors() = TopAppBarColors(
    containerColor = MaterialTheme.colorScheme.background,
    containerColor = MaterialTheme.colorScheme.settingsBackground,
    scrolledContainerColor = SettingsTheme.colorScheme.surfaceHeader,
    navigationIconContentColor = MaterialTheme.colorScheme.onSurface,
    titleContentColor = MaterialTheme.colorScheme.onSurface,
+2 −1
Original line number Diff line number Diff line
@@ -28,13 +28,14 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.android.settingslib.spa.framework.theme.SettingsDimension
import com.android.settingslib.spa.framework.theme.settingsBackground

@Composable
fun HomeScaffold(title: String, content: @Composable () -> Unit) {
    Column(
        Modifier
            .fillMaxSize()
            .background(color = MaterialTheme.colorScheme.background)
            .background(color = MaterialTheme.colorScheme.settingsBackground)
            .systemBarsPadding()
            .verticalScroll(rememberScrollState()),
    ) {
Loading