only show opened FAB when some accounts are enabled

This commit is contained in:
Daniel Gultsch 2019-04-26 09:30:38 +02:00
parent 6704db21fb
commit 182a81e3ef
2 changed files with 11 additions and 1 deletions

View file

@ -807,7 +807,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
if (QuickConversationsService.isQuicksy()) {
setRefreshing(xmppConnectionService.getQuickConversationsService().isSynchronizing());
}
if (QuickConversationsService.isConversations() && this.contacts.size() == 0 && this.conferences.size() == 0 && mOpenedFab.compareAndSet(false,true)) {
if (QuickConversationsService.isConversations() && AccountUtils.hasEnabledAccounts(xmppConnectionService) && this.contacts.size() == 0 && this.conferences.size() == 0 && mOpenedFab.compareAndSet(false,true)) {
binding.speedDial.open();
}
}

View file

@ -24,6 +24,16 @@ public class AccountUtils {
}
public static boolean hasEnabledAccounts(final XmppConnectionService service) {
final List<Account> accounts = service.getAccounts();
for(Account account : accounts) {
if (account.isOptionSet(Account.OPTION_DISABLED)) {
return false;
}
}
return false;
}
public static List<String> getEnabledAccounts(final XmppConnectionService service) {
ArrayList<String> accounts = new ArrayList<>();
for (Account account : service.getAccounts()) {