★ wanayoo — archive 1999 https://github.com/29995270/HorizontalRefreshLayoutNouvelle recherche | Portail wanayoo
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

HorizontalRefreshLayout

a android layout widget for horizontal drag refresh action (viewpager or recyclerview or horizontal Scrollview)


dependencies

Step 1. Add the JitPack repository to your build file

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

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

Step 2. Add the dependency

	dependencies {
	        compile 'com.github.29995270:HorizontalRefreshLayout:1.0.1'
	}

how to use

    <com.wq.freeze.horizontalrefreshlayout.lib.HorizontalRefreshLayout
        android:id="@+id/refresh"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white">
        <android.support.v4.view.ViewPager
            android:id="@+id/vp"
            android:layout_width="match_parent"
            android:layout_height="300dp"/>
    </com.wq.freeze.horizontalrefreshlayout.lib.HorizontalRefreshLayout>
    refreshLayout.setRefreshMode(HorizontalRefreshLayout.MODE_ABOVE);
    //MODE_ABOVE: RefreshHeader above of refreshable view
    //MODE_UNDER: RefreshHeader under the refreshable view
    //MODE_UNDER_FOLLOW_DRAG: RefreshHeader under the refreshable view and follow drag action

    //define your RefreshHeader
    refreshLayout.setRefreshHeader(new MaterialRefreshHeader(HorizontalRefreshLayout.START),
                    HorizontalRefreshLayout.START);
    refreshLayout.setRefreshHeader(new MaterialRefreshHeader(HorizontalRefreshLayout.END),
            HorizontalRefreshLayout.END);

    refreshLayout.setRefreshCallback(this);

    // refreshLayout.startAutoRefresh(true); // if you want to refresh in code
        
    @Override
    public void onLeftRefreshing() {
        refreshLayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                adapter.onRefresh();
                refreshLayout.onRefreshComplete();
            }
        }, 1000);
    }

    @Override
    public void onRightRefreshing() {
        refreshLayout.postDelayed(new Runnable() {
            @Override
            public void run() {
                adapter.onLoadMore();
                refreshLayout.onRefreshComplete();
            }
        }, 1000);
    }

About

a android layout widget for horizontal drag refresh action (viewpager or recyclerview)

Topics

Resources

Packages

No packages published

Languages

You can’t perform that action at this time.