Implemented AccountTransactionDetailsDialog
This commit is contained in:
parent
b16390d0eb
commit
427db22ef1
|
@ -2,8 +2,10 @@ package net.dankito.banking.ui.android.adapter
|
|||
|
||||
import android.view.ContextMenu
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import net.dankito.banking.ui.android.R
|
||||
import net.dankito.banking.ui.android.adapter.viewholder.AccountTransactionViewHolder
|
||||
import net.dankito.banking.ui.android.dialogs.AccountTransactionDetailsDialog
|
||||
import net.dankito.banking.ui.android.extensions.setIcon
|
||||
import net.dankito.banking.ui.android.extensions.showAmount
|
||||
import net.dankito.banking.ui.model.IAccountTransaction
|
||||
|
@ -49,6 +51,10 @@ open class AccountTransactionAdapter(protected val presenter: BankingPresenter)
|
|||
// TODO: if bank icon isn't set: Show default icon? show at least an empty space to that amount and date don't shift up causing an inconsistent view?
|
||||
viewHolder.imgvwBankIcon.hide()
|
||||
}
|
||||
|
||||
viewHolder.itemView.setOnClickListener {
|
||||
AccountTransactionDetailsDialog().show(item, viewHolder.itemView.context as AppCompatActivity)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
package net.dankito.banking.ui.android.dialogs
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.*
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import kotlinx.android.synthetic.main.dialog_account_transaction_details.view.*
|
||||
import net.dankito.banking.ui.android.R
|
||||
import net.dankito.banking.ui.android.dialogs.settings.SettingsDialogBase
|
||||
import net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
import net.dankito.banking.ui.model.IAccountTransaction
|
||||
import net.dankito.utils.multiplatform.BigDecimal
|
||||
|
||||
|
||||
open class AccountTransactionDetailsDialog : SettingsDialogBase() {
|
||||
|
||||
companion object {
|
||||
const val DialogTag = "AccountTransactionDetailsDialog"
|
||||
}
|
||||
|
||||
|
||||
protected lateinit var transaction: IAccountTransaction
|
||||
|
||||
|
||||
|
||||
fun show(transaction: IAccountTransaction, activity: FragmentActivity) {
|
||||
this.transaction = transaction
|
||||
|
||||
show(activity, DialogTag)
|
||||
}
|
||||
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
val rootView = inflater.inflate(R.layout.dialog_account_transaction_details, container, false)
|
||||
|
||||
setupUI(rootView)
|
||||
|
||||
return rootView
|
||||
}
|
||||
|
||||
protected open fun setupUI(rootView: View) {
|
||||
rootView.apply {
|
||||
toolbar.apply {
|
||||
setupToolbar(this, context.getString(R.string.dialog_account_transaction_details_title), false)
|
||||
}
|
||||
|
||||
sender_or_recipient_section_title.setTitle(if (transaction.amount.isPositive) R.string.dialog_account_transaction_details_sender else R.string.dialog_account_transaction_details_recipient)
|
||||
lvlOtherPartyName.value = transaction.otherPartyName ?: ""
|
||||
lvlOtherPartyAccountId.value = transaction.otherPartyAccountId ?: ""
|
||||
lvlOtherPartyBankCode.value = transaction.otherPartyBankCode ?: ""
|
||||
|
||||
lvlAmount.showAmount(presenter, transaction.amount, transaction.currency)
|
||||
lvlReference.value = transaction.reference
|
||||
|
||||
lvlBookingText.value = transaction.bookingText ?: ""
|
||||
lvlBookingDate.value = presenter.formatToMediumDate(transaction.bookingDate)
|
||||
lvlValueDate.value = presenter.formatToMediumDate(transaction.valueDate)
|
||||
|
||||
showAmountIfSet(lvlOpeningBalance, transaction.openingBalance, transaction.account.currency)
|
||||
showAmountIfSet(lvlClosingBalance, transaction.closingBalance, transaction.account.currency)
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun showAmountIfSet(labelledValue: FormLabelledValue, amount: BigDecimal?, currencyCode: String) {
|
||||
if (amount != null) {
|
||||
labelledValue.showAmount(presenter, amount, currencyCode)
|
||||
}
|
||||
else {
|
||||
labelledValue.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override val hasUnsavedChanges: Boolean
|
||||
get() = false
|
||||
|
||||
override fun saveChanges() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,10 @@ import android.widget.LinearLayout
|
|||
import android.widget.TextView
|
||||
import kotlinx.android.synthetic.main.view_form_labelled_value.view.*
|
||||
import net.dankito.banking.ui.android.R
|
||||
import net.dankito.banking.ui.android.extensions.setTextColorForAmount
|
||||
import net.dankito.utils.android.extensions.setVisibility
|
||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||
import net.dankito.utils.multiplatform.BigDecimal
|
||||
|
||||
|
||||
open class FormLabelledValue @JvmOverloads constructor(
|
||||
|
@ -65,4 +68,9 @@ open class FormLabelledValue @JvmOverloads constructor(
|
|||
this.value = value ?: ""
|
||||
}
|
||||
|
||||
open fun showAmount(presenter: BankingPresenter, amount: BigDecimal, currencyIsoCode: String? = null) {
|
||||
value = presenter.formatAmount(amount, currencyIsoCode)
|
||||
txtValue.setTextColorForAmount(amount)
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.StringRes
|
||||
import kotlinx.android.synthetic.main.view_form_section_title.view.*
|
||||
import net.dankito.banking.ui.android.R
|
||||
|
||||
|
@ -37,4 +38,13 @@ open class FormSectionTitle @JvmOverloads constructor(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
open var title: CharSequence
|
||||
get() = txtvwSectionTitle.text
|
||||
set(value) = txtvwSectionTitle.setText(value)
|
||||
|
||||
open fun setTitle(@StringRes titleResId: Int) {
|
||||
this.title = context.getString(titleResId)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||
app:navigationIcon="@drawable/ic_baseline_close_24"
|
||||
/>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/form_padding"
|
||||
>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormSectionTitle
|
||||
android:id="@+id/sender_or_recipient_section_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dialog_account_transaction_details_sender"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlOtherPartyName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/name"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlOtherPartyAccountId"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/iban"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlOtherPartyBankCode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/bic"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/form_section_extra_margin_top"
|
||||
>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlAmount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/amount"
|
||||
/>
|
||||
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlReference"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/reference"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/form_section_title_margin_top"
|
||||
>
|
||||
|
||||
<!-- <net.dankito.banking.ui.android.views.FormSectionTitle-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/dialog_bank_account_settings_account_data_section_title"-->
|
||||
<!-- />-->
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlBookingText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/booking_text"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlBookingDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/booking_date"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlValueDate"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/value_date"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlOpeningBalance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/day_opening_balance"
|
||||
/>
|
||||
|
||||
<net.dankito.banking.ui.android.views.FormLabelledValue
|
||||
android:id="@+id/lvlClosingBalance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:label="@string/day_closing_balance"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
|
@ -25,12 +25,24 @@
|
|||
<string name="online_banking_credentials_login_name">Login Name</string>
|
||||
<string name="online_banking_credentials_password">Passwort</string>
|
||||
|
||||
<string name="account">Konto</string>
|
||||
<string name="accounts">Konten</string>
|
||||
<string name="bank_credentials">Bankzugänge</string>
|
||||
|
||||
<string name="name">Name</string>
|
||||
|
||||
<string name="bank_code">Bankleitzahl</string>
|
||||
<string name="bic">BIC</string>
|
||||
<string name="iban">IBAN</string>
|
||||
<string name="amount">Betrag</string>
|
||||
<string name="reference">Verwendungszweck</string>
|
||||
|
||||
<string name="booking_text">Buchungstext</string>
|
||||
<string name="booking_date">Buchungsdatum</string>
|
||||
<string name="value_date">Wertstellungsdatum</string>
|
||||
<string name="day_opening_balance">Taganfangssaldo</string>
|
||||
<string name="day_closing_balance">Tagendsaldo</string>
|
||||
|
||||
<string name="customer_name">Kontoinhaber</string>
|
||||
<string name="fints_server_address">FinTS Server</string>
|
||||
|
||||
|
@ -67,6 +79,12 @@
|
|||
|
||||
<string name="rationale_camera_permission_to_scan_qr_code">Um QR-Codes scannen zu können wird der Zugriff auf die Kamera benötigt.</string>
|
||||
|
||||
|
||||
<string name="dialog_add_account_enter_bank">Bank (Suche mit Name, Bankleitzahl oder Ort):</string>
|
||||
<string name="dialog_add_account_add">Hinzufügen</string>
|
||||
<string name="dialog_add_account_bank_does_not_support_fints_3_error_message">%s untersützt FinTS 3.0 nicht und kann deshalb leider mit dieser App nicht verwendet werden.</string>
|
||||
<string name="dialog_add_account_message_could_not_add_account">Konto konnte nicht hinzugefügt werden.\n\nFehlermeldung Ihrer Bank:\n\n%s</string>
|
||||
|
||||
<string name="menu_home">Umsätze</string>
|
||||
|
||||
<string name="menu_main_update_transactions">Umsätze aktualisieren</string>
|
||||
|
@ -88,10 +106,10 @@
|
|||
\n\nMöchten Sie hingegen den Button für dieses Konto nicht mehr angezeigt bekommen, klicken Sie auf das \'x\' rechts. Der Button wird dann immer noch am Ende der Umsatzlist angezeigt, falls Sie die älteren Umsätze später doch noch abrufen möchten.
|
||||
</string>
|
||||
|
||||
<string name="dialog_add_account_enter_bank">Bank (Suche mit Name, Bankleitzahl oder Ort):</string>
|
||||
<string name="dialog_add_account_add">Hinzufügen</string>
|
||||
<string name="dialog_add_account_bank_does_not_support_fints_3_error_message">%s untersützt FinTS 3.0 nicht und kann deshalb leider mit dieser App nicht verwendet werden.</string>
|
||||
<string name="dialog_add_account_message_could_not_add_account">Konto konnte nicht hinzugefügt werden.\n\nFehlermeldung Ihrer Bank:\n\n%s</string>
|
||||
<string name="dialog_account_transaction_details_title">Umsatzdetails</string>
|
||||
<string name="dialog_account_transaction_details_sender">Zahlender</string>
|
||||
<string name="dialog_account_transaction_details_recipient">Empfänger</string>
|
||||
|
||||
|
||||
<string name="dialog_transfer_money_account">Konto:</string>
|
||||
<string name="dialog_transfer_money_recipient_name">Name:</string>
|
||||
|
|
|
@ -25,12 +25,24 @@
|
|||
<string name="online_banking_credentials_login_name">Login name</string>
|
||||
<string name="online_banking_credentials_password">Password</string>
|
||||
|
||||
<string name="account">Account</string>
|
||||
<string name="accounts">Accounts</string>
|
||||
<string name="bank_credentials">Bank credentials</string>
|
||||
|
||||
<string name="name">Name</string>
|
||||
|
||||
<string name="bank_code">Bank code</string>
|
||||
<string name="bic">BIC</string>
|
||||
<string name="iban">IBAN</string>
|
||||
<string name="amount">Amount</string>
|
||||
<string name="reference">Reference</string>
|
||||
|
||||
<string name="booking_text">Booking text</string>
|
||||
<string name="booking_date">Booking date</string>
|
||||
<string name="value_date">Value date</string>
|
||||
<string name="day_opening_balance">Day opening balance</string>
|
||||
<string name="day_closing_balance">Day closing balance</string>
|
||||
|
||||
<string name="customer_name">Customer name</string>
|
||||
<string name="fints_server_address">FinTS server</string>
|
||||
|
||||
|
@ -67,6 +79,13 @@
|
|||
|
||||
<string name="rationale_camera_permission_to_scan_qr_code">To scan QR-Codes permission to access camera is required.</string>
|
||||
|
||||
|
||||
<string name="dialog_add_account_enter_bank">Bank (search by name, bank code or city):</string>
|
||||
<string name="dialog_add_account_add">Add</string>
|
||||
<string name="dialog_add_account_bank_does_not_support_fints_3_error_message">%s does not support FinTS 3.0 and can therefore unfortunately not be used with this app.</string>
|
||||
<string name="dialog_add_account_message_could_not_add_account">Could not add account.\n\nError message from your bank:\n\n%s</string>
|
||||
|
||||
|
||||
<string name="menu_home">Home</string>
|
||||
|
||||
<string name="menu_main_update_transactions">Update transactions</string>
|
||||
|
@ -88,10 +107,10 @@
|
|||
\n\nIf you no longer wish to see this button for this account, click on the \'x\' on the right. The button will still be displayed at the end of the list of transactions, in case you want to retrieve the earlier transactions later.
|
||||
</string>
|
||||
|
||||
<string name="dialog_add_account_enter_bank">Bank (search by name, bank code or city):</string>
|
||||
<string name="dialog_add_account_add">Add</string>
|
||||
<string name="dialog_add_account_bank_does_not_support_fints_3_error_message">%s does not support FinTS 3.0 and can therefore unfortunately not be used with this app.</string>
|
||||
<string name="dialog_add_account_message_could_not_add_account">Could not add account.\n\nError message from your bank:\n\n%s</string>
|
||||
<string name="dialog_account_transaction_details_title">Transaction details</string>
|
||||
<string name="dialog_account_transaction_details_sender">Sender</string>
|
||||
<string name="dialog_account_transaction_details_recipient">Recipient</string>
|
||||
|
||||
|
||||
<string name="dialog_transfer_money_account">Account:</string>
|
||||
<string name="dialog_transfer_money_recipient_name">Name:</string>
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
"Booking date" = "Buchungsdatum";
|
||||
"Value date" = "Wertstellungsdatum";
|
||||
"Account day opening balance" = "Taganfangssaldo";
|
||||
"Account day closing balance" = "Tagschlusssaldo";
|
||||
"Account day closing balance" = "Tagendsaldo";
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue