From cae05993075901ec828ce7a1712f3577db314ada Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Mon, 19 Dec 2022 15:32:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E6=B6=88=E6=81=AF=E5=8A=A8=E7=94=BB=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yunbao/live/adapter/LiveChatAdapter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 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 6a4b9e1ba..d0020fde6 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -127,7 +127,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); - if(isSlideToBottom(recyclerView))return; + if (isSlideToBottom(recyclerView)) return; mRecyclerViewScrolledDy = dy; } }); @@ -390,7 +390,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { } mList.add(bean); if (isSlideToBottom(mRecyclerView) || mRecyclerViewScrolledDy == 0) { - scrollToBottom(mRecyclerView); + scrollToBottom(); } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER)); @@ -401,7 +401,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter { mPosition = size; } } - notifyDataSetChanged(); + if (getItemCount() == 1) { + notifyDataSetChanged(); + } else { + notifyItemInserted(getItemCount()); + } }