forked from mirror/monocles_chat_clean
Basic support for adding by jid on group chat create
(cherry picked from commit 0993958d56c311d7e05fd843808871c2593e97ad)
This commit is contained in:
parent
e8797921fe
commit
81ed4859c3
2 changed files with 28 additions and 9 deletions
|
@ -56,6 +56,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
private final ArrayList<String> mActivatedAccounts = new ArrayList<>();
|
||||
private final Set<String> selected = new HashSet<>();
|
||||
private Set<String> filterContacts;
|
||||
private Set<ListItem> extraContacts = new HashSet<>();
|
||||
|
||||
private boolean showEnterJid = false;
|
||||
private boolean startSearching = false;
|
||||
|
@ -292,6 +293,12 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
for (final var account : xmppConnectionService.getAccounts()) {
|
||||
if (mActivatedAccounts.contains(account.getJid().asBareJid().toEscapedString())) accounts.add(account);
|
||||
}
|
||||
for (final var contact : extraContacts) {
|
||||
if (!filterContacts.contains(contact.getJid().asBareJid().toString())
|
||||
&& contact.match(this, needle)) {
|
||||
getListItems().add(contact);
|
||||
}
|
||||
}
|
||||
for (final Account account : accounts) {
|
||||
for (final Contact contact : account.getRoster().getContacts()) {
|
||||
if (contact.showInContactList() &&
|
||||
|
@ -353,14 +360,26 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
);
|
||||
|
||||
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid, x, y) -> {
|
||||
final Intent request = getIntent();
|
||||
final Intent data = new Intent();
|
||||
data.putExtra("contact", contactJid.toString());
|
||||
data.putExtra(EXTRA_ACCOUNT, accountJid.toEscapedString());
|
||||
data.putExtra(EXTRA_SELECT_MULTIPLE, false);
|
||||
copy(request, data);
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
for (final Account account : xmppConnectionService.getAccounts()) {
|
||||
if (account.getJid().asBareJid().equals(accountJid)) {
|
||||
final var contact = account.getRoster().getContact(contactJid);
|
||||
if (multiple) {
|
||||
extraContacts.add(contact);
|
||||
selected.add(contactJid.toString());
|
||||
if (mMenuSearchView != null) {
|
||||
binding.fab.postDelayed(() -> {
|
||||
mMenuSearchView.expandActionView();
|
||||
mSearchEditText.setText("");
|
||||
mSearchEditText.append(contactJid.toString());
|
||||
}, 200L);
|
||||
filterContacts(contactJid.toString());
|
||||
binding.fab.setImageResource(R.drawable.ic_navigate_next_24dp);
|
||||
}
|
||||
} else {
|
||||
onListItemClicked(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
|
|
@ -1557,7 +1557,7 @@ public class StartConversationActivity extends XmppActivity
|
|||
return;
|
||||
}
|
||||
Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_SHOW_ENTER_JID, false);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_SHOW_ENTER_JID, true);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_SELECT_MULTIPLE, true);
|
||||
intent.putExtra(ChooseContactActivity.EXTRA_GROUP_CHAT_NAME, name.trim());
|
||||
intent.putExtra(
|
||||
|
|
Loading…
Reference in a new issue