Displaying if a bank is supported or not
This commit is contained in:
parent
f29e4b5fcc
commit
a5a27c7781
|
@ -74,6 +74,7 @@ kotlin {
|
|||
implementation(compose.runtime)
|
||||
implementation(compose.foundation)
|
||||
implementation(compose.material)
|
||||
implementation(compose.materialIconsExtended)
|
||||
implementation(compose.ui)
|
||||
implementation(compose.components.resources)
|
||||
implementation(compose.components.uiToolingPreview)
|
||||
|
|
|
@ -2,8 +2,12 @@ package net.codinux.banking.ui.dialogs
|
|||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.CheckCircle
|
||||
import androidx.compose.material.icons.filled.Clear
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
|
@ -16,12 +20,16 @@ import net.codinux.banking.ui.IOorDefault
|
|||
import net.codinux.banking.ui.composables.BankIcon
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
import net.codinux.banking.ui.config.DI
|
||||
import net.codinux.banking.ui.forms.*
|
||||
import net.codinux.banking.ui.forms.AutocompleteTextField
|
||||
import net.codinux.banking.ui.forms.OutlinedTextField
|
||||
import net.codinux.banking.ui.forms.PasswordTextField
|
||||
import net.codinux.banking.ui.model.BankInfo
|
||||
|
||||
|
||||
private val bankingService = DI.bankingService
|
||||
|
||||
private val iconSize = 36.dp
|
||||
|
||||
@Composable
|
||||
fun AddAccountDialog(
|
||||
onDismiss: () -> Unit,
|
||||
|
@ -35,6 +43,8 @@ fun AddAccountDialog(
|
|||
derivedStateOf { selectedBank != null && loginName.length > 3 && password.length > 3 }
|
||||
}
|
||||
|
||||
val disabledColor: Color = MaterialTheme.colors.onSurface.copy(ContentAlpha.disabled)
|
||||
|
||||
var isAddingAccount by remember { mutableStateOf(false) }
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
@ -79,21 +89,37 @@ fun AddAccountDialog(
|
|||
getItemTitle = { bank -> bank.name },
|
||||
fetchSuggestions = { query -> bankingService.findBanks(query) }
|
||||
) { bank ->
|
||||
Row {
|
||||
BankIcon(bank, Modifier.padding(end = 6.dp))
|
||||
val supportsFinTs = bank.supportsFinTs3_0
|
||||
val textColor = if (supportsFinTs) Color.Unspecified else disabledColor
|
||||
|
||||
Text(
|
||||
bank.name,
|
||||
Modifier.fillMaxWidth(),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
Row(Modifier.fillMaxWidth()) {
|
||||
Column(Modifier.fillMaxHeight().width(iconSize).align(Alignment.CenterVertically)) {
|
||||
if (supportsFinTs) {
|
||||
Icon(Icons.Filled.CheckCircle, "Bank unterstützt FinTS 3.0", tint = Colors.Accent, modifier = Modifier.size(iconSize))
|
||||
} else {
|
||||
Icon(Icons.Filled.Clear, "Bank unterstützt FinTS 3.0 nicht", tint = Colors.Red600, modifier = Modifier.size(iconSize))
|
||||
}
|
||||
}
|
||||
|
||||
Row(Modifier.fillMaxWidth().padding(top = 8.dp)) {
|
||||
Text(bank.bankCode)
|
||||
Column(Modifier.fillMaxWidth().weight(1f).padding(start = 8.dp)) {
|
||||
Row {
|
||||
BankIcon(bank, Modifier.padding(end = 6.dp))
|
||||
|
||||
Text("${bank.postalCode} ${bank.city}", Modifier.weight(1f).padding(start = 8.dp), color = Color.Gray)
|
||||
Text(
|
||||
bank.name,
|
||||
Modifier.fillMaxWidth(),
|
||||
color = textColor,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
|
||||
Row(Modifier.fillMaxWidth().padding(top = 6.dp)) {
|
||||
Text(bank.bankCode, color = textColor)
|
||||
|
||||
Text("${bank.postalCode} ${bank.city}", Modifier.weight(1f).padding(start = 8.dp), color = if (supportsFinTs) Color.Gray else textColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue