Add disabled group options

This commit is contained in:
andrew 2023-08-28 09:37:19 +09:30
parent 9f6dd728d5
commit bfd2370730
2 changed files with 4 additions and 1 deletions

View File

@ -285,6 +285,7 @@ fun TitledRadioButton(option: OptionModel) {
} }
RadioButton( RadioButton(
selected = option.selected, selected = option.selected,
enabled = option.enabled,
onClick = option.onClick, onClick = option.onClick,
modifier = Modifier modifier = Modifier
.height(26.dp) .height(26.dp)

View File

@ -142,7 +142,8 @@ class ExpirationSettingsViewModel(
title: GetString = GetString { ExpirationUtil.getExpirationDisplayValue(it, duration.inWholeSeconds.toInt()) }, title: GetString = GetString { ExpirationUtil.getExpirationDisplayValue(it, duration.inWholeSeconds.toInt()) },
) = OptionModel( ) = OptionModel(
title = title, title = title,
selected = state.expiryMode?.duration == duration selected = state.expiryMode?.duration == duration,
enabled = state.isSelfAdmin
) { setTime(duration.inWholeSeconds) } ) { setTime(duration.inWholeSeconds) }
private fun noteToSelfOption( private fun noteToSelfOption(
@ -244,6 +245,7 @@ data class OptionModel(
val title: GetString, val title: GetString,
val subtitle: GetString? = null, val subtitle: GetString? = null,
val selected: Boolean = false, val selected: Boolean = false,
val enabled: Boolean = true,
val onClick: () -> Unit = {} val onClick: () -> Unit = {}
) )