修复直播间长期不动会自动停止滚动的问题

This commit is contained in:
zlzw 2022-12-16 15:40:37 +08:00
parent bdc43baaa8
commit efc20c644a

View File

@ -129,7 +129,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
super.onScrolled(recyclerView, dx, dy); super.onScrolled(recyclerView, dx, dy);
if(isSlideToBottom(recyclerView))return; if(isSlideToBottom(recyclerView))return;
mRecyclerViewScrolledDy = dy; mRecyclerViewScrolledDy = dy;
Log.i(TAG, "onScrolled: dx = " + dx + ", dy = " + dy);
} }
}); });
} }
@ -390,14 +389,6 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
mList.remove(0); mList.remove(0);
} }
mList.add(bean); mList.add(bean);
int sum = (mRecyclerView.computeVerticalScrollExtent() + mRecyclerView.computeVerticalScrollOffset());
Log.i(TAG, "Extent=" + mRecyclerView.computeVerticalScrollExtent() +
"|Offset=" + mRecyclerView.computeVerticalScrollOffset() +
"|sum=" + sum +
"|Range=" + mRecyclerView.computeVerticalScrollRange() +
"|content=" + bean.getContent() +
((sum >= mRecyclerView.computeVerticalScrollRange()) ? "" : "|停止滑动")
);
if (isSlideToBottom(mRecyclerView) || mRecyclerViewScrolledDy == 0) { if (isSlideToBottom(mRecyclerView) || mRecyclerViewScrolledDy == 0) {
scrollToBottom(mRecyclerView); scrollToBottom(mRecyclerView);
} else { } else {