Skip to content

Commit 5484af3

Browse files
committed
add OnStateChangedListener
1 parent e639797 commit 5484af3

8 files changed

Lines changed: 152 additions & 54 deletions

File tree

README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ allprojects {
2222
##### Step 2. Add the dependency
2323
~~~ xml
2424
dependencies {
25-
compile 'com.github.andyxialm:MultiStateLayout:0.1.0'
25+
compile 'com.github.andyxialm:MultiStateLayout:0.1.1'
2626
}
2727
~~~
2828

@@ -42,7 +42,7 @@ dependencies {
4242
<dependency>
4343
<groupId>com.github.andyxialm</groupId>
4444
<artifactId>MultiStateLayout</artifactId>
45-
<version>0.1.0</version>
45+
<version>0.1.1</version>
4646
</dependency>
4747
~~~
4848

@@ -118,6 +118,18 @@ mMultiStateLayout.setOnStateViewCreatedListener(new OnStateViewCreatedListener()
118118

119119
```
120120

121+
##### Add a listener that will be invoked whenever the state view changes or is incrementally.
122+
```java
123+
124+
mMultiStateLayout.addOnStateChangedListener(new OnStateChangedListener() {
125+
@Override
126+
public void onChanged(int state) {
127+
128+
}
129+
});
130+
131+
```
132+
121133
##### How to add customize state view?
122134
```java
123135
View customStateView = LayoutInflater.from(this).inflate(R.layout.layout_custom_notice, mStateLayout, false);
@@ -165,7 +177,7 @@ allprojects {
165177
##### Step 2. Add the dependency
166178
~~~ xml
167179
dependencies {
168-
compile 'com.github.andyxialm:MultiStateLayout:0.1.0'
180+
compile 'com.github.andyxialm:MultiStateLayout:0.1.1'
169181
}
170182
~~~
171183

@@ -185,7 +197,7 @@ dependencies {
185197
<dependency>
186198
<groupId>com.github.andyxialm</groupId>
187199
<artifactId>MultiStateLayout</artifactId>
188-
<version>0.1.0</version>
200+
<version>0.1.1</version>
189201
</dependency>
190202
~~~
191203

@@ -261,6 +273,18 @@ mMultiStateLayout.setOnStateViewCreatedListener(new OnStateViewCreatedListener()
261273

262274
```
263275

276+
##### 监听状态改变
277+
```java
278+
279+
mMultiStateLayout.addOnStateChangedListener(new OnStateChangedListener() {
280+
@Override
281+
public void onChanged(int state) {
282+
283+
}
284+
});
285+
286+
```
287+
264288
##### 如何添加自定义的状态视图?
265289
```java
266290
View customStateView = LayoutInflater.from(this).inflate(R.layout.layout_custom_notice, mStateLayout, false);

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.0.0'
910
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1011

1112
// NOTE: Do not place your application dependencies here; they belong
@@ -16,6 +17,7 @@ buildscript {
1617
allprojects {
1718
repositories {
1819
jcenter()
20+
google()
1921
}
2022
}
2123

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Dec 05 22:51:00 CST 2016
1+
#Thu Nov 02 17:36:25 CST 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

multistatelayout/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ apply plugin: 'com.github.dcendents.android-maven'
33
group='com.github.andyxialm'
44

55
android {
6-
compileSdkVersion 25
7-
buildToolsVersion '25.0.2'
6+
compileSdkVersion 27
7+
buildToolsVersion '27.0.0'
88

99
defaultConfig {
1010
minSdkVersion 14
11-
targetSdkVersion 25
11+
targetSdkVersion 27
1212
versionCode 1
1313
versionName "1.0"
1414
}
@@ -25,6 +25,6 @@ android {
2525

2626
dependencies {
2727
compile fileTree(include: ['*.jar'], dir: 'libs')
28-
compile 'com.android.support:support-annotations:25.3.0'
28+
compile 'com.android.support:support-annotations:27.0.0'
2929
}
3030

0 commit comments

Comments
 (0)