Added convenience function TransferMoneyData.fromAccountTransaction()
This commit is contained in:
parent
c6e6acf13c
commit
4012c6105f
|
@ -1,5 +1,6 @@
|
||||||
package net.dankito.banking.ui.model.parameters
|
package net.dankito.banking.ui.model.parameters
|
||||||
|
|
||||||
|
import net.dankito.banking.ui.model.AccountTransaction
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,4 +10,20 @@ open class TransferMoneyData(
|
||||||
val creditorBic: String,
|
val creditorBic: String,
|
||||||
val amount: BigDecimal,
|
val amount: BigDecimal,
|
||||||
val usage: String
|
val usage: String
|
||||||
)
|
) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun fromAccountTransaction(transaction: AccountTransaction): TransferMoneyData {
|
||||||
|
return TransferMoneyData(
|
||||||
|
transaction.otherPartyName ?: "",
|
||||||
|
transaction.otherPartyAccountId ?: "",
|
||||||
|
transaction.otherPartyBankCode ?: "",
|
||||||
|
BigDecimal.ZERO,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,14 +15,13 @@ import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import net.dankito.banking.fints4java.android.MainActivity
|
import net.dankito.banking.fints4java.android.MainActivity
|
||||||
import net.dankito.banking.fints4java.android.R
|
import net.dankito.banking.fints4java.android.R
|
||||||
import net.dankito.banking.ui.presenter.MainWindowPresenter
|
|
||||||
import net.dankito.banking.fints4java.android.ui.adapter.AccountTransactionAdapter
|
import net.dankito.banking.fints4java.android.ui.adapter.AccountTransactionAdapter
|
||||||
import net.dankito.banking.fints4java.android.ui.dialogs.TransferMoneyDialog
|
import net.dankito.banking.fints4java.android.ui.dialogs.TransferMoneyDialog
|
||||||
import net.dankito.banking.ui.model.AccountTransaction
|
import net.dankito.banking.ui.model.AccountTransaction
|
||||||
import net.dankito.banking.ui.model.parameters.TransferMoneyData
|
import net.dankito.banking.ui.model.parameters.TransferMoneyData
|
||||||
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
|
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
|
||||||
|
import net.dankito.banking.ui.presenter.MainWindowPresenter
|
||||||
import net.dankito.utils.android.extensions.asActivity
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
import java.math.BigDecimal
|
|
||||||
|
|
||||||
|
|
||||||
class HomeFragment : Fragment() {
|
class HomeFragment : Fragment() {
|
||||||
|
@ -48,13 +47,8 @@ class HomeFragment : Fragment() {
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
inflater: LayoutInflater,
|
homeViewModel = ViewModelProviders.of(this).get(HomeViewModel::class.java)
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View? {
|
|
||||||
homeViewModel =
|
|
||||||
ViewModelProviders.of(this).get(HomeViewModel::class.java)
|
|
||||||
val root = inflater.inflate(R.layout.fragment_home, container, false)
|
val root = inflater.inflate(R.layout.fragment_home, container, false)
|
||||||
// val textView: TextView = root.findViewById(R.id.text_home)
|
// val textView: TextView = root.findViewById(R.id.text_home)
|
||||||
// homeViewModel.text.observe(this, Observer {
|
// homeViewModel.text.observe(this, Observer {
|
||||||
|
@ -179,13 +173,7 @@ class HomeFragment : Fragment() {
|
||||||
|
|
||||||
private fun mapPreselectedValues(selectedTransaction: AccountTransaction?): TransferMoneyData? {
|
private fun mapPreselectedValues(selectedTransaction: AccountTransaction?): TransferMoneyData? {
|
||||||
selectedTransaction?.let {
|
selectedTransaction?.let {
|
||||||
return TransferMoneyData(
|
return TransferMoneyData.fromAccountTransaction(selectedTransaction)
|
||||||
selectedTransaction.otherPartyName ?: "",
|
|
||||||
selectedTransaction.otherPartyAccountId ?: "",
|
|
||||||
selectedTransaction.otherPartyBankCode ?: "",
|
|
||||||
BigDecimal.ZERO,
|
|
||||||
""
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in New Issue