diff --git a/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt index 4b8a0a83..142cfceb 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt @@ -10,6 +10,8 @@ import net.dankito.banking.ui.presenter.MainWindowPresenter interface IRouter { + fun showAddAccountDialog(presenter: MainWindowPresenter) + fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult fun getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult diff --git a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt index 757faf8b..2639a55b 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt @@ -195,6 +195,11 @@ open class MainWindowPresenter( } + open fun showAddAccountDialog() { + router.showAddAccountDialog(this) + } + + protected open fun getClientForAccount(account: Account): IBankingClient? { clientsForAccounts.get(account)?.let { client -> // TODO: is this code still needed after updating data model is implemented? diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt index 84af4903..f6103edc 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/MainActivity.kt @@ -9,7 +9,6 @@ import android.view.Menu import androidx.navigation.findNavController import com.github.clans.fab.FloatingActionMenu 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.util.Base64ServiceAndroid import net.dankito.banking.fints4javaBankingClientCreator diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt index 3c4b8f4a..c4dd2620 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/RouterAndroid.kt @@ -1,6 +1,7 @@ package net.dankito.banking.fints4java.android 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.EnterTanDialog import net.dankito.banking.ui.IRouter @@ -16,6 +17,10 @@ import java.util.concurrent.atomic.AtomicReference 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 { val enteredTan = AtomicReference(null) val tanEnteredLatch = CountDownLatch(1) diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt index 08ca9b7e..40b01a63 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/views/MainActivityFloatingActionMenuButton.kt @@ -3,9 +3,8 @@ package net.dankito.banking.fints4java.android.ui.views import android.support.v7.app.AppCompatActivity import com.github.clans.fab.FloatingActionMenu 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.ui.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) { (floatingActionMenu.context as? AppCompatActivity)?.let { activity -> floatingActionMenu.fabAddAccount.setOnClickListener { - executeAndCloseMenu { AddAccountDialog().show(activity, presenter) } + executeAndCloseMenu { presenter.showAddAccountDialog() } } val fabTransferMoney = floatingActionMenu.fabTransferMoney