From 9fcc04cef25edc0e88ab6ff72b8d3de4df4d46ce Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Sun, 8 Jan 2023 14:42:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95=E9=87=8D=E5=8F=A0=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/yunbao/live/adapter/LiveChatAdapter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java index cce3d4c7d..ac142a8e4 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -402,7 +402,8 @@ public class LiveChatAdapter extends RecyclerView.Adapter { // Log.i(TAG, "insertItem: " + bean.getContent()+" size = "+(mList.size()+1)); int size = mList.size(); //设置最大展示99条消息 - if (size == 100) { + if (size >= 100 && (isBottom || mRecyclerViewScrolledDy == 0)) { + mList.subList(0, 50).clear(); notifyItemRangeRemoved(0, 50); } @@ -414,7 +415,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } // size = mList.size(); if (isBottom || mRecyclerViewScrolledDy == 0) { - scrollToBottom(); + scrollToBottom(); } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER));