Fixes & improvements in chat rooms list display
This commit is contained in:
parent
d9df197d3d
commit
b2b7b5092f
1 changed files with 13 additions and 16 deletions
|
@ -137,21 +137,13 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
||||||
|
|
||||||
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
|
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
|
||||||
LinphoneContact contact;
|
LinphoneContact contact;
|
||||||
if (mRoom.getParticipants().length > 0) {
|
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
|
||||||
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
|
if (contact != null) {
|
||||||
if (contact != null) {
|
return contact.getFullName();
|
||||||
return (contact.getFullName());
|
|
||||||
}
|
|
||||||
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
|
|
||||||
} else {
|
|
||||||
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
|
|
||||||
if (contact != null) {
|
|
||||||
return (contact.getFullName());
|
|
||||||
}
|
|
||||||
return (LinphoneUtils.getAddressDisplayName(contactAddress));
|
|
||||||
}
|
}
|
||||||
|
return LinphoneUtils.getAddressDisplayName(contactAddress);
|
||||||
}
|
}
|
||||||
return (mRoom.getSubject());
|
return mRoom.getSubject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAvatar(ChatRoom mRoom) {
|
public void getAvatar(ChatRoom mRoom) {
|
||||||
|
@ -172,10 +164,15 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
||||||
ContactAvatar.displayAvatar(contact, avatarLayout);
|
ContactAvatar.displayAvatar(contact, avatarLayout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String username = mRoom.getPeerAddress().getDisplayName();
|
Address remoteAddr;
|
||||||
if (username == null) {
|
if (mRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
|
||||||
username = mRoom.getPeerAddress().getUsername();
|
Participant[] participants = mRoom.getParticipants();
|
||||||
|
remoteAddr = participants[0].getAddress();
|
||||||
|
} else {
|
||||||
|
remoteAddr = mRoom.getPeerAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String username = LinphoneUtils.getAddressDisplayName(remoteAddr);
|
||||||
if (mRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
|
if (mRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
|
||||||
ContactAvatar.displayAvatar(username, mRoom.getSecurityLevel(), avatarLayout);
|
ContactAvatar.displayAvatar(username, mRoom.getSecurityLevel(), avatarLayout);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue