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));