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 ArrayList<String> mActivatedAccounts = new ArrayList<>();
|
||||||
private final Set<String> selected = new HashSet<>();
|
private final Set<String> selected = new HashSet<>();
|
||||||
private Set<String> filterContacts;
|
private Set<String> filterContacts;
|
||||||
|
private Set<ListItem> extraContacts = new HashSet<>();
|
||||||
|
|
||||||
private boolean showEnterJid = false;
|
private boolean showEnterJid = false;
|
||||||
private boolean startSearching = false;
|
private boolean startSearching = false;
|
||||||
|
@ -292,6 +293,12 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
||||||
for (final var account : xmppConnectionService.getAccounts()) {
|
for (final var account : xmppConnectionService.getAccounts()) {
|
||||||
if (mActivatedAccounts.contains(account.getJid().asBareJid().toEscapedString())) accounts.add(account);
|
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 Account account : accounts) {
|
||||||
for (final Contact contact : account.getRoster().getContacts()) {
|
for (final Contact contact : account.getRoster().getContacts()) {
|
||||||
if (contact.showInContactList() &&
|
if (contact.showInContactList() &&
|
||||||
|
@ -353,14 +360,26 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
||||||
);
|
);
|
||||||
|
|
||||||
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid, x, y) -> {
|
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid, x, y) -> {
|
||||||
final Intent request = getIntent();
|
for (final Account account : xmppConnectionService.getAccounts()) {
|
||||||
final Intent data = new Intent();
|
if (account.getJid().asBareJid().equals(accountJid)) {
|
||||||
data.putExtra("contact", contactJid.toString());
|
final var contact = account.getRoster().getContact(contactJid);
|
||||||
data.putExtra(EXTRA_ACCOUNT, accountJid.toEscapedString());
|
if (multiple) {
|
||||||
data.putExtra(EXTRA_SELECT_MULTIPLE, false);
|
extraContacts.add(contact);
|
||||||
copy(request, data);
|
selected.add(contactJid.toString());
|
||||||
setResult(RESULT_OK, data);
|
if (mMenuSearchView != null) {
|
||||||
finish();
|
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;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1557,7 +1557,7 @@ public class StartConversationActivity extends XmppActivity
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Intent intent = new Intent(getApplicationContext(), ChooseContactActivity.class);
|
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_SELECT_MULTIPLE, true);
|
||||||
intent.putExtra(ChooseContactActivity.EXTRA_GROUP_CHAT_NAME, name.trim());
|
intent.putExtra(ChooseContactActivity.EXTRA_GROUP_CHAT_NAME, name.trim());
|
||||||
intent.putExtra(
|
intent.putExtra(
|
||||||
|
|
Loading…
Reference in a new issue