Search in sources :

Example 1 with VideoAdapter

use of cn.nicolite.palm300heroes.view.adapter.VideoAdapter in project Palm300Heroes by nicolite.

the class VideoFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new VideoAdapter(context, videoList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    videoPresenter = new VideoPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            currentPage = 1;
            videoPresenter.loadVideoList();
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
            videoPresenter.loadMore(++currentPage);
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

        @Override
        public void reload() {
            videoPresenter.loadMore(currentPage);
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Bilibili.DataBean.VlistBean vlistBean = videoList.get(position);
            Bundle bundle = new Bundle();
            bundle.putInt("type", WebViewActivity.TYPE_VIDEO);
            bundle.putString("title", vlistBean.getTitle());
            bundle.putString("url", "https://m.bilibili.com/video/av" + vlistBean.getAid() + ".html");
            startActivity(WebViewActivity.class, bundle);
        }
    });
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) VideoAdapter(cn.nicolite.palm300heroes.view.adapter.VideoAdapter) Bundle(android.os.Bundle) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WebViewActivity(cn.nicolite.palm300heroes.view.activity.WebViewActivity) IVideoView(cn.nicolite.palm300heroes.view.iview.IVideoView) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) Bilibili(cn.nicolite.palm300heroes.model.bean.Bilibili) VideoPresenter(cn.nicolite.palm300heroes.presenter.VideoPresenter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Aggregations

Bundle (android.os.Bundle)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 View (android.view.View)1 BindView (butterknife.BindView)1 Bilibili (cn.nicolite.palm300heroes.model.bean.Bilibili)1 VideoPresenter (cn.nicolite.palm300heroes.presenter.VideoPresenter)1 WebViewActivity (cn.nicolite.palm300heroes.view.activity.WebViewActivity)1 VideoAdapter (cn.nicolite.palm300heroes.view.adapter.VideoAdapter)1 IVideoView (cn.nicolite.palm300heroes.view.iview.IVideoView)1 OnItemClickListener (com.github.jdsjlzx.interfaces.OnItemClickListener)1 OnLoadMoreListener (com.github.jdsjlzx.interfaces.OnLoadMoreListener)1 OnNetWorkErrorListener (com.github.jdsjlzx.interfaces.OnNetWorkErrorListener)1 OnRefreshListener (com.github.jdsjlzx.interfaces.OnRefreshListener)1 LRecyclerView (com.github.jdsjlzx.recyclerview.LRecyclerView)1 LRecyclerViewAdapter (com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter)1