open FAB when no contacts or bookmarks are found

This commit is contained in:
Daniel Gultsch 2019-04-25 19:52:42 +02:00
parent 7b61bb9841
commit 9db1c10f45
1 changed files with 6 additions and 0 deletions

View File

@ -98,6 +98,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
private List<String> mActivatedAccounts = new ArrayList<>(); private List<String> mActivatedAccounts = new ArrayList<>();
private EditText mSearchEditText; private EditText mSearchEditText;
private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false); private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
private AtomicBoolean mOpenedFab = new AtomicBoolean(false);
private boolean mHideOfflineContacts = false; private boolean mHideOfflineContacts = false;
private boolean createdByViewIntent = false; private boolean createdByViewIntent = false;
private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() { private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() {
@ -304,6 +305,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
mInitialSearchValue.push(""); mInitialSearchValue.push("");
} }
mRequestedContactsPermission.set(savedInstanceState != null && savedInstanceState.getBoolean("requested_contacts_permission",false)); mRequestedContactsPermission.set(savedInstanceState != null && savedInstanceState.getBoolean("requested_contacts_permission",false));
mOpenedFab.set(savedInstanceState != null && savedInstanceState.getBoolean("opened_fab",false));
binding.speedDial.setOnActionSelectedListener(actionItem -> { binding.speedDial.setOnActionSelectedListener(actionItem -> {
final String searchString = mSearchEditText != null ? mSearchEditText.getText().toString() : null; final String searchString = mSearchEditText != null ? mSearchEditText.getText().toString() : null;
final String prefilled; final String prefilled;
@ -347,6 +349,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
Intent pendingIntent = pendingViewIntent.peek(); Intent pendingIntent = pendingViewIntent.peek();
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent()); savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
savedInstanceState.putBoolean("requested_contacts_permission",mRequestedContactsPermission.get()); savedInstanceState.putBoolean("requested_contacts_permission",mRequestedContactsPermission.get());
savedInstanceState.putBoolean("opened_fab",mOpenedFab.get());
savedInstanceState.putBoolean("created_by_view_intent",createdByViewIntent); savedInstanceState.putBoolean("created_by_view_intent",createdByViewIntent);
if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) { if (mMenuSearchView != null && mMenuSearchView.isActionViewExpanded()) {
savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null); savedInstanceState.putString("search", mSearchEditText != null ? mSearchEditText.getText().toString() : null);
@ -804,6 +807,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
if (QuickConversationsService.isQuicksy()) { if (QuickConversationsService.isQuicksy()) {
setRefreshing(xmppConnectionService.getQuickConversationsService().isSynchronizing()); 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) { protected boolean processViewIntent(@NonNull Intent intent) {