All Projects → haoxikang → GeneralRecyclerViewFragment

haoxikang / GeneralRecyclerViewFragment

Licence: other
Can automatically pull down the refresh, pull up the page of RecyclerviewFragment(能够自动下拉刷新,上拉翻页的RecyclerviewFragment)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to GeneralRecyclerViewFragment

Pull To Make Soup
Custom animated pull-to-refresh that can be easily added to RecyclerView
Stars: ✭ 1,443 (+2476.79%)
Mutual labels:  recyclerview, pull-to-refresh
Brv
Android上最强大的RecyclerView库
Stars: ✭ 345 (+516.07%)
Mutual labels:  recyclerview, pull-to-refresh
Binding
Simple API implement DataBinding and ViewBinding. 简单的 API 实现 DataBinding 和 ViewBinding,欢迎 star
Stars: ✭ 169 (+201.79%)
Mutual labels:  recyclerview, fragment
Ultimaterefreshview
UltimateRefreshView 实现下拉刷新,上拉加载更多的轻量级库;支持RecyclerView ,ListView ,ScrollView & WebView
Stars: ✭ 64 (+14.29%)
Mutual labels:  recyclerview, pull-to-refresh
solid
Solid Android components
Stars: ✭ 33 (-41.07%)
Mutual labels:  recyclerview, fragment
Xrefreshlayout
【已过时,不再更新,请使用更强大的SmartRefreshLayout!】A refresh layout(无侵入下拉刷新和加载布局), can refresh RecyclerView for all LayoutManager, NestedScrollView。
Stars: ✭ 127 (+126.79%)
Mutual labels:  recyclerview, pull-to-refresh
My Android Garage
A quick reference guide for Android development.
Stars: ✭ 66 (+17.86%)
Mutual labels:  recyclerview, fragment
MultiSelectionRecyclerView
Android RecyclerView multi selection expand list items and change list items color
Stars: ✭ 19 (-66.07%)
Mutual labels:  recyclerview
InfiniteScrollRecyclerView
Enables the RecyclerView to Auto scroll for indefinite time.
Stars: ✭ 49 (-12.5%)
Mutual labels:  recyclerview
App-Manager-Android
An app manager for Android written in Kotlin. View app related info, launch or uninstall apps.
Stars: ✭ 31 (-44.64%)
Mutual labels:  recyclerview
SortedListAdapter
The RecyclerView.Adapter that makes your life easy!
Stars: ✭ 48 (-14.29%)
Mutual labels:  recyclerview
PullSeparateRecyclerView
No description or website provided.
Stars: ✭ 29 (-48.21%)
Mutual labels:  recyclerview
RecyclerViewItemTouchUsing
图文混排发帖(完美复现汽车之家论坛发帖)
Stars: ✭ 23 (-58.93%)
Mutual labels:  recyclerview
InfiniteScroll
You can do a Endless scroll in ListView or RecyclerView with simple steps, with a listener for do request to your web service.
Stars: ✭ 28 (-50%)
Mutual labels:  recyclerview
TimelineView
A customizable and easy-to-use Timeline View library for Android. Works as a RecyclerView decorator (ItemDecoration)
Stars: ✭ 169 (+201.79%)
Mutual labels:  recyclerview
Statik
A simple static list information backed by RecyclerView for Android in Kotlin
Stars: ✭ 22 (-60.71%)
Mutual labels:  recyclerview
codeKK-Android
http://p.codekk.com/
Stars: ✭ 29 (-48.21%)
Mutual labels:  recyclerview
AndroidRecyclerViewWithLoadingEmptyAndRetry
recyclerview
Stars: ✭ 16 (-71.43%)
Mutual labels:  recyclerview
RecyclerViewAdapter
A RecyclerView Adapter that support load more and add headerview
Stars: ✭ 145 (+158.93%)
Mutual labels:  recyclerview
Android-Model-View-Presenter
No description or website provided.
Stars: ✭ 26 (-53.57%)
Mutual labels:  recyclerview

GeneralRecyclerViewFragment for android

This Fragment can automatically handle the logic of the next page by pulldown and pull-up loading. Just set up the data source and adapter to start working. Support horizontal and vertical sliding. Supports LinearLayoutManager, StaggeredGridLayoutManager, and GridLayoutManage

这个Fragment能够自动处理下拉刷新和上拉加载下一页的逻辑。 只需要设置数据源和adapter就能开始工作。支持横向和竖向滑动。支持第三方下拉刷新框架。具有高度的定制性

Download

Step 1. Add the JitPack repository to your build file

allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }    
		}   
	}

Step 2. Add the dependency

dependencies {
           compile 'com.github.348476129:GeneralRecyclerViewFragment:1.2.5'
   }

How to use

Step 1.Create a class that extends to the GeneralPresenter.

 第一步.创建一个类,让他继承于GeneralPresenter。

Overrides the refreshData () and loadNextPageData (final int page) methods.

重写refreshData()和 loadNextPageData(final int page) 方法。

public class TestPresenter extends GeneralPresenter {


  @Override
  public void refreshData() {
      new Handler().postDelayed(new Runnable() {
          public void run() {
              List<String> list = new ArrayList<>();
              for (int i = 0; i < 50; i++) {
                  list.add("ddd" + i);
              }
              refreshFinish(list); //When the data is acquired
              //    onRefreshError("加载失败");
          }

      }, 2000);
  }

  @Override
  public void loadNextPageData(final int page) {
      Log.d(TAG, page + " ");
      new Handler().postDelayed(new Runnable() {

          public void run() {
              List<String> list = new ArrayList<>();
              for (int i = 0; i < 50; i++) {
                  list.add("b" + page + "   " + i);
              }
              loadNextPageFinish(list); //When the data is acquired
              //  onLoadNextError("加载下一页失败");
          }

      }, 2000);
  }
}

Step 2.Create a adpter that implements to the GeneralAdapter.

第二步.创建一个adpter,让它实现GeneralAdapter。

public class TestAdapter extends RecyclerView.Adapter<TestAdapter.MyViewHolder> implements GeneralAdapter {

    private GeneralDataController<String> mStringGeneralDataController;

    public TestAdapter() {
        mStringGeneralDataController = new GeneralDataController<>(this);
    }
    @Override
    public GeneralDataController getGeneralDataController() {
        return mStringGeneralDataController;
    }
	..........your code.........
}

Step 3.Create a class that extends to the GeneralRecyclerViewFragment.

第三步. 创建一个类,让他继承GeneralRecyclerViewFragment。

        @NonNull
    @Override
    protected GeneralContract.Presenter getPresenter() {
        if (testPresenter == null) {
            testPresenter = new TestPresenter();
        }
        return testPresenter;
    }

    @NonNull
    @Override
    protected RecyclerView.Adapter getAdapter() {
        if (testAdapter == null) {
            testAdapter = new TestAdapter();
        }
        return testAdapter;
    }

    @NonNull
    @Override
    protected RecyclerView.LayoutManager getLayoutManager() {
        if (layoutManager == null) {
            layoutManager = new LinearLayoutManager(getContext());
        }
        return layoutManager;
    }

See the examples for more details.

进阶用法:

如果你想自定义下拉刷新库,或者自己处理一些错误逻辑,请继承BaseGeneraFragment 并实现其中的方法。写法可以参考GeneralRecyclerViewFragment

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].