├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── drawable │ │ │ └── rounded_corners.xml │ │ ├── values-en │ │ │ └── strings.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ ├── layout_custom_view.xml │ │ │ └── activity_sample.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── fingdo │ │ └── statelayoutdemo │ │ └── SampleActivity.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gif └── stateLayout.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── library ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_state_empty.png │ │ │ ├── ic_state_error.png │ │ │ ├── ic_state_login.png │ │ │ ├── ic_state_loading.png │ │ │ ├── ic_state_time_out.png │ │ │ └── ic_state_no_network.png │ │ ├── drawable-mdpi │ │ │ ├── ic_state_empty.png │ │ │ ├── ic_state_error.png │ │ │ ├── ic_state_login.png │ │ │ ├── ic_state_loading.png │ │ │ ├── ic_state_time_out.png │ │ │ └── ic_state_no_network.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_state_empty.png │ │ │ ├── ic_state_error.png │ │ │ ├── ic_state_login.png │ │ │ ├── ic_state_loading.png │ │ │ ├── ic_state_time_out.png │ │ │ └── ic_state_no_network.png │ │ ├── drawable-xxhdpi │ │ │ ├── ic_state_empty.png │ │ │ ├── ic_state_error.png │ │ │ ├── ic_state_loading.png │ │ │ ├── ic_state_login.png │ │ │ ├── ic_state_time_out.png │ │ │ └── ic_state_no_network.png │ │ ├── drawable-xxxhdpi │ │ │ ├── ic_state_empty.png │ │ │ ├── ic_state_error.png │ │ │ ├── ic_state_login.png │ │ │ ├── ic_state_loading.png │ │ │ ├── ic_state_time_out.png │ │ │ └── ic_state_no_network.png │ │ ├── drawable │ │ │ └── bg_loading.xml │ │ ├── values │ │ │ ├── dimen.xml │ │ │ ├── color.xml │ │ │ ├── strings.xml │ │ │ └── attr.xml │ │ ├── values-en │ │ │ └── strings.xml │ │ └── layout │ │ │ ├── layout_loading.xml │ │ │ ├── layout_empty.xml │ │ │ ├── layout_login.xml │ │ │ ├── layout_error.xml │ │ │ ├── layout_time_out.xml │ │ │ └── layout_no_network.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── fingdo │ │ └── statelayout │ │ ├── holder │ │ ├── BaseHolder.java │ │ ├── ErrorViewHolder.java │ │ ├── LoginViewHolder.java │ │ ├── TimeOutViewHolder.java │ │ ├── NoNetworkViewHolder.java │ │ ├── EmptyViewHolder.java │ │ └── LoadingViewHolder.java │ │ ├── bean │ │ ├── LoadingItem.java │ │ ├── EmptyItem.java │ │ ├── ErrorItem.java │ │ ├── LoginItem.java │ │ ├── TimeOutItem.java │ │ ├── NoNetworkItem.java │ │ └── BaseItem.java │ │ ├── anim │ │ ├── ViewAnimProvider.java │ │ ├── FadeViewAnimProvider.java │ │ └── FadeScaleViewAnimProvider.java │ │ ├── helper │ │ ├── ViewHelper.java │ │ ├── AnimationHelper.java │ │ └── LayoutHelper.java │ │ └── StateLayout.java ├── .gitignore ├── build.gradle └── proguard-rules.pro ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README-zh.md ├── gradlew ├── README.md └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | -------------------------------------------------------------------------------- /gif/stateLayout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/gif/stateLayout.gif -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_empty.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_error.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_login.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_empty.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_error.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_login.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_empty.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_error.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_login.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_loading.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_time_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_time_out.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_loading.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_time_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_time_out.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_loading.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_time_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_time_out.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_empty.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_error.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_loading.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_login.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_empty.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_error.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_login.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-hdpi/ic_state_no_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-hdpi/ic_state_no_network.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-mdpi/ic_state_no_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-mdpi/ic_state_no_network.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xhdpi/ic_state_no_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xhdpi/ic_state_no_network.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_time_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_time_out.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_loading.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_time_out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_time_out.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxhdpi/ic_state_no_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxhdpi/ic_state_no_network.png -------------------------------------------------------------------------------- /library/src/main/res/drawable-xxxhdpi/ic_state_no_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fingdo/stateLayout/HEAD/library/src/main/res/drawable-xxxhdpi/ic_state_no_network.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/src/main/res/drawable/bg_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/src/main/res/values/dimen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8dp 5 | 6 | 22sp 7 | 8 | 13sp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_corners.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #343434 5 | 6 | #6C6C6C 7 | 8 | #C0C0C0 9 | 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | statelayoutdemo 3 | 4 | 我是内容 5 | 我是自定义内容 6 | 7 | 刷新 8 | 登录 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | statelayoutdemo 4 | 5 | 6 | I am content 7 | I am custom view 8 | refresh 9 | sign in 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/BaseHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.widget.TextView; 4 | 5 | /** 6 | *
 7 |  *     author : fingdo
 8 |  *     e-mail : fingdo@qq.com
 9 |  *     time   : 2017/03/13
10 |  *     desc   : 基类ViewHolder
11 |  *     version: 1.0
12 |  * 
13 | */ 14 | 15 | public class BaseHolder { 16 | 17 | public TextView tvTip; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/LoadingItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 加载数据对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class LoadingItem extends BaseItem { 14 | 15 | public LoadingItem(String tip) { 16 | setTip(tip); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/EmptyItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 空数据对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class EmptyItem extends BaseItem { 14 | 15 | public EmptyItem(int resId, String tip) { 16 | setResId(resId); 17 | setTip(tip); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/ErrorItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 错误数据对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class ErrorItem extends BaseItem { 14 | 15 | public ErrorItem(int resId, String tip) { 16 | setResId(resId); 17 | setTip(tip); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/LoginItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 登录对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class LoginItem extends BaseItem { 14 | 15 | public LoginItem(int resId, String tip) { 16 | setResId(resId); 17 | setTip(tip); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 暂无数据 5 | 没有网络 6 | 加载失败 7 | 加载超时 8 | 你还没有登录 9 | 登录 10 | 加载中... 11 | 轻触屏幕重试 12 | 13 | 14 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/TimeOutItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 超时数据对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class TimeOutItem extends BaseItem { 14 | 15 | public TimeOutItem(int resId, String tip) { 16 | setResId(resId); 17 | setTip(tip); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/NoNetworkItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 没有网络数据对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class NoNetworkItem extends BaseItem { 14 | 15 | public NoNetworkItem(int resId, String tip) { 16 | setResId(resId); 17 | setTip(tip); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/anim/ViewAnimProvider.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.anim; 2 | 3 | import android.view.animation.Animation; 4 | 5 | /** 6 | *
 7 |  *     author : fingdo
 8 |  *     e-mail : fingdo@qq.com
 9 |  *     time   : 2017/03/13
10 |  *     desc   : 基类ViewAnimProvider
11 |  *     version: 1.0
12 |  * 
13 | */ 14 | 15 | public interface ViewAnimProvider { 16 | 17 | Animation showAnimation(); 18 | 19 | Animation hideAnimation(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_custom_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /library/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | time out 4 | sign in 5 | no data 6 | load failed 7 | loading 8 | you are not logged in 9 | not network 10 | touch screen retry 11 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/ErrorViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.fingdo.statelayout.R; 8 | 9 | public class ErrorViewHolder extends BaseHolder { 10 | 11 | public ImageView ivImg; 12 | 13 | public ErrorViewHolder(View view) { 14 | tvTip = (TextView) view.findViewById(R.id.tv_message); 15 | ivImg = (ImageView) view.findViewById(R.id.iv_img); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/LoginViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.fingdo.statelayout.R; 8 | 9 | public class LoginViewHolder extends BaseHolder { 10 | 11 | public ImageView ivImg; 12 | 13 | public LoginViewHolder(View view) { 14 | tvTip = (TextView) view.findViewById(R.id.tv_message); 15 | ivImg = (ImageView) view.findViewById(R.id.iv_img); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/TimeOutViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.fingdo.statelayout.R; 8 | 9 | public class TimeOutViewHolder extends BaseHolder { 10 | 11 | public ImageView ivImg; 12 | 13 | public TimeOutViewHolder(View view) { 14 | tvTip = (TextView) view.findViewById(R.id.tv_message); 15 | ivImg = (ImageView) view.findViewById(R.id.iv_img); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/NoNetworkViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.fingdo.statelayout.R; 8 | 9 | public class NoNetworkViewHolder extends BaseHolder { 10 | 11 | public ImageView ivImg; 12 | 13 | public NoNetworkViewHolder(View view) { 14 | tvTip = (TextView) view.findViewById(R.id.tv_message); 15 | ivImg = (ImageView) view.findViewById(R.id.iv_img); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/EmptyViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.fingdo.statelayout.holder.BaseHolder; 8 | import com.fingdo.statelayout.R; 9 | 10 | public class EmptyViewHolder extends BaseHolder { 11 | 12 | public ImageView ivImg; 13 | 14 | public EmptyViewHolder(View view) { 15 | tvTip = (TextView) view.findViewById(R.id.tv_message); 16 | ivImg = (ImageView) view.findViewById(R.id.iv_img); 17 | } 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | .metadata 2 | 3 | *.class 4 | 5 | *.cache 6 | *.dex 7 | *.apk 8 | .DS_Store 9 | 10 | bin 11 | # built application files 12 | *.apk 13 | *.ap_ 14 | 15 | # files for the dex VM 16 | *.dex 17 | 18 | # Java class files 19 | *.class 20 | 21 | # generated files 22 | /bin 23 | /gen 24 | /build 25 | /captures 26 | 27 | # Local configuration file (sdk path, etc) 28 | local.properties 29 | 30 | # Eclipse project files 31 | .classpath 32 | .project 33 | 34 | # Proguard folder generated by Eclipse 35 | /proguard 36 | 37 | # Intellij project files 38 | *.iml 39 | *.ipr 40 | *.iws 41 | /.idea 42 | /.gradle 43 | 44 | Croplib/ -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | buildToolsVersion BUILD_TOOLS_VERSION 5 | compileSdkVersion Integer.parseInt(COMPILE_SDK_VERSION) 6 | 7 | defaultConfig { 8 | minSdkVersion Integer.parseInt(MIN_SDK_VERSION) 9 | targetSdkVersion Integer.parseInt(TARGET_SDK_VERSION) 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | } 19 | 20 | dependencies { 21 | compile fileTree(dir: 'libs', include: ['*.jar']) 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | .idea/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | # Log Files 29 | *.log 30 | 31 | # Android Studio Navigation editor temp files 32 | .navigation/ 33 | 34 | # Android Studio captures folder 35 | captures/ 36 | 37 | # Intellij 38 | *.iml 39 | .idea/workspace.xml 40 | 41 | # Keystore files 42 | *.jks 43 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/holder/LoadingViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.holder; 2 | 3 | import android.view.View; 4 | import android.widget.FrameLayout; 5 | import android.widget.ImageView; 6 | import android.widget.TextView; 7 | 8 | import com.fingdo.statelayout.holder.BaseHolder; 9 | import com.fingdo.statelayout.R; 10 | 11 | public class LoadingViewHolder extends BaseHolder { 12 | 13 | public FrameLayout frameLayout; 14 | 15 | public LoadingViewHolder(View view) { 16 | tvTip = (TextView) view.findViewById(R.id.tv_message); 17 | frameLayout = (FrameLayout) view.findViewById(R.id.loading_layout); 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/bean/BaseItem.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.bean; 2 | 3 | /** 4 | *
 5 |  *     author : fingdo
 6 |  *     e-mail : fingdo@qq.com
 7 |  *     time   : 2017/03/10
 8 |  *     desc   : 基类对象
 9 |  *     version: 1.0
10 |  * 
11 | */ 12 | 13 | public class BaseItem { 14 | 15 | private int resId; 16 | private String tip; 17 | 18 | public int getResId() { 19 | return resId; 20 | } 21 | 22 | public void setResId(int resId) { 23 | this.resId = resId; 24 | } 25 | 26 | public String getTip() { 27 | return tip; 28 | } 29 | 30 | public void setTip(String tip) { 31 | this.tip = tip; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/fingdo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/fingdo/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | buildToolsVersion BUILD_TOOLS_VERSION 5 | compileSdkVersion Integer.parseInt(COMPILE_SDK_VERSION) 6 | 7 | defaultConfig { 8 | applicationId "com.fingdo.statelayoutdemo" 9 | minSdkVersion Integer.parseInt(MIN_SDK_VERSION) 10 | targetSdkVersion Integer.parseInt(TARGET_SDK_VERSION) 11 | versionCode 3 12 | versionName "1.2" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | compile APPCOMPAT_LIB 26 | compile project(':library') 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | MIN_SDK_VERSION=9 19 | BUILD_TOOLS_VERSION=23.0.3 20 | TARGET_SDK_VERSION=23 21 | COMPILE_SDK_VERSION=23 22 | SUPPORT_LIB=com.android.support:support-v4:24.2.1 23 | APPCOMPAT_LIB=com.android.support:appcompat-v7:24.2.1 24 | DESIGN_LIB=com.android.support:design:24.2.1 25 | -------------------------------------------------------------------------------- /library/src/main/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/res/layout/layout_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 13 | 14 | 18 | 19 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /library/src/main/java/com/fingdo/statelayout/anim/FadeViewAnimProvider.java: -------------------------------------------------------------------------------- 1 | package com.fingdo.statelayout.anim; 2 | 3 | import android.view.animation.AccelerateDecelerateInterpolator; 4 | import android.view.animation.AlphaAnimation; 5 | import android.view.animation.Animation; 6 | import android.view.animation.DecelerateInterpolator; 7 | 8 | /** 9 | *
10 |  *     author : fingdo
11 |  *     e-mail : fingdo@qq.com
12 |  *     time   : 2017/03/13
13 |  *     desc   : 渐隐动画
14 |  *     version: 1.0
15 |  * 
16 | */ 17 | 18 | public class FadeViewAnimProvider implements ViewAnimProvider { 19 | 20 | @Override 21 | public Animation showAnimation() { 22 | Animation animation = new AlphaAnimation(0.0f,1.0f); 23 | animation.setDuration(200); 24 | animation.setInterpolator(new DecelerateInterpolator()); 25 | return animation; 26 | } 27 | 28 | @Override 29 | public Animation hideAnimation() { 30 | Animation animation = new AlphaAnimation(1.0f,0.0f); 31 | animation.setDuration(200); 32 | animation.setInterpolator(new AccelerateDecelerateInterpolator()); 33 | return animation; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /library/src/main/res/layout/layout_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 13 | 14 | 19 | 20 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /library/src/main/res/layout/layout_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 13 | 14 | 19 | 20 | 28 | 29 |