Implemented displaying bank icon if all accounts are selected

This commit is contained in:
dankito 2020-06-03 23:40:02 +02:00
parent 30cef4293a
commit a656b0c7e5
4 changed files with 31 additions and 8 deletions

View File

@ -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
}
}

View File

@ -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
}

View File

@ -53,7 +53,7 @@
</LinearLayout>
<RelativeLayout
<LinearLayout
android:id="@+id/lytAmountAndDate"
android:orientation="vertical"
android:layout_width="@dimen/list_item_account_transaction_amount_width"
@ -65,26 +65,32 @@
android:gravity="center_vertical"
>
<ImageView
android:id="@+id/imgvwBankIcon"
android:layout_width="@dimen/list_item_account_transaction_bank_icon_width_and_height"
android:layout_height="@dimen/list_item_account_transaction_bank_icon_width_and_height"
android:layout_marginTop="@dimen/list_item_account_transaction_bank_icon_margin_top"
android:layout_marginBottom="@dimen/list_item_account_transaction_bank_icon_margin_bottom"
android:layout_gravity="end"
android:visibility="gone"
/>
<TextView
android:id="@+id/txtvwAmount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:gravity="end"
/>
<TextView
android:id="@+id/txtvwDate"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/txtvwAmount"
android:layout_marginTop="@dimen/list_item_account_transaction_date_margin_top"
android:layout_marginBottom="@dimen/list_item_account_transaction_date_margin_bottom"
android:gravity="end"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View File

@ -16,8 +16,12 @@
<dimen name="list_item_account_transaction_height">100dp</dimen>
<dimen name="list_item_account_transaction_padding">4dp</dimen>
<dimen name="list_item_account_transaction_bank_icon_width_and_height">16dp</dimen>
<dimen name="list_item_account_transaction_bank_icon_margin_top">8dp</dimen>
<dimen name="list_item_account_transaction_bank_icon_margin_bottom">12dp</dimen>
<dimen name="list_item_account_transaction_amount_width">70dp</dimen>
<dimen name="list_item_account_transaction_date_margin_top">12dp</dimen>
<dimen name="list_item_account_transaction_date_margin_bottom">8dp</dimen>
<dimen name="list_item_account_transaction_transaction_text_margin_left_and_right">4dp</dimen>
<dimen name="list_item_account_transaction_other_party_name_margin_top_and_bottom">6dp</dimen>