Implemented displaying selected account / bank account
This commit is contained in:
parent
0699eaf977
commit
21b90585e0
|
@ -20,6 +20,7 @@ import net.dankito.fints.banks.BankFinder
|
|||
import net.dankito.fints.model.BankInfo
|
||||
import net.dankito.utils.IThreadPool
|
||||
import net.dankito.utils.ThreadPool
|
||||
import net.dankito.utils.extensions.containsExactly
|
||||
import net.dankito.utils.extensions.ofMaxLength
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.io.File
|
||||
|
@ -50,6 +51,8 @@ open class BankingPresenter(
|
|||
|
||||
protected var selectedBankAccountsField = mutableListOf<BankAccount>()
|
||||
|
||||
protected var userSelectedSingleAccount = false
|
||||
|
||||
protected var saveAccountOnNextEnterTanInvocation = false
|
||||
|
||||
|
||||
|
@ -138,6 +141,8 @@ open class BankingPresenter(
|
|||
if (response.isSuccessful) {
|
||||
addClientForAccount(account, newClient)
|
||||
|
||||
selectedAccount(account)
|
||||
|
||||
callAccountsChangedListeners()
|
||||
|
||||
persistAccount(account)
|
||||
|
@ -147,8 +152,6 @@ open class BankingPresenter(
|
|||
retrievedAccountTransactions(bankAccount, response)
|
||||
}
|
||||
}
|
||||
|
||||
selectedAccount(account)
|
||||
}
|
||||
|
||||
callback(response)
|
||||
|
@ -315,15 +318,31 @@ open class BankingPresenter(
|
|||
open val balanceOfSelectedBankAccounts: BigDecimal
|
||||
get() = sumBalance(selectedBankAccounts.map { it.balance })
|
||||
|
||||
open fun isSingleSelectedAccount(account: Account): Boolean {
|
||||
return userSelectedSingleAccount
|
||||
&& selectedBankAccountsField.map { it.account }.toSet().containsExactly(account)
|
||||
}
|
||||
|
||||
open fun isSingleSelectedBankAccount(bankAccount: BankAccount): Boolean {
|
||||
return userSelectedSingleAccount == false
|
||||
&& selectedBankAccountsField.containsExactly(bankAccount)
|
||||
}
|
||||
|
||||
open fun selectedAllBankAccounts() {
|
||||
userSelectedSingleAccount = false
|
||||
|
||||
setSelectedBankAccounts(bankAccounts)
|
||||
}
|
||||
|
||||
open fun selectedAccount(account: Account) {
|
||||
userSelectedSingleAccount = true
|
||||
|
||||
setSelectedBankAccounts(account.bankAccounts)
|
||||
}
|
||||
|
||||
open fun selectedBankAccount(bankAccount: BankAccount) {
|
||||
userSelectedSingleAccount = false
|
||||
|
||||
setSelectedBankAccounts(listOf(bankAccount))
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
|||
|
||||
kotlinVersion = '1.3.61'
|
||||
|
||||
javaUtilsVersion = '1.0.9'
|
||||
javaUtilsVersion = '1.0.16-SNAPSHOT'
|
||||
|
||||
|
||||
hbci4jVersion = '3.1.37'
|
||||
|
|
|
@ -117,6 +117,7 @@ open class DrawerView(
|
|||
.withName(account.displayName)
|
||||
.withLevel(AccountLevel)
|
||||
.withIcon(activity, FontAwesome.Icon.faw_piggy_bank, R.color.primaryTextColor_Dark)
|
||||
.withSelected(presenter.isSingleSelectedAccount(account))
|
||||
.withOnDrawerItemClickListener { _, _, _ -> itemClicked { presenter.selectedAccount(account) } }
|
||||
}
|
||||
|
||||
|
@ -125,6 +126,7 @@ open class DrawerView(
|
|||
SecondaryDrawerItem()
|
||||
.withName(bankAccount.displayName)
|
||||
.withLevel(BankAccountLevel)
|
||||
.withSelected(presenter.isSingleSelectedBankAccount(bankAccount))
|
||||
.withOnDrawerItemClickListener { _, _, _ -> itemClicked { presenter.selectedBankAccount(bankAccount) } }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue