MakeDepositComposable.kt (2692B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2024 Taler Systems S.A. 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 package net.taler.wallet.deposit 18 19 import androidx.compose.foundation.layout.fillMaxSize 20 import androidx.compose.foundation.layout.padding 21 import androidx.compose.foundation.lazy.LazyColumn 22 import androidx.compose.foundation.lazy.items 23 import androidx.compose.material3.Button 24 import androidx.compose.material3.Text 25 import androidx.compose.runtime.Composable 26 import androidx.compose.ui.Alignment 27 import androidx.compose.ui.Modifier 28 import androidx.compose.ui.res.stringResource 29 import androidx.compose.ui.text.style.TextAlign 30 import androidx.compose.ui.unit.dp 31 import net.taler.wallet.BottomInsetsSpacer 32 import net.taler.wallet.R 33 import net.taler.wallet.accounts.BankAccountRow 34 import net.taler.wallet.accounts.KnownBankAccountInfo 35 36 @Composable 37 fun MakeDepositComposable( 38 knownBankAccounts: List<KnownBankAccountInfo>, 39 onAccountSelected: (account: KnownBankAccountInfo) -> Unit, 40 onManageBankAccounts: () -> Unit, 41 modifier: Modifier = Modifier, 42 ) { 43 LazyColumn( 44 modifier = modifier.fillMaxSize(), 45 horizontalAlignment = Alignment.CenterHorizontally, 46 ) { 47 if (knownBankAccounts.isEmpty()) item { 48 Text( 49 modifier = Modifier.padding( 50 vertical = 32.dp, 51 horizontal = 16.dp, 52 ), 53 text = stringResource(R.string.send_deposit_known_bank_accounts_empty), 54 textAlign = TextAlign.Center, 55 ) 56 } 57 58 items(knownBankAccounts, key = { it.bankAccountId }) { 59 BankAccountRow(it, 60 showMenu = false, 61 onClick = { onAccountSelected(it) }, 62 ) 63 } 64 65 item { 66 Button( 67 modifier = Modifier.padding(16.dp), 68 onClick = onManageBankAccounts, 69 ) { 70 Text(stringResource(R.string.send_deposit_account_manage)) 71 } 72 } 73 74 item { 75 BottomInsetsSpacer() 76 } 77 } 78 }