修复直播聊天室还是会卡不会自动滚动问题

This commit is contained in:
zlzw 2022-12-27 13:52:01 +08:00
parent c8ba78f39b
commit 339d460c0f

View File

@ -129,7 +129,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (isBottom && dy >= 0) return;
// Log.i(TAG, "onScrolled: " + dy);
// Log.i(TAG, "onScrolled: " + dy);
mRecyclerViewScrolledDy = dy;
isBottom = false;
}
@ -138,11 +138,11 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == 0 && isSlideToBottom(recyclerView)) {
// Log.i(TAG, "onScrollStateChanged: 到底部了");
// Log.i(TAG, "onScrollStateChanged: 到底部了");
mRecyclerViewScrolledDy = 0;
isBottom = true;
} else if (newState == 0) {
// Log.i(TAG, "onScrollStateChanged: 不是底部");
// Log.i(TAG, "onScrollStateChanged: 不是底部");
isBottom = false;
}
}
@ -398,7 +398,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
if (bean == null) {
return;
}
// Log.i(TAG, "insertItem: " + bean.getContent());
// Log.i(TAG, "insertItem: " + bean.getContent()+" size = "+(mList.size()+1));
int size = mList.size();
//设置最大展示99条消息
if (size == 100) {