From f5072fe8ceac02b83b9ac3d23e058e2b33cf1d13 Mon Sep 17 00:00:00 2001 From: Albin Date: Tue, 3 Sep 2024 09:39:57 +0200 Subject: [PATCH] Set daita chip to disabled --- .../mullvadvpn/compose/cell/FilterRow.kt | 6 ++--- .../compose/component/FilterChip.kt | 23 +++++++++++++++---- .../compose/state/SelectLocationUiState.kt | 2 +- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt index 43e95c044878..d3e233c67b75 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt @@ -68,7 +68,7 @@ fun ProviderFilterChip(providers: Int, onRemoveClick: () -> Unit) { MullvadFilterChip( text = stringResource(id = R.string.number_of_providers, providers), onRemoveClick = onRemoveClick, - showIcon = true, + enabled = true, ) } @@ -77,7 +77,7 @@ fun OwnershipFilterChip(ownership: Ownership, onRemoveClick: () -> Unit) { MullvadFilterChip( text = stringResource(ownership.stringResources()), onRemoveClick = onRemoveClick, - showIcon = true, + enabled = true, ) } @@ -86,7 +86,7 @@ fun DaitaFilterChip() { MullvadFilterChip( text = stringResource(id = R.string.setting_chip, stringResource(id = R.string.daita)), onRemoveClick = {}, - showIcon = false, + enabled = false, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt index 11916ebdf3c5..c4f6f90cdea7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt @@ -19,12 +19,24 @@ import net.mullvad.mullvadvpn.lib.theme.shape.chipShape @Preview @Composable -private fun PreviewMullvadFilterChip() { +private fun PreviewEnabledMullvadFilterChip() { AppTheme { MullvadFilterChip( text = stringResource(id = R.string.number_of_providers), onRemoveClick = {}, - showIcon = true, + enabled = true, + ) + } +} + +@Preview +@Composable +private fun PreviewDisabledMullvadFilterChip() { + AppTheme { + MullvadFilterChip( + text = stringResource(id = R.string.number_of_providers), + onRemoveClick = {}, + enabled = false, ) } } @@ -37,14 +49,17 @@ fun MullvadFilterChip( iconColor: Color = MaterialTheme.colorScheme.onPrimary, text: String, onRemoveClick: () -> Unit, - showIcon: Boolean, + enabled: Boolean, ) { InputChip( + enabled = enabled, shape = MaterialTheme.shapes.chipShape, colors = FilterChipDefaults.filterChipColors( containerColor = containerColor, + disabledContainerColor = containerColor, labelColor = labelColor, + disabledLabelColor = labelColor, iconColor = iconColor, ), border = @@ -57,7 +72,7 @@ fun MullvadFilterChip( onClick = onRemoveClick, label = { Text(text = text, style = MaterialTheme.typography.labelMedium) }, trailingIcon = { - if (showIcon) { + if (enabled) { Icon( painter = painterResource(id = R.drawable.icon_close), contentDescription = null, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt index 965c876a9e9d..d8245792a330 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt @@ -23,7 +23,7 @@ sealed interface FilterChip { data class Provider(val count: Int) : FilterChip - object Daita : FilterChip + data object Daita : FilterChip } enum class RelayListItemContentType {