From 9db1c10f45f59ac0bb66294d300f7d5e28ab417d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 25 Apr 2019 19:52:42 +0200 Subject: [PATCH] open FAB when no contacts or bookmarks are found --- .../siacs/conversations/ui/StartConversationActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index d776d0ff0..8d92400ee 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -98,6 +98,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne private List mActivatedAccounts = new ArrayList<>(); private EditText mSearchEditText; private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false); + private AtomicBoolean mOpenedFab = new AtomicBoolean(false); private boolean mHideOfflineContacts = false; private boolean createdByViewIntent = false; private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() { @@ -304,6 +305,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne mInitialSearchValue.push(""); } mRequestedContactsPermission.set(savedInstanceState != null && savedInstanceState.getBoolean("requested_contacts_permission",false)); + mOpenedFab.set(savedInstanceState != null && savedInstanceState.getBoolean("opened_fab",false)); binding.speedDial.setOnActionSelectedListener(actionItem -> { final String searchString = mSearchEditText != null ? mSearchEditText.getText().toString() : null; final String prefilled; @@ -347,6 +349,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne Intent pendingIntent = pendingViewIntent.peek(); savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent()); savedInstanceState.putBoolean("requested_contacts_permission",mRequestedContactsPermission.get()); + savedInstanceState.putBoolean("opened_fab",mOpenedFab.get()); savedInstanceState.putBoolean("created_by_view_intent",createdByViewIntent); if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) { savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null); @@ -804,6 +807,9 @@ 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)) { + binding.speedDial.open(); + } } protected boolean processViewIntent(@NonNull Intent intent) {