Fixed that AccountsChangedListener may gets called off UI thread
This commit is contained in:
parent
977e5101e6
commit
071c0a1b8d
|
@ -16,7 +16,9 @@ open class MainMenuBar(protected val presenter: BankingPresenter) : View() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
presenter.addAccountsChangedListener {
|
presenter.addAccountsChangedListener {
|
||||||
checkIfThereAreAccountsThatCanTransferMoney()
|
runLater {
|
||||||
|
checkIfThereAreAccountsThatCanTransferMoney()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfThereAreAccountsThatCanTransferMoney()
|
checkIfThereAreAccountsThatCanTransferMoney()
|
||||||
|
|
|
@ -99,7 +99,7 @@ open class AccountTransactionsControlView(
|
||||||
|
|
||||||
|
|
||||||
protected open fun initLogic() {
|
protected open fun initLogic() {
|
||||||
presenter.addAccountsChangedListener { accountsChanged() }
|
presenter.addAccountsChangedListener { runLater { accountsChanged() } }
|
||||||
presenter.addSelectedBankAccountsChangedListener { selectedBankAccountsChanged() }
|
presenter.addSelectedBankAccountsChangedListener { selectedBankAccountsChanged() }
|
||||||
|
|
||||||
checkIfSupportsTransferringMoneyOnUiThread()
|
checkIfSupportsTransferringMoneyOnUiThread()
|
||||||
|
|
|
@ -3,11 +3,9 @@ package net.dankito.banking.ui.javafx.controls
|
||||||
import javafx.collections.FXCollections
|
import javafx.collections.FXCollections
|
||||||
import javafx.geometry.Pos
|
import javafx.geometry.Pos
|
||||||
import javafx.scene.control.TreeItem
|
import javafx.scene.control.TreeItem
|
||||||
import javafx.scene.control.TreeView
|
|
||||||
import javafx.scene.layout.Priority
|
import javafx.scene.layout.Priority
|
||||||
import net.dankito.banking.ui.javafx.model.AccountsAccountTreeItem
|
import net.dankito.banking.ui.javafx.model.AccountsAccountTreeItem
|
||||||
import net.dankito.banking.ui.javafx.model.AccountsBankAccountTreeItem
|
import net.dankito.banking.ui.javafx.model.AccountsBankAccountTreeItem
|
||||||
import net.dankito.banking.ui.javafx.model.AccountsRootTreeItem
|
|
||||||
import net.dankito.banking.ui.presenter.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
import net.dankito.utils.javafx.ui.controls.addButton
|
import net.dankito.utils.javafx.ui.controls.addButton
|
||||||
import net.dankito.utils.javafx.ui.extensions.fixedHeight
|
import net.dankito.utils.javafx.ui.extensions.fixedHeight
|
||||||
|
@ -22,7 +20,9 @@ open class AccountsView(protected val presenter: BankingPresenter) : View() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
presenter.addAccountsChangedListener {
|
presenter.addAccountsChangedListener {
|
||||||
accounts.setAll(it)
|
runLater {
|
||||||
|
accounts.setAll(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.github.clans.fab.FloatingActionButton
|
||||||
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.BankingPresenter
|
import net.dankito.banking.ui.presenter.BankingPresenter
|
||||||
|
import net.dankito.utils.android.extensions.asActivity
|
||||||
|
|
||||||
|
|
||||||
open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: BankingPresenter)
|
open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: BankingPresenter)
|
||||||
|
@ -16,7 +17,9 @@ open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActi
|
||||||
setupButtons(floatingActionMenu)
|
setupButtons(floatingActionMenu)
|
||||||
|
|
||||||
presenter.addAccountsChangedListener {
|
presenter.addAccountsChangedListener {
|
||||||
checkIfThereAreAccountsThatCanTransferMoney()
|
fabTransferMoney.context.asActivity()?.runOnUiThread {
|
||||||
|
checkIfThereAreAccountsThatCanTransferMoney()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfThereAreAccountsThatCanTransferMoney()
|
checkIfThereAreAccountsThatCanTransferMoney()
|
||||||
|
|
Loading…
Reference in New Issue