Awesome Open Source
Awesome Open Source

中文版文档

ZRefreshLayout

A global random configuration head , drop-down refresh and loadMore library;

Feature

  • [x] support refresh and loadMore
  • [x] support Timeout automatically complete the action
  • [x] support nest scroll
  • [x] support All the View:ImageView,FrameLayout,ListView, GridView, ScrollView, WebView...
  • [x] support Global configuration (HeaderView's configuration is here,so not have xml's property),and Independent changes
  • [x] support auto refresh
  • [x] support header fixed
  • [x] support refresh's Trigger position
  • [x] support drop-down's position map(as IResistance)
  • [x] support add many childs。because extends FrameLayout(not must be one,because more changeful)

JicPack

Add it in your root build.gradle at the end of repositories:

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

Step 2. Add the dependency

compile 'com.github.luhaoaimama1:ZRefreshLayout:Latest release'

not anroidX version compile 'com.github.luhaoaimama1:ZRefreshLayout:1.0.19' branch:notAndroidx

Step 3: you need provide

because compileOnly 'androidx.recyclerview:recyclerview:1.0.0'

UML

Preview

header fixed

Meterial Header与Footer

SinaRefreshHeader与LoadFooter

WaveHead

CircleRefresh Head

引用tuesda的CircleView 主要是为了测试延迟功能

Usage

Global configuration

      Config.build()
            .setHeader(new MeterialHead())
            .setFooter(new MeterialFooter())
            .setResistance(new Damping())
            .writeLog(true)
            .perform();

Independent changes

    refresh.setIHeaderView(new SinaRefreshHeader());

header fixed

    refresh.setHeadPin(ZRefreshLayout.HeadPin.PIN)

auto refresh

    refresh.autoRefresh(haveAnimate)

refresh's listener

refresh complete ,Remember to use:zRefreshLayout.refreshComplete();

      refresh.setPullListener(new ZRefreshLayout.PullListener() {
               @Override
               public void refresh(final ZRefreshLayout zRefreshLayout) {
                   tv.postDelayed(new Runnable() {
                       @Override
                       public void run() {
                           tv.setText("刷新完毕:" + i++);
                           zRefreshLayout.refreshComplete();
                       }
                   }, 500);
               }
           });

loadMore's Listener

if not setLoadMoreListener,not have loadMore feature;

loadMore complete ,Remember to use:zRefreshLayout.loadMoreComplete();

         refresh.setPullListener(new ZRefreshLayout.PullListener() {
                  @Override
                  public void refresh(final ZRefreshLayout zRefreshLayout) {
                      tv.postDelayed(new Runnable() {
                          @Override
                          public void run() {
                              tv.setText("刷新完毕:" + i++);
                              zRefreshLayout.refreshComplete();
                          }
                      }, 500);
                  }
              });

HeadView and FooterView 's custom and More advanced features,please see Wiki Document;;

Reference&Thanks:

https://awesomeopensource.com/project/lcodecorex/TwinklingRefreshLayout

https://awesomeopensource.com/project/tuesda/CircleRefreshLayout

https://awesomeopensource.com/project/android-cjj/Android-MaterialRefreshLayout

https://awesomeopensource.com/project/desmond1121/Android-Ptr-Comparison

https://awesomeopensource.com/project/liaohuqiu/android-Ultra-Pull-To-Refresh


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (709,010
Drop (195
Related Projects