#在融云 IMkit 会话界面基础上添加消息已读未读.
使用过融云的同学们可能知道. 融云 IMkit 的会话界面, 发送玩消息后, 如果对方已读, 发送端则会显示小对号的图片. 但是更具需求要把小对号改为已读未读. 接下来我们就一块实现这个功能.
打开回执功能
首先, 要确定打开融云的消息回执功能. 这个很简单, 就是在 rc_config.xml 中把下面属性配置为 true 即可.
<!-- 设置是否开启消息回执, true 为打开, false 为关闭-->
<bool name="rc_read_receipt">true</bool>
这样发送消息后, 对方已读, 发送端就会出现融云默认的小对号了.
自定义 Adapter
出现小对号后, 下一步就是要进行对融云适配器的改造了.
第一步
创建 CustomMessageListAdapter 继承 MessageListAdapter. 根据自己的需求复写 newView() 或者 bindView() 方法.
class CustomMessageListAdapter extends MessageListAdapter {
@Override
protected void bindView(View v, final int position, final UIMessage data) {
// 此方法中操作控件
}
}
第二步
创建 CustomConversationFragment 继承于 ConversationFragment, 并复写父类中的 onResolveAdapter(), 返回 CustomMessageListAdapter 对象.
class CustomMessageListAdapter