From e58915edb6242a51d426e2a29cd3774022488c91 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Wed, 30 Nov 2022 18:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD=E9=97=B4=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java | 3 +-- .../main/java/com/yunbao/live/views/LiveRoomViewHolder.java | 1 + live/src/main/res/layout/dialog_live_role.xml | 2 +- 3 files changed, 3 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 0f1d43d2c..a410ef698 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java @@ -106,7 +106,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) { if (vh instanceof Vh) { - vh.setIsRecyclable(false); ((Vh) vh).setData(mList.get(position), position); } else if (vh instanceof RedPackVh) { ((RedPackVh) vh).setData(mList.get(position)); @@ -382,7 +381,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter { mList.add(bean); if (isSlideToBottom(mRecyclerView)) { - mRecyclerView.scrollToPosition(getItemCount() - 1); + mRecyclerView.smoothScrollToPosition(getItemCount() - 1); } else { Bus.get().post(new LiveAudienceEvent() .setType(LiveAudienceEvent.LiveAudienceType.NEW_MESSAGE_REMINDER)); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 4e3e557c3..9a312895c 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -853,6 +853,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis layoutManager.setStackFromEnd(true); mChatRecyclerView.setLayoutManager(layoutManager); mChatRecyclerView.addItemDecoration(new TopGradual()); + mChatRecyclerView.setItemViewCacheSize(8); mLiveChatAdapter = new LiveChatAdapter(mContext); mChatRecyclerView.setAdapter(mLiveChatAdapter); mLiveChatAdapter.setOnItemClickListener(new OnItemClickListener() { diff --git a/live/src/main/res/layout/dialog_live_role.xml b/live/src/main/res/layout/dialog_live_role.xml index 75187a2e4..bb2a3d80f 100644 --- a/live/src/main/res/layout/dialog_live_role.xml +++ b/live/src/main/res/layout/dialog_live_role.xml @@ -1,7 +1,7 @@