Search in sources :

Example 1 with BookRRecommendFRecyclerAdapter

use of com.mp.android.apps.main.bookR.adapter.BookRRecommendFRecyclerAdapter in project ManPinAPP by AnyMarvel.

the class BookRRecommendFImpl method notifyRecyclerView.

@Override
public void notifyRecyclerView(List<SourceListContent> recommendList, List<SourceListContent> hotRankingList, List<SourceListContent> contentList, boolean useCache) {
    if (useCache || recommendRecyclerAdapter == null) {
        recommendRecyclerAdapter = new BookRRecommendFRecyclerAdapter(getContext(), this, recommendList, hotRankingList, contentList);
        recommendRecyclerView.setAdapter(recommendRecyclerAdapter);
    } else {
        recommendRecyclerAdapter.setRecommendList(recommendList);
        recommendRecyclerAdapter.setHotRankingList(hotRankingList);
        recommendRecyclerAdapter.setContentList(contentList);
        recommendRecyclerAdapter.notifyDataSetChanged();
    }
    bookRrefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
            mPresenter.getNextPageContent(recommendRecyclerAdapter.getmContentListPage() + 1);
        }
    });
    bookRrefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh(@NonNull RefreshLayout refreshLayout) {
            mPresenter.initBookRRcommendData();
        }
    });
    bookRrefreshLayout.finishRefresh();
}
Also used : OnLoadMoreListener(com.scwang.smart.refresh.layout.listener.OnLoadMoreListener) RefreshLayout(com.scwang.smart.refresh.layout.api.RefreshLayout) SmartRefreshLayout(com.scwang.smart.refresh.layout.SmartRefreshLayout) BookRRecommendFRecyclerAdapter(com.mp.android.apps.main.bookR.adapter.BookRRecommendFRecyclerAdapter) OnRefreshListener(com.scwang.smart.refresh.layout.listener.OnRefreshListener)

Aggregations

BookRRecommendFRecyclerAdapter (com.mp.android.apps.main.bookR.adapter.BookRRecommendFRecyclerAdapter)1 SmartRefreshLayout (com.scwang.smart.refresh.layout.SmartRefreshLayout)1 RefreshLayout (com.scwang.smart.refresh.layout.api.RefreshLayout)1 OnLoadMoreListener (com.scwang.smart.refresh.layout.listener.OnLoadMoreListener)1 OnRefreshListener (com.scwang.smart.refresh.layout.listener.OnRefreshListener)1