use of com.chad.library.adapter.base.loadmore.LoadMoreView in project 91Pop by DanteAndroid.
the class BasePlayVideo method initVideoComments.
private void initVideoComments() {
List<VideoComment> videoCommentList = new ArrayList<>();
videoCommentAdapter = new VideoCommentAdapter(this, R.layout.item_video_comment, videoCommentList);
recyclerViewVideoComment.setLayoutManager(new LinearLayoutManager(this));
// recyclerViewVideoComment.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
recyclerViewVideoComment.setAdapter(videoCommentAdapter);
videoCommentAdapter.setLoadMoreView(new LoadMoreView() {
@Override
public int getLayoutId() {
return R.layout.loading;
}
@Override
protected int getLoadingViewId() {
return R.id.loading;
}
@Override
protected int getLoadFailViewId() {
return R.id.loadFailed;
}
@Override
protected int getLoadEndViewId() {
return R.id.loadEnd;
}
});
videoCommentAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
// 加载评论
if (unLimit91PornItem.getVideoResultId() == 0) {
videoCommentAdapter.loadMoreFail();
return;
}
presenter.loadVideoComment(unLimit91PornItem.getVideoResult().getVideoId(), unLimit91PornItem.getViewKey(), false);
}
}, recyclerViewVideoComment);
videoCommentAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (floatingToolbar.isShowing()) {
floatingToolbar.hide();
}
if (commentLayoutShown) {
if (videoCommentAdapter.getClickPosition() == position) {
hideCommentLayout();
}
} else {
showCommentLayout();
}
isComment = false;
videoComment = (VideoComment) adapter.getData().get(position);
etVideoComment.setHint("回复:" + videoComment.getuName());
videoCommentAdapter.setClickPosition(position);
}
});
recyclerViewVideoComment.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (dy > 0)
fab.hide();
else if (dy < -5)
fab.show();
}
});
}
Aggregations