Search in sources :

Example 1 with VideoCommentAdapter

use of com.dante.adapter.VideoCommentAdapter 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();
        }
    });
}
Also used : VideoCommentAdapter(com.dante.adapter.VideoCommentAdapter) LoadMoreView(com.chad.library.adapter.base.loadmore.LoadMoreView) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) LoadMoreView(com.chad.library.adapter.base.loadmore.LoadMoreView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) VideoComment(com.dante.data.model.VideoComment) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 LoadMoreView (com.chad.library.adapter.base.loadmore.LoadMoreView)1 VideoCommentAdapter (com.dante.adapter.VideoCommentAdapter)1 VideoComment (com.dante.data.model.VideoComment)1 ArrayList (java.util.ArrayList)1