From 924603fd1b07ce17c9e93aeb7d23d537e07a71f3 Mon Sep 17 00:00:00 2001 From: baoyongzhang Date: Thu, 24 Sep 2015 18:40:02 +0800 Subject: [PATCH 1/2] version 1.2.0 --- README.md | 2 +- library/build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a9ee63..81f98fa 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add dependency. ``` dependencies { - compile 'com.baoyz.pullrefreshlayout:library:1.1.0' + compile 'com.baoyz.pullrefreshlayout:library:1.2.0' } ``` diff --git a/library/build.gradle b/library/build.gradle index 154cd90..9bf09a1 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -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" From 3b439e1d6762880063eedf4b347eaa1f417d086d Mon Sep 17 00:00:00 2001 From: baoyongzhang Date: Fri, 25 Sep 2015 00:27:17 +0800 Subject: [PATCH 2/2] Update README --- README.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 81f98fa..7a0c4cd 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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"> @@ -84,6 +84,12 @@ 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 @@ -91,12 +97,65 @@ In xml, use attributes. 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"> ``` +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)