Fix concurrent modification exception
This commit is contained in:
parent
003fe44527
commit
c7518c6fd2
1 changed files with 6 additions and 1 deletions
|
@ -40,6 +40,7 @@ import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import org.linphone.LinphoneActivity;
|
import org.linphone.LinphoneActivity;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
@ -312,16 +313,20 @@ public class ChatRoomCreationFragment extends Fragment
|
||||||
// Remove all contacts added before LIME switch was set
|
// Remove all contacts added before LIME switch was set
|
||||||
// and that can stay because they don't have the capability
|
// and that can stay because they don't have the capability
|
||||||
mContactsSelectedLayout.removeAllViews();
|
mContactsSelectedLayout.removeAllViews();
|
||||||
|
List<ContactAddress> toToggle = new ArrayList<>();
|
||||||
for (ContactAddress ca : mSearchAdapter.getContactsSelectedList()) {
|
for (ContactAddress ca : mSearchAdapter.getContactsSelectedList()) {
|
||||||
// If the ContactAddress doesn't have a contact keep it anyway
|
// If the ContactAddress doesn't have a contact keep it anyway
|
||||||
if (ca.getContact() != null && !ca.hasCapability(FriendCapability.LimeX3Dh)) {
|
if (ca.getContact() != null && !ca.hasCapability(FriendCapability.LimeX3Dh)) {
|
||||||
mSearchAdapter.toggleContactSelection(ca);
|
toToggle.add(ca);
|
||||||
} else {
|
} else {
|
||||||
if (ca.getView() != null) {
|
if (ca.getView() != null) {
|
||||||
mContactsSelectedLayout.addView(ca.getView());
|
mContactsSelectedLayout.addView(ca.getView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (ContactAddress ca : toToggle) {
|
||||||
|
mSearchAdapter.toggleContactSelection(ca);
|
||||||
|
}
|
||||||
mContactsSelectedLayout.invalidate();
|
mContactsSelectedLayout.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue