Skip to content

Commit 1c6d12f

Browse files
committed
Merge branch 'investigate-improving-contrast-of-focus-highlight-droid-649'
2 parents bed06a1 + e628186 commit 1c6d12f

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ Line wrap the file at 100 chars. Th
3232
- Add toggle for enabling or disabling split tunneling.
3333
- Replace auto connect with auto connect and lockdown mode guide on platforms that has
3434
system vpn settings.
35-
- Add 3D map to Connect screen.
35+
- Add 3D map to Connect screen.
3636

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

4141
#### Android
4242
- Migrate to Compose Navigation which also improves screen transition animations.
43+
- Increase focus highlight opacity
4344

4445
### Fixed
4546
- Continual excessive attempts to update the API IP were made after testing access methods.

android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package net.mullvad.mullvadvpn.lib.theme
22

33
import androidx.compose.foundation.shape.RoundedCornerShape
4+
import androidx.compose.material.ripple.LocalRippleTheme
5+
import androidx.compose.material.ripple.RippleAlpha
6+
import androidx.compose.material.ripple.RippleTheme
7+
import androidx.compose.material3.LocalContentColor
48
import androidx.compose.material3.MaterialTheme
59
import androidx.compose.material3.Shapes
610
import androidx.compose.material3.Typography
711
import androidx.compose.material3.darkColorScheme
812
import androidx.compose.runtime.Composable
913
import androidx.compose.runtime.CompositionLocalProvider
14+
import androidx.compose.runtime.Immutable
1015
import androidx.compose.runtime.remember
1116
import androidx.compose.runtime.staticCompositionLocalOf
1217
import androidx.compose.ui.graphics.Color
@@ -97,6 +102,21 @@ val Shapes =
97102
val Dimens: Dimensions
98103
@Composable get() = LocalAppDimens.current
99104

105+
private object StateTokens {
106+
const val DraggedStateLayerOpacity = 0.16f // 0.16f (Material default)
107+
const val FocusStateLayerOpacity = 0.24f // 0.12f (Material default)
108+
const val HoverStateLayerOpacity = 0.08f // 0.08f (Material default)
109+
const val PressedStateLayerOpacity = 0.12f // 0.12f (Material default)
110+
}
111+
112+
private val rippleAlpha =
113+
RippleAlpha(
114+
pressedAlpha = StateTokens.PressedStateLayerOpacity,
115+
focusedAlpha = StateTokens.FocusStateLayerOpacity,
116+
draggedAlpha = StateTokens.DraggedStateLayerOpacity,
117+
hoveredAlpha = StateTokens.HoverStateLayerOpacity
118+
)
119+
100120
@Composable
101121
fun ProvideDimens(dimensions: Dimensions, content: @Composable () -> Unit) {
102122
val dimensionSet = remember { dimensions }
@@ -117,7 +137,16 @@ fun AppTheme(content: @Composable () -> Unit) {
117137
colorScheme = colors,
118138
shapes = Shapes,
119139
typography = typography,
120-
content = content
140+
content = {
141+
CompositionLocalProvider(LocalRippleTheme provides MullvadRippleTheme) { content() }
142+
}
121143
)
122144
}
123145
}
146+
147+
@Immutable
148+
object MullvadRippleTheme : RippleTheme {
149+
@Composable override fun defaultColor() = LocalContentColor.current
150+
151+
@Composable override fun rippleAlpha() = rippleAlpha
152+
}

0 commit comments

Comments
 (0)