Showing unsupported account types as disabled

This commit is contained in:
dankito 2024-09-17 02:23:38 +02:00
parent 75ccc648c5
commit 09a1a41c20
1 changed files with 20 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ContentAlpha
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
@ -49,10 +50,24 @@ fun NavigationMenuItem(
val showColoredAmounts by DI.uiSettings.showColoredAmounts.collectAsState()
val isUnsupportedAccountType = bankAccount?.isAccountTypeSupportedByApplication == false
val effectiveText = if (isUnsupportedAccountType) "$text (nicht unterstützt)" else text
val effectiveTextColor = if (isUnsupportedAccountType) textColor.copy(ContentAlpha.disabled) else textColor
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = modifier
.clickable { onClick?.invoke() }
modifier = modifier.let {
if (isUnsupportedAccountType == false) {
it.clickable {
onClick?.invoke()
}
} else {
it
}
}
.let {
if (bank != null && filterService.isSelected(bank, transactionsFilter)
|| bankAccount != null && filterService.isSelected(bankAccount, transactionsFilter)) {
@ -68,12 +83,12 @@ fun NavigationMenuItem(
icon()
}
} else {
BankIcon(bank, Modifier.padding(end = iconTextSpacing), Modifier.size(iconSize), fallbackIcon = fallbackIcon, fallbackIconTintColor = textColor)
BankIcon(bank, Modifier.padding(end = iconTextSpacing), Modifier.size(iconSize), fallbackIcon = fallbackIcon, fallbackIconTintColor = effectiveTextColor)
}
Text(text, color = textColor, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)
Text(effectiveText, color = effectiveTextColor, modifier = Modifier.weight(1f), maxLines = 1, overflow = TextOverflow.Ellipsis)
val balance = if (showBalance == false) {
val balance = if (showBalance == false || isUnsupportedAccountType) {
null
} else if (bankAccount != null) {
bankAccount.balance