Improved unread chat message count
This commit is contained in:
parent
9cf6769713
commit
c20ebad33d
2 changed files with 3 additions and 11 deletions
|
@ -1803,8 +1803,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
|
||||
public int getUnreadMessageCount() {
|
||||
int count = 0;
|
||||
for (Integer unread : mUnreadChatsPerRoom.values()) {
|
||||
count += unread;
|
||||
for (ChatRoom room : mLc.getChatRooms()) {
|
||||
count += room.getUnreadMessagesCount();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
@ -1819,14 +1819,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
updateUnreadCountForChatRoom(key, value);
|
||||
}
|
||||
|
||||
public int getUnreadCountForChatRoom(ChatRoom cr) {
|
||||
String key = cr.getPeerAddress().asStringUriOnly();
|
||||
if (mUnreadChatsPerRoom.containsKey(key)) {
|
||||
return mUnreadChatsPerRoom.get(key);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void increaseUnreadCountForChatRoom(ChatRoom cr) {
|
||||
String key = cr.getPeerAddress().asStringUriOnly();
|
||||
if (mUnreadChatsPerRoom.containsKey(key)) {
|
||||
|
|
|
@ -101,7 +101,7 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
|
|||
}
|
||||
|
||||
displayName.setText(getContact(mRoom));
|
||||
unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
|
||||
unreadMessages.setText(String.valueOf(mRoom.getUnreadMessagesCount()));
|
||||
getAvatar(mRoom);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue