From fcd7e6c0ba815f653022965a110e395b628ca4dc Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 24 Apr 2020 17:29:51 +0200 Subject: [PATCH] Moved preloadBankList() to BankingPresenter (so this also works on JavaFx) --- .../net/dankito/banking/ui/presenter/BankingPresenter.kt | 5 +++++ .../banking/fints4java/android/di/BankingModule.kt | 9 +-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/BankingPresenter.kt b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/BankingPresenter.kt index 14942c3a..96d2b09f 100644 --- a/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/BankingPresenter.kt +++ b/BankingUiCommon/src/main/java/net/dankito/banking/ui/presenter/BankingPresenter.kt @@ -89,6 +89,11 @@ open class BankingPresenter( threadPool.runAsync { readPersistedAccounts() } + + // preloadBankList asynchronously; on Android it takes approximately 18 seconds till banks are indexed for first time -> do it as early as possible + threadPool.runAsync { + bankFinder.preloadBankList() + } } diff --git a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/di/BankingModule.kt b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/di/BankingModule.kt index 83e39308..e9babd98 100644 --- a/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/di/BankingModule.kt +++ b/fints4javaAndroidApp/src/main/java/net/dankito/banking/fints4java/android/di/BankingModule.kt @@ -81,14 +81,7 @@ class BankingModule(internal val mainActivity: AppCompatActivity) { @Provides @Singleton fun provideBankFinder(@Named(IndexFolderKey) indexFolder: File, threadPool: IThreadPool) : IBankFinder { - val bankFinder = LuceneBankFinder(indexFolder) - - // preloadBankList asynchronously; on Android it takes approximately 18 seconds till banks are indexed for first time -> do it as early as possible - threadPool.runAsync { - bankFinder.preloadBankList() - } - - return bankFinder + return LuceneBankFinder(indexFolder) } @Provides