From c6e6acf13cfa3e5eb86762cfe5736ea6a65bdc53 Mon Sep 17 00:00:00 2001 From: dankl Date: Sat, 11 Jan 2020 23:18:46 +0100 Subject: [PATCH] Added convenience property bankAccounts --- .../net/dankito/banking/ui/presenter/MainWindowPresenter.kt | 3 +++ .../fints4java/android/ui/dialogs/TransferMoneyDialog.kt | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt index 1085631d..4d485f54 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt @@ -240,6 +240,9 @@ open class MainWindowPresenter( open val accounts: List get() = clientsForAccounts.keys.toList() + open val bankAccounts: List + get() = accounts.flatMap { it.bankAccounts } + open val allTransactions: List get() = clientsForAccounts.keys.flatMap { it.transactions }.sortedByDescending { it.bookingDate } // TODO: someday add unbooked transactions diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt index 2b31e20d..18249a01 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt @@ -12,14 +12,15 @@ import android.view.ViewGroup import kotlinx.android.synthetic.main.dialog_transfer_money.* import kotlinx.android.synthetic.main.dialog_transfer_money.view.* import net.dankito.banking.fints4java.android.R -import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.BankAccountsAdapter import net.dankito.banking.fints4java.android.ui.listener.ListItemSelectedListener import net.dankito.banking.ui.model.BankAccount import net.dankito.banking.ui.model.parameters.TransferMoneyData import net.dankito.banking.ui.model.responses.BankingClientResponse +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.fints.messages.segmente.implementierte.sepa.ISepaMessageCreator import net.dankito.fints.messages.segmente.implementierte.sepa.SepaMessageCreator +import net.dankito.fints.model.BankInfo import net.dankito.utils.android.extensions.asActivity import java.math.BigDecimal @@ -69,7 +70,7 @@ open class TransferMoneyDialog : DialogFragment() { protected open fun setupUI(rootView: View) { setPreselectedValues(rootView) - val allBankAccounts = presenter.accounts.flatMap { it.bankAccounts } + val allBankAccounts = presenter.bankAccounts bankAccount = preselectedBankAccount ?: allBankAccounts.first() if (allBankAccounts.size > 1) {