Use removeParticipants and addParticipants instead of removeParticipant and addParticipant
This commit is contained in:
parent
f010073382
commit
6a23577cdb
1 changed files with 10 additions and 2 deletions
|
@ -194,6 +194,7 @@ public class GroupInfoFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Participants removed
|
// Participants removed
|
||||||
|
ArrayList<Participant> toRemove = new ArrayList<>();
|
||||||
for (Participant p : mChatRoom.getParticipants()) {
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (ContactAddress c : mParticipants) {
|
for (ContactAddress c : mParticipants) {
|
||||||
|
@ -203,11 +204,15 @@ public class GroupInfoFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
mChatRoom.removeParticipant(p);
|
toRemove.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Participant[] participantsToRemove = new Participant[toRemove.size()];
|
||||||
|
toRemove.toArray(participantsToRemove);
|
||||||
|
mChatRoom.removeParticipants(participantsToRemove);
|
||||||
|
|
||||||
// Participants added
|
// Participants added
|
||||||
|
ArrayList<Address> toAdd = new ArrayList<>();
|
||||||
for (ContactAddress c : mParticipants) {
|
for (ContactAddress c : mParticipants) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (Participant p : mChatRoom.getParticipants()) {
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
|
@ -223,12 +228,15 @@ public class GroupInfoFragment extends Fragment {
|
||||||
if (!found) {
|
if (!found) {
|
||||||
Address addr = LinphoneManager.getLc().createAddress(c.getAddress());
|
Address addr = LinphoneManager.getLc().createAddress(c.getAddress());
|
||||||
if (addr != null) {
|
if (addr != null) {
|
||||||
mChatRoom.addParticipant(addr);
|
toAdd.add(addr);
|
||||||
} else {
|
} else {
|
||||||
//TODO error
|
//TODO error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Address[] participantsToAdd = new Address[toAdd.size()];
|
||||||
|
toAdd.toArray(participantsToAdd);
|
||||||
|
mChatRoom.addParticipants(participantsToAdd);
|
||||||
|
|
||||||
LinphoneActivity.instance().goToChat(mGroupChatRoomAddress.asString());
|
LinphoneActivity.instance().goToChat(mGroupChatRoomAddress.asString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue