Skip to content
Snippets Groups Projects
Commit 9c79a891 authored by Adrien Béraud's avatar Adrien Béraud Committed by Adrien Béraud
Browse files

home: avoid blocking when showing account list

GitLab: #1690
Change-Id: Id6c1970e95fd59fba5d2b510c7488283bf7dde26
parent e8c67dc9
No related branches found
No related tags found
No related merge requests found
...@@ -137,24 +137,25 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(), ...@@ -137,24 +137,25 @@ class HomeFragment: BaseSupportFragment<HomePresenter, HomeView>(),
// - Search bar (search for swarms or for new contacts) // - Search bar (search for swarms or for new contacts)
// - Menu (for settings, about jami) // - Menu (for settings, about jami)
searchBar.setNavigationOnClickListener { // Account selection searchBar.setNavigationOnClickListener { // Account selection
val accounts = mAccountService.observableAccountList.blockingFirst() mDisposable.add(mAccountService.observableAccountList.firstElement().subscribe { accounts ->
MaterialAlertDialogBuilder(requireContext()) MaterialAlertDialogBuilder(requireContext())
.setTitle(getString(R.string.account_selection)) .setTitle(getString(R.string.account_selection))
.setAdapter( .setAdapter(
AccountAdapter( AccountAdapter(
requireContext(), requireContext(),
accounts, accounts,
mDisposable, mAccountService, mConversationFacade mDisposable, mAccountService, mConversationFacade
) )
) { _, index -> ) { _, index ->
if (index >= accounts.size) // Add account if (index >= accounts.size) // Add account
startActivity(Intent(activity, AccountWizardActivity::class.java)) startActivity(Intent(activity, AccountWizardActivity::class.java))
else if (mAccountService.currentAccount != accounts[index]) { else if (mAccountService.currentAccount != accounts[index]) {
// Disable account settings menu option when account is loading // Disable account settings menu option when account is loading
searchBar.menu.findItem(R.id.menu_account_settings).isEnabled = false searchBar.menu.findItem(R.id.menu_account_settings).isEnabled = false
mAccountService.currentAccount = accounts[index] mAccountService.currentAccount = accounts[index]
} }
}.show() }.show()
})
} }
searchView.editText.addTextChangedListener { // Search bar searchView.editText.addTextChangedListener { // Search bar
querySubject.onNext(it.toString()) querySubject.onNext(it.toString())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment