Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase ripple contrast #5911

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ Line wrap the file at 100 chars. Th
- Add toggle for enabling or disabling split tunneling.
- Replace auto connect with auto connect and lockdown mode guide on platforms that has
system vpn settings.
- Add 3D map to Connect screen.
- Add 3D map to Connect screen.

### Changed
- Change default obfuscation setting to `auto`.
- Migrate obfuscation settings for existing users from `off` to `auto`.

#### Android
- Migrate to Compose Navigation which also improves screen transition animations.
- Increase focus highlight opacity

### Fixed
- Continual excessive attempts to update the API IP were made after testing access methods.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
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.LocalContentColor
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
Expand Down Expand Up @@ -97,6 +102,21 @@ val Shapes =
val Dimens: Dimensions
@Composable get() = LocalAppDimens.current

private object StateTokens {
const val DraggedStateLayerOpacity = 0.16f // 0.16f (Material default)
const val FocusStateLayerOpacity = 0.24f // 0.12f (Material default)
const val HoverStateLayerOpacity = 0.08f // 0.08f (Material default)
const val PressedStateLayerOpacity = 0.12f // 0.12f (Material default)
}

private val rippleAlpha =
RippleAlpha(
pressedAlpha = StateTokens.PressedStateLayerOpacity,
focusedAlpha = StateTokens.FocusStateLayerOpacity,
draggedAlpha = StateTokens.DraggedStateLayerOpacity,
hoveredAlpha = StateTokens.HoverStateLayerOpacity
)

@Composable
fun ProvideDimens(dimensions: Dimensions, content: @Composable () -> Unit) {
val dimensionSet = remember { dimensions }
Expand All @@ -117,7 +137,16 @@ 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() = LocalContentColor.current

@Composable override fun rippleAlpha() = rippleAlpha
}
Loading