Search in sources :

Example 1 with OnRefreshListener

use of com.scwang.smart.refresh.layout.listener.OnRefreshListener 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)

Example 2 with OnRefreshListener

use of com.scwang.smart.refresh.layout.listener.OnRefreshListener in project ManPinAPP by AnyMarvel.

the class BookRankListActivity method bindEvent.

@Override
protected void bindEvent() {
    super.bindEvent();
    LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
    layoutManager.setOrientation(RecyclerView.VERTICAL);
    recommendRecyclerView.setLayoutManager(layoutManager);
    recommendRecyclerView.setItemAnimator(new DefaultItemAnimator());
    bookRrefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
            if (bookRankListAdapter != null) {
                mPresenter.getNextPageContent(bookRankUrl, bookRankListAdapter.getPageNumber() + 1);
            }
        }
    });
    bookRrefreshLayout.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh(@NonNull RefreshLayout refreshLayout) {
            mPresenter.initBookRankListData(bookRankUrl);
        }
    });
}
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) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DefaultItemAnimator(androidx.recyclerview.widget.DefaultItemAnimator) OnRefreshListener(com.scwang.smart.refresh.layout.listener.OnRefreshListener)

Aggregations

SmartRefreshLayout (com.scwang.smart.refresh.layout.SmartRefreshLayout)2 RefreshLayout (com.scwang.smart.refresh.layout.api.RefreshLayout)2 OnLoadMoreListener (com.scwang.smart.refresh.layout.listener.OnLoadMoreListener)2 OnRefreshListener (com.scwang.smart.refresh.layout.listener.OnRefreshListener)2 DefaultItemAnimator (androidx.recyclerview.widget.DefaultItemAnimator)1 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)1 BookRRecommendFRecyclerAdapter (com.mp.android.apps.main.bookR.adapter.BookRRecommendFRecyclerAdapter)1