Added displayName to Bank, Account and BankAccount

This commit is contained in:
dankl 2020-01-03 17:48:49 +01:00 committed by dankito
parent 9b247d2c9e
commit 941746c18b
4 changed files with 17 additions and 6 deletions

View File

@ -24,6 +24,9 @@ open class Account(
var tanMedia: List<TanMedium> = listOf() var tanMedia: List<TanMedium> = listOf()
val displayName: String
get() = bank.name
val balance: BigDecimal val balance: BigDecimal
get() = bankAccounts.map { it.balance }.fold(BigDecimal.ZERO) { acc, e -> acc + e } get() = bankAccounts.map { it.balance }.fold(BigDecimal.ZERO) { acc, e -> acc + e }

View File

@ -12,6 +12,9 @@ open class Bank(
internal constructor() : this("", "", "", "") // for object deserializers internal constructor() : this("", "", "", "") // for object deserializers
val displayName: String
get() = name
var iconUrl: String? = null var iconUrl: String? = null

View File

@ -19,6 +19,16 @@ open class BankAccount @JvmOverloads constructor(
internal constructor() : this(Account(), "", "", null, null) // for object deserializers internal constructor() : this(Account(), "", "", null, null) // for object deserializers
val displayName: String
get() {
var displayName = "${account.bank.name} ${identifier}"
subAccountNumber?.let {
displayName += " ($it)"
}
return displayName
}
var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions
protected set protected set

View File

@ -20,12 +20,7 @@ open class BankAccountsAdapter(bankAccounts: List<BankAccount>) : ListAdapter<Ba
val view = convertView ?: inflater?.inflate(R.layout.list_item_bank_account, parent, false) val view = convertView ?: inflater?.inflate(R.layout.list_item_bank_account, parent, false)
view?.let { view?.let {
var displayName = "${item.account.bank.name} ${item.identifier}" view.txtBankAccountDisplayName.text = item.displayName
item.subAccountNumber?.let {
displayName += " ($it)"
}
view.txtBankAccountDisplayName.text = displayName
} }
return view return view