From 342c8b78e890a6ca2cca7c6918f40beb7f0f57be Mon Sep 17 00:00:00 2001 From: dankl Date: Wed, 8 Jan 2020 18:22:01 +0100 Subject: [PATCH] Moved MainWindowPresenter to BankingUiCommon --- .../src/main/java/net/dankito/banking/ui/IRouter.kt | 3 ++- .../dankito/banking/ui/presenter}/MainWindowPresenter.kt | 4 ++-- .../dankito/banking/fints4java/android/MainActivity.kt | 9 +-------- .../dankito/banking/fints4java/android/RouterAndroid.kt | 6 +++--- .../fints4java/android/ui/adapter/BankListAdapter.kt | 2 +- .../android/ui/adapter/filter/BankInfoFilter.kt | 2 +- .../fints4java/android/ui/dialogs/AddAccountDialog.kt | 2 +- .../fints4java/android/ui/dialogs/EnterTanDialog.kt | 2 +- .../fints4java/android/ui/dialogs/TransferMoneyDialog.kt | 2 +- .../banking/fints4java/android/ui/home/HomeFragment.kt | 2 +- .../ui/views/MainActivityFloatingActionMenuButton.kt | 2 +- 11 files changed, 15 insertions(+), 21 deletions(-) rename {fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui => BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter}/MainWindowPresenter.kt (99%) 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 ebf70a7b..2606b694 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/IRouter.kt @@ -5,11 +5,12 @@ import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult import net.dankito.banking.ui.model.tan.EnterTanResult import net.dankito.banking.ui.model.tan.TanChallenge import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium +import net.dankito.banking.ui.presenter.MainWindowPresenter interface IRouter { - fun getTanFromUserOffUiThread(account: Account, tanChallenge: TanChallenge): EnterTanResult + fun getTanFromUserOffUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult fun getAtcFromUserOffUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt similarity index 99% rename from fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt rename to BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt index 481e1f53..2ab364f3 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/MainWindowPresenter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/MainWindowPresenter.kt @@ -1,4 +1,4 @@ -package net.dankito.banking.fints4java.android.ui +package net.dankito.banking.ui.presenter import net.dankito.banking.ui.BankingClientCallback import net.dankito.banking.ui.IBankingClient @@ -52,7 +52,7 @@ open class MainWindowPresenter( protected val callback: BankingClientCallback = object : BankingClientCallback { override fun enterTan(account: Account, tanChallenge: TanChallenge): EnterTanResult { - return router.getTanFromUserOffUiThread(account, tanChallenge) + return router.getTanFromUserOffUiThread(account, tanChallenge, this@MainWindowPresenter) } override fun enterTanGeneratorAtc(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult { 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 34e9984d..84af4903 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,19 +9,12 @@ 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.MainWindowPresenter 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 -import net.dankito.banking.ui.BankingClientCallback import net.dankito.banking.ui.model.Account -import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult -import net.dankito.banking.ui.model.tan.EnterTanResult -import net.dankito.banking.ui.model.tan.TanChallenge -import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium -import java.util.concurrent.CountDownLatch -import java.util.concurrent.atomic.AtomicReference +import net.dankito.banking.ui.presenter.MainWindowPresenter class MainActivity : AppCompatActivity() { 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 ffcf1b70..5c61f212 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,7 +1,6 @@ package net.dankito.banking.fints4java.android import android.support.v7.app.AppCompatActivity -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.dialogs.EnterAtcDialog import net.dankito.banking.fints4java.android.ui.dialogs.EnterTanDialog import net.dankito.banking.ui.IRouter @@ -10,13 +9,14 @@ import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult import net.dankito.banking.ui.model.tan.EnterTanResult import net.dankito.banking.ui.model.tan.TanChallenge import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium +import net.dankito.banking.ui.presenter.MainWindowPresenter import java.util.concurrent.CountDownLatch import java.util.concurrent.atomic.AtomicReference -open class RouterAndroid(protected val activity: AppCompatActivity, protected val presenter: MainWindowPresenter) : IRouter { +open class RouterAndroid(protected val activity: AppCompatActivity) : IRouter { - override fun getTanFromUserOffUiThread(account: Account, tanChallenge: TanChallenge): EnterTanResult { + override fun getTanFromUserOffUiThread(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/adapter/BankListAdapter.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/BankListAdapter.kt index c1680be9..795cc170 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/BankListAdapter.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/BankListAdapter.kt @@ -8,7 +8,7 @@ import android.widget.Filter import android.widget.Filterable import kotlinx.android.synthetic.main.list_item_bank_info.view.* import net.dankito.banking.fints4java.android.R -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.filter.BankInfoFilter import net.dankito.fints.model.BankInfo import net.dankito.utils.android.extensions.setTintColor diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/filter/BankInfoFilter.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/filter/BankInfoFilter.kt index 931c263b..67fe874d 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/filter/BankInfoFilter.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/adapter/filter/BankInfoFilter.kt @@ -1,7 +1,7 @@ package net.dankito.banking.fints4java.android.ui.adapter.filter import android.widget.Filter -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.fints.model.BankInfo diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt index cf06b351..c2aec1c8 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/AddAccountDialog.kt @@ -15,7 +15,7 @@ import android.widget.TextView import kotlinx.android.synthetic.main.dialog_add_account.* import kotlinx.android.synthetic.main.dialog_add_account.view.* import net.dankito.banking.fints4java.android.R -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.BankListAdapter import net.dankito.banking.ui.model.responses.AddAccountResponse import net.dankito.fints.model.BankInfo diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt index bf7f38e0..9fd3b1e3 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/EnterTanDialog.kt @@ -15,7 +15,7 @@ import android.widget.Spinner import kotlinx.android.synthetic.main.dialog_enter_tan.view.* import kotlinx.android.synthetic.main.view_tan_image.view.* import net.dankito.banking.fints4java.android.R -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.TanMediumAdapter import net.dankito.banking.fints4java.android.ui.adapter.TanProceduresAdapter import net.dankito.banking.fints4java.android.ui.listener.ListItemSelectedListener diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt index 65af56e5..0b9144fa 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/dialogs/TransferMoneyDialog.kt @@ -12,7 +12,7 @@ import android.view.ViewGroup import kotlinx.android.synthetic.main.dialog_transfer_money.* import kotlinx.android.synthetic.main.dialog_transfer_money.view.* import net.dankito.banking.fints4java.android.R -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.BankAccountsAdapter import net.dankito.banking.fints4java.android.ui.listener.ListItemSelectedListener import net.dankito.banking.ui.model.BankAccount diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt index a44a38c6..378441dd 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/ui/home/HomeFragment.kt @@ -15,7 +15,7 @@ import android.view.inputmethod.EditorInfo import android.widget.EditText import net.dankito.banking.fints4java.android.MainActivity import net.dankito.banking.fints4java.android.R -import net.dankito.banking.fints4java.android.ui.MainWindowPresenter +import net.dankito.banking.ui.presenter.MainWindowPresenter import net.dankito.banking.fints4java.android.ui.adapter.AccountTransactionAdapter import net.dankito.banking.fints4java.android.ui.dialogs.TransferMoneyDialog import net.dankito.banking.ui.model.AccountTransaction 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 ba03959b..08ca9b7e 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,7 +3,7 @@ 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.fints4java.android.ui.MainWindowPresenter +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