From 182a81e3efedaf7898c60986456c89e01e45ec3f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Apr 2019 09:30:38 +0200 Subject: [PATCH] only show opened FAB when some accounts are enabled --- .../conversations/ui/StartConversationActivity.java | 2 +- .../eu/siacs/conversations/utils/AccountUtils.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 8d92400ee..91c5302d2 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -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(); } } diff --git a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java index df8d128d3..e475c6718 100644 --- a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java @@ -24,6 +24,16 @@ public class AccountUtils { } + public static boolean hasEnabledAccounts(final XmppConnectionService service) { + final List accounts = service.getAccounts(); + for(Account account : accounts) { + if (account.isOptionSet(Account.OPTION_DISABLED)) { + return false; + } + } + return false; + } + public static List getEnabledAccounts(final XmppConnectionService service) { ArrayList accounts = new ArrayList<>(); for (Account account : service.getAccounts()) {