Wasn't aware of ExposedDropdownMenuDefaults.TrailingIcon, using now that one instead of implementing the functionality by myself
This commit is contained in:
parent
d22ff34a37
commit
5a49e48ea8
|
@ -88,7 +88,7 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
||||||
|
|
||||||
Row(Modifier.padding(top = 16.dp)) {
|
Row(Modifier.padding(top = 16.dp)) {
|
||||||
Select(
|
Select(
|
||||||
"TAN Verfahren", "Alle TAN Medien anzeigen",
|
"TAN Verfahren",
|
||||||
challenge.availableTanMethods.sortedBy { it.identifier },
|
challenge.availableTanMethods.sortedBy { it.identifier },
|
||||||
challenge.selectedTanMethod,
|
challenge.selectedTanMethod,
|
||||||
{ Log.info { "User selected TanMethod $it" } }, // TODO: change TanMethod
|
{ Log.info { "User selected TanMethod $it" } }, // TODO: change TanMethod
|
||||||
|
@ -99,7 +99,7 @@ fun EnterTanDialog(tanChallengeReceived: TanChallengeReceived, onDismiss: () ->
|
||||||
if (challenge.availableTanMedia.isNotEmpty()) {
|
if (challenge.availableTanMedia.isNotEmpty()) {
|
||||||
Row(Modifier.padding(top = 16.dp)) {
|
Row(Modifier.padding(top = 16.dp)) {
|
||||||
Select(
|
Select(
|
||||||
"TAN Medium", "Alle TAN Medien anzeigen",
|
"TAN Medium",
|
||||||
challenge.availableTanMedia.sortedBy { it.status }.map { it.displayName },
|
challenge.availableTanMedia.sortedBy { it.status }.map { it.displayName },
|
||||||
challenge.selectedTanMedium?.displayName ?: "<Keines ausgewählt>",
|
challenge.selectedTanMedium?.displayName ?: "<Keines ausgewählt>",
|
||||||
{ Log.info { "User selected TanMedium $it" } }, // TODO: change TanMethod
|
{ Log.info { "User selected TanMedium $it" } }, // TODO: change TanMethod
|
||||||
|
|
|
@ -118,7 +118,7 @@ fun TransferMoneyDialog(
|
||||||
) {
|
) {
|
||||||
if (accountsSupportingTransferringMoney.size > 1) {
|
if (accountsSupportingTransferringMoney.size > 1) {
|
||||||
Select(
|
Select(
|
||||||
"Konto", "Alle Konten anzeigen",
|
"Konto",
|
||||||
accountsSupportingTransferringMoney, senderAccount, { senderAccount = it },
|
accountsSupportingTransferringMoney, senderAccount, { senderAccount = it },
|
||||||
{ account -> "${accountsToUserAccount[account]?.displayName} ${account.displayName}" },
|
{ account -> "${accountsToUserAccount[account]?.displayName} ${account.displayName}" },
|
||||||
{ BankIcon(accountsToUserAccount[senderAccount]) }
|
{ BankIcon(accountsToUserAccount[senderAccount]) }
|
||||||
|
|
|
@ -2,9 +2,6 @@ package net.codinux.banking.ui.forms
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.icons.Icons
|
|
||||||
import androidx.compose.material.icons.filled.ArrowDropDown
|
|
||||||
import androidx.compose.material.icons.filled.ArrowDropUp
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
||||||
|
@ -12,7 +9,6 @@ import androidx.compose.ui.Modifier
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> Select(
|
fun <T> Select(
|
||||||
label: String,
|
label: String,
|
||||||
contentDescription: String,
|
|
||||||
items: Collection<T>,
|
items: Collection<T>,
|
||||||
selectedItem: T,
|
selectedItem: T,
|
||||||
onSelectedItemChanged: (T) -> Unit,
|
onSelectedItemChanged: (T) -> Unit,
|
||||||
|
@ -30,13 +26,7 @@ fun <T> Select(
|
||||||
label = { Text(label) },
|
label = { Text(label) },
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
trailingIcon = {
|
trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(showDropDownMenu) },
|
||||||
if (showDropDownMenu) {
|
|
||||||
Icon(Icons.Filled.ArrowDropUp, contentDescription)
|
|
||||||
} else {
|
|
||||||
Icon(Icons.Filled.ArrowDropDown, contentDescription)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
leadingIcon = leadingIcon
|
leadingIcon = leadingIcon
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue