From a656b0c7e5cd67219567cfebd7563598d0a27b04 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 3 Jun 2020 23:40:02 +0200 Subject: [PATCH] Implemented displaying bank icon if all accounts are selected --- .../adapter/AccountTransactionAdapter.kt | 10 +++++++++ .../AccountTransactionViewHolder.kt | 3 +++ .../layout/list_item_account_transaction.xml | 22 ++++++++++++------- .../src/main/res/values/dimens.xml | 4 ++++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt index 7414bc64..b81d0474 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/AccountTransactionAdapter.kt @@ -1,5 +1,6 @@ package net.dankito.banking.ui.android.adapter +import android.net.Uri import android.view.ContextMenu import android.view.View import net.dankito.banking.ui.android.R @@ -49,6 +50,15 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter) viewHolder.txtvwAmount.text = presenter.formatAmount(item.amount) viewHolder.txtvwAmount.setTextColorToColorResource(if (item.amount >= BigDecimal.ZERO) R.color.positiveAmount else R.color.negativeAmount) + + val iconUrl = item.bankAccount.account.bank.iconUrl + if (iconUrl != null && presenter.areAllAccountSelected) { + viewHolder.imgvwBankIcon.visibility = View.VISIBLE + viewHolder.imgvwBankIcon.setImageURI(Uri.parse(iconUrl)) + } + else { + viewHolder.imgvwBankIcon.visibility = View.GONE + } } diff --git a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt index 1453f743..2d64c128 100644 --- a/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt +++ b/ui/BankingAndroidApp/src/main/java/net/dankito/banking/ui/android/adapter/viewholder/AccountTransactionViewHolder.kt @@ -1,6 +1,7 @@ package net.dankito.banking.ui.android.adapter.viewholder import android.view.View +import android.widget.ImageView import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import kotlinx.android.synthetic.main.list_item_account_transaction.view.* @@ -20,4 +21,6 @@ open class AccountTransactionViewHolder(itemView: View) : RecyclerView.ViewHolde val txtvwAmount: TextView = itemView.txtvwAmount + val imgvwBankIcon: ImageView = itemView.imgvwBankIcon + } \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/layout/list_item_account_transaction.xml b/ui/BankingAndroidApp/src/main/res/layout/list_item_account_transaction.xml index 05866406..cab2c7db 100644 --- a/ui/BankingAndroidApp/src/main/res/layout/list_item_account_transaction.xml +++ b/ui/BankingAndroidApp/src/main/res/layout/list_item_account_transaction.xml @@ -53,7 +53,7 @@ - + + - + \ No newline at end of file diff --git a/ui/BankingAndroidApp/src/main/res/values/dimens.xml b/ui/BankingAndroidApp/src/main/res/values/dimens.xml index d626d92e..90399b83 100644 --- a/ui/BankingAndroidApp/src/main/res/values/dimens.xml +++ b/ui/BankingAndroidApp/src/main/res/values/dimens.xml @@ -16,8 +16,12 @@ 100dp 4dp + 16dp + 8dp + 12dp 70dp 12dp + 8dp 4dp 6dp