Implemented displaying bank's icon in TransferMoneyDialog
This commit is contained in:
parent
fda744be8a
commit
bf541bfe80
|
@ -1,9 +1,11 @@
|
||||||
package net.dankito.banking.ui.android.adapter
|
package net.dankito.banking.ui.android.adapter
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.net.Uri
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.ImageView
|
||||||
import kotlinx.android.synthetic.main.list_item_bank_account.view.*
|
import kotlinx.android.synthetic.main.list_item_bank_account.view.*
|
||||||
import net.dankito.banking.ui.android.R
|
import net.dankito.banking.ui.android.R
|
||||||
import net.dankito.banking.ui.model.BankAccount
|
import net.dankito.banking.ui.model.BankAccount
|
||||||
|
@ -21,9 +23,21 @@ open class BankAccountsAdapter(bankAccounts: List<BankAccount>) : ListAdapter<Ba
|
||||||
|
|
||||||
view?.let {
|
view?.let {
|
||||||
view.txtBankAccountDisplayName.text = item.displayNameIncludingBankName
|
view.txtBankAccountDisplayName.text = item.displayNameIncludingBankName
|
||||||
|
|
||||||
|
setIcon(item, view.imgBankIcon)
|
||||||
}
|
}
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected open fun setIcon(bankAccount: BankAccount, imgBankIcon: ImageView) {
|
||||||
|
try {
|
||||||
|
val iconUrl = bankAccount.account.bank.iconUrl
|
||||||
|
imgBankIcon.visibility = if (iconUrl == null) View.GONE else View.VISIBLE
|
||||||
|
imgBankIcon.setImageURI(Uri.parse(iconUrl))
|
||||||
|
} catch (e: Exception) {
|
||||||
|
imgBankIcon.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,24 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<TextView
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/list_item_bank_account_height"
|
||||||
|
android:padding="@dimen/list_item_bank_account_padding"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imgBankIcon"
|
||||||
|
android:layout_width="@dimen/list_item_bank_account_icon_size"
|
||||||
|
android:layout_height="@dimen/list_item_bank_account_icon_size"
|
||||||
|
android:layout_marginRight="@dimen/list_item_bank_account_icon_margin_right"
|
||||||
|
android:layout_marginEnd="@dimen/list_item_bank_account_icon_margin_right"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
android:id="@+id/txtBankAccountDisplayName"
|
android:id="@+id/txtBankAccountDisplayName"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -9,5 +27,6 @@
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="marquee"
|
android:ellipsize="marquee"
|
||||||
android:padding="@dimen/list_item_bank_account_padding"
|
/>
|
||||||
/>
|
|
||||||
|
</LinearLayout>
|
|
@ -51,7 +51,10 @@
|
||||||
<dimen name="dialog_transfer_money_instant_payment_margin_bottom">6dp</dimen>
|
<dimen name="dialog_transfer_money_instant_payment_margin_bottom">6dp</dimen>
|
||||||
<dimen name="dialog_transfer_money_buttons_width">120dp</dimen>
|
<dimen name="dialog_transfer_money_buttons_width">120dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="list_item_bank_account_height">26dp</dimen>
|
||||||
<dimen name="list_item_bank_account_padding">4dp</dimen>
|
<dimen name="list_item_bank_account_padding">4dp</dimen>
|
||||||
|
<dimen name="list_item_bank_account_icon_size">16dp</dimen>
|
||||||
|
<dimen name="list_item_bank_account_icon_margin_right">8dp</dimen>
|
||||||
<dimen name="list_item_bank_account_text_size">13sp</dimen>
|
<dimen name="list_item_bank_account_text_size">13sp</dimen>
|
||||||
|
|
||||||
<dimen name="list_item_remittee_height">60dp</dimen>
|
<dimen name="list_item_remittee_height">60dp</dimen>
|
||||||
|
|
|
@ -7,6 +7,8 @@ import javafx.beans.property.SimpleStringProperty
|
||||||
import javafx.collections.FXCollections
|
import javafx.collections.FXCollections
|
||||||
import javafx.geometry.Insets
|
import javafx.geometry.Insets
|
||||||
import javafx.geometry.Pos
|
import javafx.geometry.Pos
|
||||||
|
import javafx.scene.control.ContentDisplay
|
||||||
|
import javafx.scene.image.ImageView
|
||||||
import javafx.scene.layout.Priority
|
import javafx.scene.layout.Priority
|
||||||
import net.dankito.banking.ui.javafx.dialogs.JavaFxDialogService
|
import net.dankito.banking.ui.javafx.dialogs.JavaFxDialogService
|
||||||
import net.dankito.banking.ui.model.BankAccount
|
import net.dankito.banking.ui.model.BankAccount
|
||||||
|
@ -33,6 +35,8 @@ open class TransferMoneyDialog @JvmOverloads constructor(
|
||||||
private val FieldHeight = 40.0
|
private val FieldHeight = 40.0
|
||||||
private val TextFieldHeight = 32.0
|
private val TextFieldHeight = 32.0
|
||||||
|
|
||||||
|
private const val BankIconSize = 24.0
|
||||||
|
|
||||||
private val ButtonHeight = 40.0
|
private val ButtonHeight = 40.0
|
||||||
private val ButtonWidth = 150.0
|
private val ButtonWidth = 150.0
|
||||||
}
|
}
|
||||||
|
@ -96,6 +100,20 @@ open class TransferMoneyDialog @JvmOverloads constructor(
|
||||||
|
|
||||||
combobox(selectedBankAccount, bankAccountsSupportingTransferringMoney) {
|
combobox(selectedBankAccount, bankAccountsSupportingTransferringMoney) {
|
||||||
fixedHeight = TextFieldHeight
|
fixedHeight = TextFieldHeight
|
||||||
|
|
||||||
|
cellFormat {
|
||||||
|
text = it.displayNameIncludingBankName
|
||||||
|
|
||||||
|
it.account.bank.iconUrl?.let { iconUrl ->
|
||||||
|
graphic = ImageView(iconUrl)?.apply {
|
||||||
|
this.fitHeight = BankIconSize
|
||||||
|
this.fitWidth = BankIconSize
|
||||||
|
this.isPreserveRatio = true
|
||||||
|
}
|
||||||
|
contentDisplay = ContentDisplay.LEFT
|
||||||
|
}
|
||||||
|
?: run { contentDisplay = ContentDisplay.TEXT_ONLY }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vboxConstraints {
|
vboxConstraints {
|
||||||
|
|
Loading…
Reference in New Issue