android

Android直播间聊天消息列表,直播间RecyclerView

2022-05-27  本文已影响0人  大鼓书

Github链接,给个Star鼓励我写更多好库

直播间聊天消息列表,直播间RecyclerView。采用3层缓存机制,一秒内收到几百条消息依然不卡顿。

功能(优点):

具体技术说明:

效果gif图(Gif图有点卡,实际运行一点都不卡):


微信图片_20220530211658.jpg

导入

    allprojects {
        repositories {
            ...
            maven { url 'https://jitpack.io' }
        }
    }

    dependencies {
            implementation 'com.github.QDong415:QLiveMessageHelper:v1.0'
    }

使用


//给我们的库 liveMessageRecyclerHelper,绑定recyclerView
        liveMessageRecyclerHelper.setRecyclerView(recyclerView)
        liveMessageRecyclerHelper.setUnreadTipsView(unreadTipsTextView)
        liveMessageRecyclerHelper.messageRecyclerHelperListener = object: LiveMessageRecyclerHelper.LiveMessageRecyclerHelperListener<LiveMessageModel> {
            override fun unreadMessageCountUpdate(unreadCount: Int) {
                unreadTipsTextView.setText("还有"+unreadCount +"条未读")
            }

            override fun asyncParseSpannableString(model: LiveMessageModel) {
                //这一步是在子线程中
                model.spannableString = liveMessageTextViewHelper.displaySpannableString(model)
            }
        }

        //RecyclerView最短刷新时间间隔(0秒 - 2.0秒)
        liveMessageRecyclerHelper.diffRefreshDuration = (intent.getFloatExtra("minRefreshTime",0.6f) * 1000).toLong()

Author:DQ

我的其他开源库,给个Star鼓励我写更多好库:

Android 仿大众点评、仿小红书 下拉拖拽关闭Activity

Android 仿快手直播间手画礼物,手绘礼物

Android 直播间聊天消息列表RecyclerView。一秒内收到几百条消息依然不卡顿

Android 仿快手直播界面加载中,顶部的滚动条状LoadingView

Kotlin MVVM框架,全世界最优化的分页加载接口、最接地气的封装

Android 基于个推+华为push的一整套完善的android IM聊天系统

IOS1:1完美仿微信聊天表情键盘

上一篇 下一篇

猜你喜欢

热点阅读