com.github.jdsjlzx.interfaces.OnLoadMoreListener Java Examples
The following examples show how to use
com.github.jdsjlzx.interfaces.OnLoadMoreListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassifiesShowActivity.java From HHComicViewer with Apache License 2.0 | 6 votes |
private void initRecyclerView() { //关闭下拉刷新功能 mBinding.recyclerView.setPullRefreshEnabled(false); //设置上拉加载更多 mBinding.recyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { if (mPage < mMaxPage) { mPage++; mPresenter.getComicList(mUrl, mPage); } } }); //如果网络出现异常,重新加载代码 mBinding.recyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() { @Override public void reload() { mPresenter.getComicList(mUrl, mPage); } }); //首先加载第一页 mPresenter.getComicList(mUrl, mFirstPage); }
Example #2
Source File: LoadingFooter.java From LRecyclerView with Apache License 2.0 | 5 votes |
@Override public void setOnClickLoadMoreListener(final OnLoadMoreListener listener) { setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setState(State.Loading); listener.onLoadMore(); } }); }
Example #3
Source File: ClickLoadingFooter.java From LRecyclerView with Apache License 2.0 | 5 votes |
@Override public void setOnClickLoadMoreListener(final OnLoadMoreListener listener) { setVisibility(VISIBLE); setState(State.ManualLoadMore); setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setState(State.Loading); listener.onLoadMore(); } }); }
Example #4
Source File: CustLoadingFooter.java From LRecyclerView with Apache License 2.0 | 5 votes |
@Override public void setOnClickLoadMoreListener(final OnLoadMoreListener listener) { setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setState(State.Loading); listener.onLoadMore(); } }); }
Example #5
Source File: CategoryAdapter.java From LRecyclerView with Apache License 2.0 | 5 votes |
private void bindFootItem(SuperViewHolder holder, final MultipleItem item) { ClickLoadingFooter footer = holder.getView(R.id.footer); footer.setOnClickLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { Log.e("lzx","CategoryAdapter onLoadMore getFootCategory() " + item.getFootCategory()); loadMoreListener.loadMore(item.getFootCategory()); } }); }
Example #6
Source File: LRecyclerView.java From LRecyclerView with Apache License 2.0 | 4 votes |
public void setOnLoadMoreListener(OnLoadMoreListener listener) { mLoadMoreListener = listener; }
Example #7
Source File: LuRecyclerView.java From LRecyclerView with Apache License 2.0 | 4 votes |
public void setOnLoadMoreListener(OnLoadMoreListener listener) { mLoadMoreListener = listener; }
Example #8
Source File: EndlessGridLayoutActivity.java From LRecyclerView with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sample_ll_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mRecyclerView = (LRecyclerView) findViewById(R.id.list); //setLayoutManager must before setAdapter GridLayoutManager manager = new GridLayoutManager(this, 2); mRecyclerView.setLayoutManager(manager); mDataAdapter = new DataAdapter(this); mLRecyclerViewAdapter = new LRecyclerViewAdapter(mDataAdapter); mRecyclerView.setAdapter(mLRecyclerViewAdapter); //设置头部加载颜色 mRecyclerView.setHeaderViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white); //设置底部加载颜色 mRecyclerView.setFooterViewColor(R.color.colorAccent, R.color.dark ,android.R.color.white); //设置底部加载文字提示 mRecyclerView.setFooterViewHint("拼命加载中","已经全部为你呈现了","网络不给力啊,点击再试一次吧"); int spacing = getResources().getDimensionPixelSize(R.dimen.dp_4); mRecyclerView.addItemDecoration(SpacesItemDecoration.newInstance(spacing, spacing, manager.getSpanCount(), Color.GRAY)); //根据需要选择使用GridItemDecoration还是SpacesItemDecoration GridItemDecoration divider = new GridItemDecoration.Builder(this) .setHorizontal(R.dimen.default_divider_padding) .setVertical(R.dimen.default_divider_padding) .setColorResource(R.color.split) .build(); //mRecyclerView.addItemDecoration(divider); mRecyclerView.setHasFixedSize(true); mLRecyclerViewAdapter.addHeaderView(new SampleHeader(this)); //设置span,自己可以体验效果 /*mLRecyclerViewAdapter.setSpanSizeLookup(new LRecyclerViewAdapter.SpanSizeLookup() { @Override public int getSpanSize(GridLayoutManager gridLayoutManager, int position) { if (position % 4 == 0) { return gridLayoutManager.getSpanCount(); } else { return 1; } } });*/ mRecyclerView.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mCurrentCounter = 0; mDataAdapter.clear(); requestData(); } }); mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { if (mCurrentCounter < TOTAL_COUNTER) { // loading more requestData(); } else { //the end mRecyclerView.setNoMore(true); } } }); mRecyclerView.refresh(); }
Example #9
Source File: CollapsingToolbarLayoutActivity.java From LRecyclerView with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_collapsing_toolbar_layout); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mRecyclerView = (LRecyclerView) findViewById(R.id.list); //init data ArrayList<ItemModel> dataList = new ArrayList<>(); for (int i = 0; i < 10; i++) { ItemModel item = new ItemModel(); item.id = i; item.title = "item" + i; dataList.add(item); } mCurrentCounter = dataList.size(); mDataAdapter = new DataAdapter(this); mDataAdapter.addAll(dataList); mLRecyclerViewAdapter = new LRecyclerViewAdapter(mDataAdapter); mRecyclerView.setAdapter(mLRecyclerViewAdapter); DividerDecoration divider = new DividerDecoration.Builder(this) .setHeight(R.dimen.default_divider_height) .setPadding(R.dimen.default_divider_padding) .setColorResource(R.color.split) .build(); mRecyclerView.setHasFixedSize(true); mRecyclerView.addItemDecoration(divider); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mCurrentCounter = 0; mDataAdapter.clear(); requestData(); } }); mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { if (mCurrentCounter < TOTAL_COUNTER) { // loading more requestData(); } else { //the end mRecyclerView.setNoMore(true); } } }); }
Example #10
Source File: EndlessStaggeredGridLayoutActivity.java From LRecyclerView with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sample_ll_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mRecyclerView = (LRecyclerView) findViewById(R.id.list); mDataAdapter = new DataAdapter(this); mLRecyclerViewAdapter = new LRecyclerViewAdapter(mDataAdapter); mRecyclerView.setAdapter(mLRecyclerViewAdapter); //setLayoutManager StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager( 2, StaggeredGridLayoutManager.VERTICAL); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); //防止item位置互换 layoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_NONE); mRecyclerView.setLayoutManager(layoutManager); mLRecyclerViewAdapter.addHeaderView(new SampleHeader(this)); mRecyclerView.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh() { mCurrentCounter = 0; mDataAdapter.clear(); requestData(); } }); mRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() { @Override public void onLoadMore() { if (mCurrentCounter < TOTAL_COUNTER) { // loading more requestData(); } else { //the end mRecyclerView.setNoMore(true); } } }); mRecyclerView.refresh(); }