diff options
| author | saber safavi <saber.safavi@codic.se> | 2023-03-28 16:24:31 +0200 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2023-04-11 11:14:10 +0200 |
| commit | 7291ced21ca2cd0b50018be901b0aaf6fab29f92 (patch) | |
| tree | 5a962a672c1d5d2f57e48f00fd426c1529f2d8b3 /android | |
| parent | ad01e9c554e875dac87cd5f1fcd851d16ee74909 (diff) | |
| download | mullvadvpn-7291ced21ca2cd0b50018be901b0aaf6fab29f92.tar.xz mullvadvpn-7291ced21ca2cd0b50018be901b0aaf6fab29f92.zip | |
Support enabling/disabling switch compose cell
Co-authored-by: Albin <albin@mullvad.net>
Diffstat (limited to 'android')
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt | 11 | ||||
| -rw-r--r-- | android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt index e07a34bef1..bab992bcc1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt @@ -26,6 +26,7 @@ fun BaseCell( title: @Composable () -> Unit, bodyView: @Composable () -> Unit, modifier: Modifier = Modifier, + isRowEnabled: Boolean = true, onCellClicked: () -> Unit = {}, subtitle: @Composable (() -> Unit)? = null, subtitleModifier: Modifier = Modifier, @@ -38,13 +39,19 @@ fun BaseCell( val subtitleVerticalSpacing = dimensionResource(id = R.dimen.cell_footer_top_padding) Column(modifier = Modifier.fillMaxWidth().wrapContentHeight().background(background)) { + val rowModifier = + Modifier.let { + if (isRowEnabled) { + it.clickable { onCellClicked() } + } else it + } Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start, modifier = - Modifier.height(cellHeight) + rowModifier + .height(cellHeight) .fillMaxWidth() - .clickable { onCellClicked.invoke() } .padding(start = startPadding, end = endPadding) ) { title() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt index 1112ae01b3..e41fed10ad 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt @@ -58,6 +58,7 @@ fun SwitchComposeCell( BaseCell( title = { SwitchCellTitle(title = title, modifier = titleModifier) }, + isRowEnabled = isEnabled, bodyView = { SwitchCellView( onSwitchClicked = null, |
