Allow group chat rooms with only 2 participants
This commit is contained in:
parent
f1c17e1a93
commit
c5440e1068
2 changed files with 21 additions and 3 deletions
|
@ -38,6 +38,7 @@ import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneUtils;
|
import org.linphone.LinphoneUtils;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.activities.LinphoneActivity;
|
import org.linphone.activities.LinphoneActivity;
|
||||||
|
import org.linphone.contacts.ContactAddress;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.contacts.LinphoneContact;
|
import org.linphone.contacts.LinphoneContact;
|
||||||
import org.linphone.core.Address;
|
import org.linphone.core.Address;
|
||||||
|
@ -111,7 +112,24 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener {
|
||||||
mGroupInfosButton.setOnClickListener(new View.OnClickListener() {
|
mGroupInfosButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if (mChatRoom == null) return;
|
||||||
|
ArrayList<ContactAddress> participants = new ArrayList<ContactAddress>();
|
||||||
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
|
Address a = p.getAddress();
|
||||||
|
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(a);
|
||||||
|
if (c == null) {
|
||||||
|
c = new LinphoneContact();
|
||||||
|
String displayName = a.getDisplayName();
|
||||||
|
if (displayName == null || displayName.isEmpty()) {
|
||||||
|
c.setFullName(a.getUsername());
|
||||||
|
} else {
|
||||||
|
c.setFullName(displayName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ContactAddress ca = new ContactAddress(c, a.asString(), c.isFriend());
|
||||||
|
participants.add(ca);
|
||||||
|
}
|
||||||
|
LinphoneActivity.instance().displayChatGroupInfos(participants, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class GroupInfoFragment extends Fragment {
|
||||||
mParticipants.remove(ca);
|
mParticipants.remove(ca);
|
||||||
mAdapter.updateDataSet(mParticipants);
|
mAdapter.updateDataSet(mParticipants);
|
||||||
mParticipantsList.setAdapter(mAdapter);
|
mParticipantsList.setAdapter(mAdapter);
|
||||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 1);
|
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mParticipantsList.setAdapter(mAdapter);
|
mParticipantsList.setAdapter(mAdapter);
|
||||||
|
@ -104,7 +104,7 @@ public class GroupInfoFragment extends Fragment {
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 1);
|
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 0);
|
||||||
|
|
||||||
mLeaveGroupButton = view.findViewById(R.id.leaveGroupLayout);
|
mLeaveGroupButton = view.findViewById(R.id.leaveGroupLayout);
|
||||||
mLeaveGroupButton.setOnClickListener(new View.OnClickListener() {
|
mLeaveGroupButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue