融云--监听未读消息数量

RongIM.getInstance().addUnReadMessageCountChangedObserver(i -> {
    HHLog.i("Lyb", "unRead===" + i + "");
    // i 是未读数量
    if (i < 1) {
        getMsgCountNum().setVisibility(View.GONE);
    } else if (i < 100) {
        getMsgCountNum().setVisibility(View.VISIBLE);
        getMsgCountNum().setText(" " + i + " ");
    } else {
        getMsgCountNum().setVisibility(View.VISIBLE);
        getMsgCountNum().setText("99+");
    }
}, Conversation.ConversationType.PRIVATE);

你可能感兴趣的:(融云)