Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 63 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add dependency.

```
dependencies {
compile 'com.baoyz.pullrefreshlayout:library:1.1.0'
compile 'com.baoyz.pullrefreshlayout:library:1.2.0'
}
```

Expand Down Expand Up @@ -54,7 +54,7 @@ layout.setRefreshing(false);

```

Change the refresh style, there are four styles of use, `MATERIAL`、`CIRCLES`、 `WATER_DROP` and `RING`.
Change the refresh style, there are five styles of use, `MATERIAL`、`CIRCLES`、 `WATER_DROP`、`RING` and `SMARTISAN`.

In java, call `setRefreshStyle` method.

Expand All @@ -70,7 +70,7 @@ In xml, use attributes.
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:type="water_drop">
app:refreshType="water_drop">

</com.baoyz.widget.PullRefreshLayout>

Expand All @@ -84,19 +84,78 @@ layout.setColorSchemeColors(int []);

```

For Smartisan style, it has only one color, can call 'setColor' method, to set one color.

```java
layout.setColor(int);
```

In xml, use attributes.

```xml
<com.baoyz.widget.PullRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:colors="@array/scheme_colors">
app:refreshColors="@array/scheme_colors"
app:refreshColor="@color/one_color">

</com.baoyz.widget.PullRefreshLayout>

```

If you do not like these styles, you can customize the refresh style.

```java
class CustomDrawable extends RefreshDrawable{

@Override
public void setPercent(float percent) {
// Percentage of the maximum distance of the drop-down refresh.
}

@Override
public void setColorSchemeColors(int[] colorSchemeColors) {

}

@Override
public void offsetTopAndBottom(int offset) {
// Drop-down offset.
}

@Override
public void start() {
isRunning = true;
// Refresh started, start refresh animation.
}

@Override
public void stop() {
isRunning = false;
// Refresh completed, stop refresh animation.
}

@Override
public boolean isRunning() {
return isRunning;
}

@Override
public void draw(Canvas canvas) {
// Draw custom style.
}

}

```

Call `setRefreshDrawable()` method to use your custom refresh drawable.

```java
layout.setRefreshDrawable(new CustomDrawable());
```

# Thanks

* [SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html)
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "2.0.0"
version = "1.2.0"
def siteUrl = 'https://github.com/baoyongzhang/android-PullRefreshLayout'
def gitUrl = 'https://github.com/baoyongzhang/android-PullRefreshLayout.git'
group = "com.baoyz.pullrefreshlayout"
Expand Down