Search in sources :

Example 6 with RefreshLayout

use of com.scwang.smart.refresh.layout.api.RefreshLayout 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 7 with RefreshLayout

use of com.scwang.smart.refresh.layout.api.RefreshLayout 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

RefreshLayout (com.scwang.smart.refresh.layout.api.RefreshLayout)7 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)5 View (android.view.View)4 TextView (android.widget.TextView)4 SmartRefreshLayout (com.scwang.smart.refresh.layout.SmartRefreshLayout)4 ArrayList (java.util.ArrayList)4 OnLoadMoreListener (com.scwang.smart.refresh.layout.listener.OnLoadMoreListener)3 ImageView (android.widget.ImageView)2 NonNull (androidx.annotation.NonNull)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 SetInitCustomView (com.knight.wanandroid.library_widget.SetInitCustomView)2 OnRefreshListener (com.scwang.smart.refresh.layout.listener.OnRefreshListener)2 SwipeRecyclerView (com.yanzhenjie.recyclerview.SwipeRecyclerView)2 Manifest (android.Manifest)1 SuppressLint (android.annotation.SuppressLint)1 AlertDialog (android.app.AlertDialog)1 DatePickerDialog (android.app.DatePickerDialog)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1