diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/StartConversationActivity.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/StartConversationActivity.java | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 1edbafd67..825494d90 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -395,7 +395,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } protected void openConversationsForBookmark(Bookmark bookmark) { - Jid jid = bookmark.getJid(); + final Jid jid = bookmark.getFullJid(); if (jid == null) { Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); return; @@ -735,6 +735,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override protected void onBackendConnected() { + xmppConnectionService.getQuickConversationsService().considerSyncBackground(false); if (mPostponedActivityResult != null) { onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second); this.mPostponedActivityResult = null; @@ -868,12 +869,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne protected void filterContacts(String needle) { this.contacts.clear(); final List<Account> accounts = xmppConnectionService.getAccounts(); - final boolean singleAccountActive = isSingleAccountActive(accounts); for (Account account : accounts) { if (account.getStatus() != Account.State.DISABLED) { for (Contact contact : account.getRoster().getContacts()) { Presence.Status s = contact.getShownStatus(); - if ((contact.showInRoster() || (singleAccountActive && contact.showInPhoneBook())) && contact.match(this, needle) + if (contact.showInContactList() && contact.match(this, needle) && (!this.mHideOfflineContacts || (needle != null && !needle.trim().isEmpty()) || s.compareTo(Presence.Status.OFFLINE) < 0)) { @@ -886,16 +886,6 @@ public class StartConversationActivity extends XmppActivity implements XmppConne mContactsAdapter.notifyDataSetChanged(); } - private static boolean isSingleAccountActive(final List<Account> accounts) { - int i = 0; - for(Account account : accounts) { - if (account.getStatus() != Account.State.DISABLED) { - ++i; - } - } - return i == 1; - } - protected void filterConferences(String needle) { this.conferences.clear(); for (Account account : xmppConnectionService.getAccounts()) { @@ -1068,7 +1058,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (contact.isSelf()) { showContactDetailsItem.setVisible(false); } - deleteContactMenuItem.setVisible(contact.showInRoster()); + deleteContactMenuItem.setVisible(contact.showInRoster() && !contact.getOption(Contact.Options.SYNCED_VIA_OTHER)); XmppConnection xmpp = contact.getAccount().getXmppConnection(); if (xmpp != null && xmpp.getFeatures().blocking() && !contact.isSelf()) { if (contact.isBlocked()) { @@ -1115,10 +1105,10 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } public class ListPagerAdapter extends PagerAdapter { - FragmentManager fragmentManager; - MyListFragment[] fragments; + private final FragmentManager fragmentManager; + private final MyListFragment[] fragments; - public ListPagerAdapter(FragmentManager fm) { + ListPagerAdapter(FragmentManager fm) { fragmentManager = fm; fragments = new MyListFragment[2]; } @@ -1140,10 +1130,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @NonNull @Override public Fragment instantiateItem(@NonNull ViewGroup container, int position) { - Fragment fragment = getItem(position); - FragmentTransaction trans = fragmentManager.beginTransaction(); + final Fragment fragment = getItem(position); + final FragmentTransaction trans = fragmentManager.beginTransaction(); trans.add(container.getId(), fragment, "fragment:" + position); - trans.commit(); + try { + trans.commit(); + } catch (IllegalStateException e) { + //ignore + } return fragment; } |