Added showAddAccountDialog() to IRouter

This commit is contained in:
dankl 2020-01-08 20:22:31 +01:00 committed by dankito
parent fe6a2f17d5
commit 00c7084d42
5 changed files with 14 additions and 4 deletions

View File

@ -10,6 +10,8 @@ import net.dankito.banking.ui.presenter.MainWindowPresenter
interface IRouter { interface IRouter {
fun showAddAccountDialog(presenter: MainWindowPresenter)
fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult
fun getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult fun getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult

View File

@ -195,6 +195,11 @@ open class MainWindowPresenter(
} }
open fun showAddAccountDialog() {
router.showAddAccountDialog(this)
}
protected open fun getClientForAccount(account: Account): IBankingClient? { protected open fun getClientForAccount(account: Account): IBankingClient? {
clientsForAccounts.get(account)?.let { client -> clientsForAccounts.get(account)?.let { client ->
// TODO: is this code still needed after updating data model is implemented? // TODO: is this code still needed after updating data model is implemented?

View File

@ -9,7 +9,6 @@ import android.view.Menu
import androidx.navigation.findNavController import androidx.navigation.findNavController
import com.github.clans.fab.FloatingActionMenu import com.github.clans.fab.FloatingActionMenu
import kotlinx.android.synthetic.main.action_view_account_menu_item.view.* import kotlinx.android.synthetic.main.action_view_account_menu_item.view.*
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
import net.dankito.banking.fints4java.android.ui.views.MainActivityFloatingActionMenuButton import net.dankito.banking.fints4java.android.ui.views.MainActivityFloatingActionMenuButton
import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid
import net.dankito.banking.fints4javaBankingClientCreator import net.dankito.banking.fints4javaBankingClientCreator

View File

@ -1,6 +1,7 @@
package net.dankito.banking.fints4java.android package net.dankito.banking.fints4java.android
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
import net.dankito.banking.fints4java.android.ui.dialogs.EnterAtcDialog import net.dankito.banking.fints4java.android.ui.dialogs.EnterAtcDialog
import net.dankito.banking.fints4java.android.ui.dialogs.EnterTanDialog import net.dankito.banking.fints4java.android.ui.dialogs.EnterTanDialog
import net.dankito.banking.ui.IRouter import net.dankito.banking.ui.IRouter
@ -16,6 +17,10 @@ import java.util.concurrent.atomic.AtomicReference
open class RouterAndroid(protected val activity: AppCompatActivity) : IRouter { open class RouterAndroid(protected val activity: AppCompatActivity) : IRouter {
override fun showAddAccountDialog(presenter: MainWindowPresenter) {
AddAccountDialog().show(activity, presenter)
}
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult { override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult {
val enteredTan = AtomicReference<EnterTanResult>(null) val enteredTan = AtomicReference<EnterTanResult>(null)
val tanEnteredLatch = CountDownLatch(1) val tanEnteredLatch = CountDownLatch(1)

View File

@ -3,9 +3,8 @@ package net.dankito.banking.fints4java.android.ui.views
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import com.github.clans.fab.FloatingActionMenu import com.github.clans.fab.FloatingActionMenu
import kotlinx.android.synthetic.main.view_floating_action_button_main.view.* import kotlinx.android.synthetic.main.view_floating_action_button_main.view.*
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.fints4java.android.ui.dialogs.AddAccountDialog
import net.dankito.banking.fints4java.android.ui.dialogs.TransferMoneyDialog import net.dankito.banking.fints4java.android.ui.dialogs.TransferMoneyDialog
import net.dankito.banking.ui.presenter.MainWindowPresenter
open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: MainWindowPresenter) open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: MainWindowPresenter)
@ -18,7 +17,7 @@ open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActi
private fun setupButtons(floatingActionMenu: FloatingActionMenu) { private fun setupButtons(floatingActionMenu: FloatingActionMenu) {
(floatingActionMenu.context as? AppCompatActivity)?.let { activity -> (floatingActionMenu.context as? AppCompatActivity)?.let { activity ->
floatingActionMenu.fabAddAccount.setOnClickListener { floatingActionMenu.fabAddAccount.setOnClickListener {
executeAndCloseMenu { AddAccountDialog().show(activity, presenter) } executeAndCloseMenu { presenter.showAddAccountDialog() }
} }
val fabTransferMoney = floatingActionMenu.fabTransferMoney val fabTransferMoney = floatingActionMenu.fabTransferMoney