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

Commit 521529b5 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Remove customized SettingsRippleTheme

Which not allowed in androidx.compose.material.ripple library anymore.

And by removing this, we can follow material3, and align with other
parts in  Settings.

Using LocalContentColor provides MaterialTheme.colorScheme.onSurface
to fix ripple color instead.

Fix: 313682621
Test: visual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:cb737f8159198f111429be693f73abb11c352c5f)
Merged-In: I7337d25889c4091ae8d3c063caa30cbf1edd4930
Change-Id: I7337d25889c4091ae8d3c063caa30cbf1edd4930
parent 0aefb325
Loading
Loading
Loading
Loading
+2 −20
Original line number Diff line number Diff line
@@ -17,9 +17,7 @@
package com.android.settingslib.spa.framework.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
@@ -39,7 +37,7 @@ fun SettingsTheme(content: @Composable () -> Unit) {
    MaterialTheme(colorScheme = colorScheme, typography = rememberSettingsTypography()) {
        CompositionLocalProvider(
            LocalColorScheme provides settingsColorScheme(isDarkTheme),
            LocalRippleTheme provides SettingsRippleTheme,
            LocalContentColor provides MaterialTheme.colorScheme.onSurface,
        ) {
            content()
        }
@@ -52,19 +50,3 @@ object SettingsTheme {
        @ReadOnlyComposable
        get() = LocalColorScheme.current
}

private object SettingsRippleTheme : RippleTheme {
    @Composable
    override fun defaultColor() = MaterialTheme.colorScheme.onSurface

    @Composable
    override fun rippleAlpha() = RippleAlpha
}

/** Alpha levels for all content. */
private val RippleAlpha = RippleAlpha(
    pressedAlpha = 0.48f,
    focusedAlpha = 0.48f,
    draggedAlpha = 0.32f,
    hoveredAlpha = 0.16f,
)