diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt index 35d4abfd..3576efe6 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/dialogs/TransferMoneyDialog.kt @@ -108,7 +108,7 @@ open class TransferMoneyDialog : DialogFragment() { } protected open fun setupUI(rootView: View) { - val accountsSupportingTransferringMoney = presenter.accountsSupportingTransferringMoney + val accountsSupportingTransferringMoney = presenter.accountsSupportingTransferringMoneySortedByDisplayIndex account = preselectedValues?.account ?: accountsSupportingTransferringMoney.first() if (accountsSupportingTransferringMoney.size > 1) { diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/TransferMoneyDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/TransferMoneyDialog.kt index 5f53dceb..e87d1b2c 100644 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/TransferMoneyDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/cashtransfer/TransferMoneyDialog.kt @@ -47,7 +47,7 @@ open class TransferMoneyDialog @JvmOverloads constructor( } - protected val bankAccountsSupportingTransferringMoney = FXCollections.observableArrayList(presenter.allAccounts.filter { it.supportsTransferringMoney }) + protected val bankAccountsSupportingTransferringMoney = FXCollections.observableArrayList(presenter.accountsSupportingTransferringMoneySortedByDisplayIndex) protected val selectedBankAccount = SimpleObjectProperty(preselectedValues?.account ?: bankAccountsSupportingTransferringMoney.firstOrNull()) diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/comparator/BankAccountComparator.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/comparator/BankAccountComparator.kt new file mode 100644 index 00000000..5aba75cc --- /dev/null +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/comparator/BankAccountComparator.kt @@ -0,0 +1,16 @@ +package net.dankito.banking.ui.comparator + +import net.dankito.banking.ui.model.TypedBankAccount + + +open class BankAccountComparator : Comparator { + + override fun compare(a: TypedBankAccount, b: TypedBankAccount): Int { + if (a.bank.displayIndex == b.bank.displayIndex) { + return a.displayIndex.compareTo(b.displayIndex) + } + + return a.bank.displayIndex.compareTo(b.bank.displayIndex) + } + +} \ No newline at end of file diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt index eead0ad4..5e6483dd 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -15,6 +15,7 @@ import net.dankito.banking.bankfinder.BankInfo import net.dankito.banking.search.ITransactionPartySearcher import net.dankito.banking.search.NoOpTransactionPartySearcher import net.dankito.banking.search.TransactionParty +import net.dankito.banking.ui.comparator.BankAccountComparator import net.dankito.banking.ui.model.mapper.DefaultModelCreator import net.dankito.banking.ui.model.mapper.IModelCreator import net.dankito.banking.ui.model.moneytransfer.ExtractTransferMoneyDataFromPdfResult @@ -750,6 +751,10 @@ open class BankingPresenter( open val accountsSupportingTransferringMoney: List get() = allAccounts.filter { it.supportsTransferringMoney } + open val accountsSupportingTransferringMoneySortedByDisplayIndex: List + get() = accountsSupportingTransferringMoney + .sortedWith(BankAccountComparator()) + open val hasAccountsSupportTransferringMoney: Boolean get() = doAccountsSupportTransferringMoney(allAccounts) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/TransferMoneyDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/TransferMoneyDialog.swift index ea6e48d6..c9a072ef 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/TransferMoneyDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/dialogs/TransferMoneyDialog.swift @@ -71,7 +71,7 @@ struct TransferMoneyDialog: View { init() { - self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoney + self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoneySortedByDisplayIndex self.showAccounts = self.accountsSupportingTransferringMoney.count > 1 }