diff options
| author | Kalle Lindström <karl.lindstrom@mullvad.net> | 2026-04-22 09:17:52 +0200 |
|---|---|---|
| committer | Kalle Lindström <karl.lindstrom@mullvad.net> | 2026-04-22 13:57:44 +0200 |
| commit | 0ef58af29eeed5e29b7a4785eaa600196438e98e (patch) | |
| tree | 32439dbcf65ad6aa84a1695f9a982a9e02caf6db | |
| parent | 460af938b72be68812724ddcc02e99dc242c9993 (diff) | |
| download | mullvadvpn-0ef58af29eeed5e29b7a4785eaa600196438e98e.tar.xz mullvadvpn-0ef58af29eeed5e29b7a4785eaa600196438e98e.zip | |
Refactor setting visibility alpha
7 files changed, 14 insertions, 18 deletions
diff --git a/android/lib/feature/apiaccess/impl/build.gradle.kts b/android/lib/feature/apiaccess/impl/build.gradle.kts index 3baa370158..9f59084a47 100644 --- a/android/lib/feature/apiaccess/impl/build.gradle.kts +++ b/android/lib/feature/apiaccess/impl/build.gradle.kts @@ -12,6 +12,7 @@ dependencies { implementation(projects.lib.feature.apiaccess.api) implementation(projects.lib.navigation) implementation(projects.lib.repository) + implementation(projects.lib.ui.util) implementation(libs.koin.compose) implementation(libs.arrow) diff --git a/android/lib/feature/apiaccess/impl/src/main/java/net/mullvad/mullvadvpn/feature/apiaccess/impl/screen/edit/EditApiAccessMethodScreen.kt b/android/lib/feature/apiaccess/impl/src/main/java/net/mullvad/mullvadvpn/feature/apiaccess/impl/screen/edit/EditApiAccessMethodScreen.kt index 59888c0528..1dbec14dd8 100644 --- a/android/lib/feature/apiaccess/impl/src/main/java/net/mullvad/mullvadvpn/feature/apiaccess/impl/screen/edit/EditApiAccessMethodScreen.kt +++ b/android/lib/feature/apiaccess/impl/src/main/java/net/mullvad/mullvadvpn/feature/apiaccess/impl/screen/edit/EditApiAccessMethodScreen.kt @@ -80,6 +80,7 @@ import net.mullvad.mullvadvpn.lib.ui.theme.Dimens import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaInvisible import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaScrollbar import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaVisible +import net.mullvad.mullvadvpn.lib.ui.util.visible import org.koin.androidx.compose.koinViewModel import org.koin.core.parameter.parametersOf @@ -341,10 +342,7 @@ private fun ApiAccessMethodTypeSelection( contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha( - if (item == formData.apiAccessMethodTypes) AlphaVisible - else AlphaInvisible - ), + .visible(item == formData.apiAccessMethodTypes), ) }, ) @@ -564,7 +562,7 @@ private fun CipherSelection(cipher: Cipher, onCipherChange: (Cipher) -> Unit) { contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha(if (item == cipher) AlphaVisible else AlphaInvisible), + .visible(item == cipher), ) }, ) @@ -602,7 +600,7 @@ private fun EnableAuthentication( contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha(if (authenticationEnabled) AlphaVisible else AlphaInvisible), + .visible(authenticationEnabled), ) }, ) @@ -619,9 +617,7 @@ private fun EnableAuthentication( contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha( - if (authenticationEnabled.not()) AlphaVisible else AlphaInvisible - ), + .alpha(if (authenticationEnabled) AlphaInvisible else AlphaVisible), ) }, ) diff --git a/android/lib/feature/autoconnect/impl/build.gradle.kts b/android/lib/feature/autoconnect/impl/build.gradle.kts index 912bd3b1bd..996b14b8d2 100644 --- a/android/lib/feature/autoconnect/impl/build.gradle.kts +++ b/android/lib/feature/autoconnect/impl/build.gradle.kts @@ -10,6 +10,7 @@ android { namespace = "net.mullvad.mullvadvpn.feature.autoconnect.impl" } dependencies { implementation(projects.lib.feature.autoconnect.api) + implementation(projects.lib.ui.util) implementation(libs.koin.compose) implementation(libs.arrow) diff --git a/android/lib/feature/autoconnect/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/autoconnect/impl/AutoConnectAndLockdownModeScreen.kt b/android/lib/feature/autoconnect/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/autoconnect/impl/AutoConnectAndLockdownModeScreen.kt index a1d0ac8c5b..8c8d4761a5 100644 --- a/android/lib/feature/autoconnect/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/autoconnect/impl/AutoConnectAndLockdownModeScreen.kt +++ b/android/lib/feature/autoconnect/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/autoconnect/impl/AutoConnectAndLockdownModeScreen.kt @@ -36,7 +36,6 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.platform.LocalContext @@ -72,9 +71,8 @@ import net.mullvad.mullvadvpn.lib.ui.designsystem.PrimaryButton import net.mullvad.mullvadvpn.lib.ui.resource.R import net.mullvad.mullvadvpn.lib.ui.theme.AppTheme import net.mullvad.mullvadvpn.lib.ui.theme.Dimens -import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaInvisible import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaScrollbar -import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaVisible +import net.mullvad.mullvadvpn.lib.ui.util.visible import org.koin.androidx.compose.koinViewModel @Preview("OSS|Play") @@ -268,7 +266,7 @@ private fun CarouselNavigationButton( imageVector: ImageVector, ) { IconButton( - modifier = modifier.alpha(if (isEnabled.invoke()) AlphaVisible else AlphaInvisible), + modifier = modifier.visible(isEnabled.invoke()), onClick = onClick, enabled = isEnabled.invoke(), ) { diff --git a/android/lib/feature/home/impl/build.gradle.kts b/android/lib/feature/home/impl/build.gradle.kts index 7b27e30b81..be15bee07c 100644 --- a/android/lib/feature/home/impl/build.gradle.kts +++ b/android/lib/feature/home/impl/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { implementation(projects.lib.pushNotification) implementation(projects.lib.repository) implementation(projects.lib.tv) + implementation(projects.lib.ui.util) implementation(projects.lib.usecase) implementation(libs.androidx.animation) diff --git a/android/lib/feature/home/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/home/impl/connect/ConnectScreen.kt b/android/lib/feature/home/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/home/impl/connect/ConnectScreen.kt index 267b7162c9..7364e1f1a9 100644 --- a/android/lib/feature/home/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/home/impl/connect/ConnectScreen.kt +++ b/android/lib/feature/home/impl/src/main/kotlin/net/mullvad/mullvadvpn/feature/home/impl/connect/ConnectScreen.kt @@ -129,10 +129,9 @@ import net.mullvad.mullvadvpn.lib.ui.theme.Dimens import net.mullvad.mullvadvpn.lib.ui.theme.Shapes import net.mullvad.mullvadvpn.lib.ui.theme.color.Alpha20 import net.mullvad.mullvadvpn.lib.ui.theme.color.Alpha80 -import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaInvisible import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaScrollbar -import net.mullvad.mullvadvpn.lib.ui.theme.color.AlphaVisible import net.mullvad.mullvadvpn.lib.ui.theme.color.positive +import net.mullvad.mullvadvpn.lib.ui.util.visible import org.koin.androidx.compose.koinViewModel private const val CONNECT_BUTTON_THROTTLE_MILLIS = 1000 @@ -444,7 +443,7 @@ private fun Content( ) } } - .alpha(if (state.showLoading) AlphaVisible else AlphaInvisible), + .visible(state.showLoading), ) Box( diff --git a/android/lib/ui/resource/src/main/res/values/strings.xml b/android/lib/ui/resource/src/main/res/values/strings.xml index 96f0b13de3..ccafabfc04 100644 --- a/android/lib/ui/resource/src/main/res/values/strings.xml +++ b/android/lib/ui/resource/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ -<resources> +<resources xmlns:tools="http://schemas.android.com/tools"> <string name="disconnecting">Disconnecting...</string> <string name="blocking">Blocking...</string> <string name="critical_error">Critical error (your attention is required)</string> @@ -132,7 +132,7 @@ <string name="custom_dns_footer">Enable to add at least one DNS server.</string> <string name="confirm_local_dns">The local DNS server will not work unless you enable \"Local Network Sharing\" under VPN settings.</string> <string name="exclude_applications">Excluded applications</string> - <string name="x_out_of_y">%1$d out of %2$d</string> + <string name="x_out_of_y" tools:ignore="PluralsCandidate">%1$d out of %2$d</string> <string name="all_applications">All applications</string> <string name="show_system_apps">Show system apps</string> <string name="toggle_vpn">Toggle VPN</string> |
