From c805f4f2ad103d03a9b0d65ac2b6af17f929924a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Thu, 7 Mar 2024 09:38:46 +0100 Subject: [PATCH] Increase ripple contrast --- .../net/mullvad/mullvadvpn/lib/theme/Theme.kt | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt index 8d68723679c4..1e23d146b785 100644 --- a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt +++ b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt @@ -1,12 +1,16 @@ package net.mullvad.mullvadvpn.lib.theme import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.ripple.LocalRippleTheme +import androidx.compose.material.ripple.RippleAlpha +import androidx.compose.material.ripple.RippleTheme import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Shapes import androidx.compose.material3.Typography import androidx.compose.material3.darkColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.runtime.Immutable import androidx.compose.runtime.remember import androidx.compose.runtime.staticCompositionLocalOf import androidx.compose.ui.graphics.Color @@ -117,7 +121,24 @@ fun AppTheme(content: @Composable () -> Unit) { colorScheme = colors, shapes = Shapes, typography = typography, - content = content + content = { + CompositionLocalProvider(LocalRippleTheme provides MullvadRippleTheme) { content() } + } ) } } + +@Immutable +object MullvadRippleTheme : RippleTheme { + @Composable + override fun defaultColor() = RippleTheme.defaultRippleColor(Color.Black, lightTheme = false) + + @Composable + override fun rippleAlpha(): RippleAlpha = + RippleAlpha( + pressedAlpha = 0.24f, + focusedAlpha = 0.24f, + draggedAlpha = 0.16f, + hoveredAlpha = 0.08f + ) +}