├── loadsir ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── kingja │ │ └── loadsir │ │ ├── core │ │ ├── Convertor.java │ │ ├── Transport.java │ │ ├── TargetContext.java │ │ ├── LoadSir.java │ │ ├── LoadService.java │ │ └── LoadLayout.java │ │ ├── callback │ │ ├── SuccessCallback.java │ │ ├── ProgressCallback.java │ │ ├── HintCallback.java │ │ └── Callback.java │ │ └── LoadSirUtil.java ├── build.gradle └── proguard-rules.pro ├── app ├── .gitignore ├── src │ ├── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── img.jpg │ │ │ │ ├── custom.png │ │ │ │ ├── empty.png │ │ │ │ ├── error.png │ │ │ │ ├── music.png │ │ │ │ ├── awkward.png │ │ │ │ └── timeout.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── back.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── layout │ │ │ │ ├── activity_fragment.xml │ │ │ │ ├── layout_loading.xml │ │ │ │ ├── layout_animate.xml │ │ │ │ ├── layout_custom_error.xml │ │ │ │ ├── layout_lottie_empty.xml │ │ │ │ ├── layout_lottie_loading.xml │ │ │ │ ├── activity_fragment_viewpager.xml │ │ │ │ ├── fragment_b_content.xml │ │ │ │ ├── activity_activity_convertor.xml │ │ │ │ ├── fragment_a_content.xml │ │ │ │ ├── activity_content.xml │ │ │ │ ├── layout_timeout.xml │ │ │ │ ├── include_title.xml │ │ │ │ ├── layout_error.xml │ │ │ │ ├── layout_empty.xml │ │ │ │ ├── layout_custom.xml │ │ │ │ ├── activity_view.xml │ │ │ │ ├── title_title_bar.xml │ │ │ │ ├── activity_fragment_mutil.xml │ │ │ │ ├── activity_best_practices.xml │ │ │ │ ├── activity_title.xml │ │ │ │ ├── activity_placeholder.xml │ │ │ │ ├── layout_placeholder.xml │ │ │ │ └── activity_main.xml │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── sample │ │ │ │ └── kingja │ │ │ │ └── loadsir │ │ │ │ ├── callback │ │ │ │ ├── ErrorCallback.java │ │ │ │ ├── EmptyCallback.java │ │ │ │ ├── LottieEmptyCallback.java │ │ │ │ ├── PlaceholderCallback.java │ │ │ │ ├── LottieLoadingCallback.java │ │ │ │ ├── LoadingCallback.java │ │ │ │ ├── TimeoutCallback.java │ │ │ │ ├── CustomCallback.java │ │ │ │ └── AnimateCallback.java │ │ │ │ ├── target │ │ │ │ ├── FragmentSingleActivity.java │ │ │ │ ├── BestPracticesActivity.java │ │ │ │ ├── KeepTitleFragmentActivity.java │ │ │ │ ├── FragmentB.java │ │ │ │ ├── FragmentA.java │ │ │ │ ├── MultiFragmentActivity.java │ │ │ │ ├── PlaceholderActivity.java │ │ │ │ ├── KeepTitleActivity.java │ │ │ │ ├── LottieActivity.java │ │ │ │ ├── NormalFragment.java │ │ │ │ ├── ViewTargetActivity.java │ │ │ │ ├── MultiFragmentWithViewPagerActivity.java │ │ │ │ ├── DefaultCallbackActivity.java │ │ │ │ ├── AnimateActivity.java │ │ │ │ ├── NormalActivity.java │ │ │ │ ├── KeepTitleFragment.java │ │ │ │ └── ConvertorActivity.java │ │ │ │ ├── PostUtil.java │ │ │ │ ├── App.java │ │ │ │ ├── base │ │ │ │ ├── BaseFragment.java │ │ │ │ └── BaseTitleActivity.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── sample │ │ │ └── kingja │ │ │ └── loadsir │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── sample │ │ └── kingja │ │ └── loadsir │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── imgs ├── LoadSir.jpg ├── LoadSir_flow.jpg ├── qcode_1.3.2.png ├── muitl_fragment.gif ├── normal_activity.gif ├── single_fragment.gif ├── view_activity.gif ├── viewpage_fragment.gif └── placeholder_activity.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── docs ├── BestPractice-cn.md ├── NextVersion.md ├── BestPractice.md ├── changelog.md ├── FAQ-cn.md └── FAQ.md ├── .gitignore ├── config.gradle ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README-cn.md └── README.md /loadsir/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | .idea 3 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':loadsir' 2 | -------------------------------------------------------------------------------- /loadsir/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /imgs/LoadSir.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/LoadSir.jpg -------------------------------------------------------------------------------- /imgs/LoadSir_flow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/LoadSir_flow.jpg -------------------------------------------------------------------------------- /imgs/qcode_1.3.2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/qcode_1.3.2.png -------------------------------------------------------------------------------- /imgs/muitl_fragment.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/muitl_fragment.gif -------------------------------------------------------------------------------- /imgs/normal_activity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/normal_activity.gif -------------------------------------------------------------------------------- /imgs/single_fragment.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/single_fragment.gif -------------------------------------------------------------------------------- /imgs/view_activity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/view_activity.gif -------------------------------------------------------------------------------- /imgs/viewpage_fragment.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/viewpage_fragment.gif -------------------------------------------------------------------------------- /imgs/placeholder_activity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/imgs/placeholder_activity.gif -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/img.jpg -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/custom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/custom.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/empty.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/error.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/music.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/awkward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/awkward.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/timeout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/drawable/timeout.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xxhdpi/back.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darryrzhong/LoadSir/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /docs/BestPractice-cn.md: -------------------------------------------------------------------------------- 1 | 最佳实践 2 | --- 3 | 4 | 如果有你关于LoadSir好的使用场景或者封装方式,欢迎发起`pull request`. 5 | 6 | ### #1 xxx 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /.idea 11 | -------------------------------------------------------------------------------- /docs/NextVersion.md: -------------------------------------------------------------------------------- 1 | The Next Version 2 | --- 3 | 4 | The next version will include: 5 | 6 | **1.3.x** 7 | - [ ] Samples how to use LoadSir with other common open-source libs. 8 | - [ ] you tell me 9 | -------------------------------------------------------------------------------- /config.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | compileSdkVersion = 26 3 | buildToolsVersion = "26.0.2" 4 | minSdkVersion = 14 5 | targetSdkVersion = 26 6 | 7 | versionCode = 20180320 8 | versionName = "1.3.6" 9 | supportVersion = '26.0.0-alpha1' 10 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 20 16:48:24 CST 2018 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-4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/BestPractice.md: -------------------------------------------------------------------------------- 1 | Best Practice 2 | --- 3 | 4 | In this documentation I collect good examples how to use LoadSir - and how to use LoadSir with other common open-source libs. 5 | 6 | If you have any wishes or ideas, please make a PR or an issue. 7 | Thank you for your help. 8 | 9 | ### #1 xxx 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /loadsir/src/main/java/com/kingja/loadsir/core/Convertor.java: -------------------------------------------------------------------------------- 1 | package com.kingja.loadsir.core; 2 | 3 | import com.kingja.loadsir.callback.Callback; 4 | 5 | /** 6 | * Description:TODO 7 | * Create Time:2017/9/4 8:58 8 | * Author:KingJA 9 | * Email:kingjavip@gmail.com 10 | */ 11 | public interface Convertor { 12 | Class map(T t); 13 | } 14 | -------------------------------------------------------------------------------- /loadsir/src/main/java/com/kingja/loadsir/core/Transport.java: -------------------------------------------------------------------------------- 1 | package com.kingja.loadsir.core; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | /** 7 | * Description:TODO 8 | * Create Time:2017/9/28 6:45 9 | * Author:KingJA 10 | * Email:kingjavip@gmail.com 11 | */ 12 | public interface Transport { 13 | void order(Context context, View view); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #000000 4 | #787878 5 | #FF4081 6 | 7 | #000000 8 | #ffffff 9 | #bb2c28 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/ErrorCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | 4 | import com.kingja.loadsir.callback.Callback; 5 | 6 | import sample.kingja.loadsir.R; 7 | 8 | /** 9 | * Description:TODO 10 | * Create Time:2017/9/4 10:20 11 | * Author:KingJA 12 | * Email:kingjavip@gmail.com 13 | */ 14 | 15 | public class ErrorCallback extends Callback { 16 | @Override 17 | protected int onCreateView() { 18 | return R.layout.layout_error; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/EmptyCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import com.kingja.loadsir.callback.Callback; 4 | 5 | import sample.kingja.loadsir.R; 6 | 7 | /** 8 | * Description:TODO 9 | * Create Time:2017/9/4 10:22 10 | * Author:KingJA 11 | * Email:kingjavip@gmail.com 12 | */ 13 | 14 | public class EmptyCallback extends Callback { 15 | 16 | @Override 17 | protected int onCreateView() { 18 | return R.layout.layout_empty; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/LottieEmptyCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import com.kingja.loadsir.callback.Callback; 4 | 5 | import sample.kingja.loadsir.R; 6 | 7 | /** 8 | * Description:TODO 9 | * Create Time:2017/9/4 10:22 10 | * Author:KingJA 11 | * Email:kingjavip@gmail.com 12 | */ 13 | 14 | public class LottieEmptyCallback extends Callback { 15 | 16 | @Override 17 | protected int onCreateView() { 18 | return R.layout.layout_lottie_empty; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_animate.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /loadsir/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.compileSdkVersion 5 | buildToolsVersion rootProject.ext.buildToolsVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode rootProject.ext.versionCode 11 | versionName rootProject.ext.versionName 12 | } 13 | buildTypes { 14 | release { 15 | } 16 | } 17 | } 18 | 19 | dependencies { 20 | compile fileTree(include: ['*.jar'], dir: 'libs') 21 | compile "com.android.support:support-annotations:$rootProject.ext.supportVersion" 22 | } -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/PlaceholderCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.kingja.loadsir.callback.Callback; 7 | 8 | import sample.kingja.loadsir.R; 9 | 10 | /** 11 | * Description:TODO 12 | * Create Time:2017/9/4 10:22 13 | * Author:KingJA 14 | * Email:kingjavip@gmail.com 15 | */ 16 | 17 | public class PlaceholderCallback extends Callback { 18 | 19 | @Override 20 | protected int onCreateView() { 21 | return R.layout.layout_placeholder; 22 | } 23 | 24 | @Override 25 | protected boolean onReloadEvent(Context context, View view) { 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/test/java/sample/kingja/loadsir/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir; 2 | 3 | import android.util.Log; 4 | 5 | import org.junit.Test; 6 | 7 | import static org.junit.Assert.*; 8 | 9 | /** 10 | * Example local unit test, which will execute on the development machine (host). 11 | * 12 | * @see Testing documentation 13 | */ 14 | public class ExampleUnitTest { 15 | 16 | @Test 17 | public void addition_isCorrect() throws Exception { 18 | assertEquals(4, 2 + 2); 19 | Object o = new Object(); 20 | System.out.println( "o1: "+o.hashCode()); 21 | o = new Object(); 22 | System.out.println( "o2: "+o.hashCode()); 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/LottieLoadingCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.kingja.loadsir.callback.Callback; 7 | 8 | import sample.kingja.loadsir.R; 9 | 10 | /** 11 | * Description:TODO 12 | * Create Time:2017/9/4 10:22 13 | * Author:KingJA 14 | * Email:kingjavip@gmail.com 15 | */ 16 | 17 | public class LottieLoadingCallback extends Callback { 18 | 19 | @Override 20 | protected int onCreateView() { 21 | return R.layout.layout_lottie_loading; 22 | } 23 | 24 | @Override 25 | protected boolean onReloadEvent(Context context, View view) { 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_custom_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_lottie_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_lottie_loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 14 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/target/FragmentSingleActivity.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.target; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | import sample.kingja.loadsir.R; 7 | 8 | /** 9 | * Description:TODO 10 | * Create Time:2017/9/4 10:56 11 | * Author:KingJA 12 | * Email:kingjavip@gmail.com 13 | */ 14 | 15 | public class FragmentSingleActivity extends AppCompatActivity { 16 | private static final String TAG ="FragmentSingleActivity" ; 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_fragment); 21 | getSupportFragmentManager().beginTransaction().add(R.id.fl_content, new NormalFragment()).commit(); 22 | 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/LoadingCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.kingja.loadsir.callback.Callback; 7 | 8 | import sample.kingja.loadsir.R; 9 | 10 | /** 11 | * Description:TODO 12 | * Create Time:2017/9/4 10:22 13 | * Author:KingJA 14 | * Email:kingjavip@gmail.com 15 | */ 16 | 17 | public class LoadingCallback extends Callback { 18 | 19 | @Override 20 | protected int onCreateView() { 21 | return R.layout.layout_loading; 22 | } 23 | 24 | @Override 25 | public boolean getSuccessVisible() { 26 | return super.getSuccessVisible(); 27 | } 28 | 29 | @Override 30 | protected boolean onReloadEvent(Context context, View view) { 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_b_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/TimeoutCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.widget.Toast; 6 | 7 | import com.kingja.loadsir.callback.Callback; 8 | 9 | import sample.kingja.loadsir.R; 10 | 11 | /** 12 | * Description:TODO 13 | * Create Time:2017/9/2 16:17 14 | * Author:KingJA 15 | * Email:kingjavip@gmail.com 16 | */ 17 | 18 | public class TimeoutCallback extends Callback { 19 | 20 | @Override 21 | protected int onCreateView() { 22 | return R.layout.layout_timeout; 23 | } 24 | 25 | @Override 26 | protected boolean onReloadEvent(Context context, View view) { 27 | Toast.makeText(context.getApplicationContext(),"Connecting to the network again!",Toast.LENGTH_SHORT).show(); 28 | return false; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_activity_convertor.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/androidTest/java/sample/kingja/loadsir/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("sample.kingja.loadsir", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_a_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/target/BestPracticesActivity.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.target; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.view.View; 8 | 9 | import sample.kingja.loadsir.R; 10 | 11 | /** 12 | * Description:TODO 13 | * Create Time:2017/9/29 13:54 14 | * Author:KingJA 15 | * Email:kingjavip@gmail.com 16 | */ 17 | public class BestPracticesActivity extends AppCompatActivity { 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_best_practices); 22 | } 23 | 24 | public void mvpActivity(View view) { 25 | } 26 | 27 | public void onLottie(View view) { 28 | startActivity(new Intent(this, LottieActivity.class)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/target/KeepTitleFragmentActivity.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.target; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.Window; 6 | 7 | import sample.kingja.loadsir.R; 8 | 9 | /** 10 | * Description: 11 | * Create Time:2017/9/4 10:56 12 | * Author:KingJA 13 | * Email:kingjavip@gmail.com 14 | */ 15 | 16 | public class KeepTitleFragmentActivity extends AppCompatActivity { 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | requestWindowFeature(Window.FEATURE_NO_TITLE); 22 | setContentView(R.layout.activity_fragment); 23 | if (getSupportActionBar() != null) { 24 | getSupportActionBar().hide(); 25 | } 26 | getSupportFragmentManager().beginTransaction().add(R.id.fl_content, new KeepTitleFragment()).commit(); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 19 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_timeout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_custom.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 17 | 18 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /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 D:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | -dontwarn com.kingja.loadsir.** 28 | -keep class com.kingja.loadsir.** {*;} 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 19 | 20 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /loadsir/src/main/java/com/kingja/loadsir/core/TargetContext.java: -------------------------------------------------------------------------------- 1 | package com.kingja.loadsir.core; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | 7 | /** 8 | * Description:TODO 9 | * Create Time:2017/9/4 16:28 10 | * Author:KingJA 11 | * Email:kingjavip@gmail.com 12 | */ 13 | public class TargetContext { 14 | private Context context; 15 | private ViewGroup parentView; 16 | private View oldContent; 17 | private int childIndex; 18 | 19 | public TargetContext(Context context, ViewGroup parentView, View oldContent, int childIndex) { 20 | this.context = context; 21 | this.parentView = parentView; 22 | this.oldContent = oldContent; 23 | this.childIndex = childIndex; 24 | } 25 | 26 | public Context getContext() { 27 | return context; 28 | } 29 | 30 | View getOldContent() { 31 | return oldContent; 32 | } 33 | 34 | int getChildIndex() { 35 | return childIndex; 36 | } 37 | 38 | ViewGroup getParentView() { 39 | return parentView; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /loadsir/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 D:\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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | 27 | #-dontwarn com.kingja.loadsir.** 28 | #-keep class com.kingja.loadsir.** {*;} 29 | -------------------------------------------------------------------------------- /loadsir/src/main/java/com/kingja/loadsir/callback/SuccessCallback.java: -------------------------------------------------------------------------------- 1 | package com.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | /** 7 | * Description:TODO 8 | * Create Time:2017/9/4 10:22 9 | * Author:KingJA 10 | * Email:kingjavip@gmail.com 11 | */ 12 | 13 | public class SuccessCallback extends Callback { 14 | public SuccessCallback(View view, Context context, OnReloadListener onReloadListener) { 15 | super(view, context, onReloadListener); 16 | } 17 | 18 | @Override 19 | protected int onCreateView() { 20 | return 0; 21 | } 22 | 23 | /** 24 | * @deprecated Use {@link #showWithCallback(boolean successVisible)} instead. 25 | */ 26 | public void hide() { 27 | obtainRootView().setVisibility(View.INVISIBLE); 28 | } 29 | 30 | public void show() { 31 | obtainRootView().setVisibility(View.VISIBLE); 32 | } 33 | 34 | public void showWithCallback(boolean successVisible) { 35 | obtainRootView().setVisibility(successVisible ? View.VISIBLE : View.INVISIBLE); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/title_title_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 16 | 17 | 23 | 24 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/sample/kingja/loadsir/callback/CustomCallback.java: -------------------------------------------------------------------------------- 1 | package sample.kingja.loadsir.callback; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | import android.widget.Toast; 6 | 7 | import com.kingja.loadsir.callback.Callback; 8 | 9 | import sample.kingja.loadsir.R; 10 | 11 | /** 12 | * Description:TODO 13 | * Create Time:2017/9/3 10:22 14 | * Author:KingJA 15 | * Email:kingjavip@gmail.com 16 | */ 17 | public class CustomCallback extends Callback { 18 | 19 | @Override 20 | protected int onCreateView() { 21 | return R.layout.layout_custom; 22 | } 23 | 24 | @Override 25 | protected boolean onReloadEvent(final Context context, View view) { 26 | Toast.makeText(context.getApplicationContext(), "Hello buddy, how r u! :p", Toast.LENGTH_SHORT).show(); 27 | (view.findViewById(R.id.iv_gift)).setOnClickListener(new View.OnClickListener() { 28 | @Override 29 | public void onClick(View v) { 30 | Toast.makeText(context.getApplicationContext(), "It's your gift! :p", Toast.LENGTH_SHORT).show(); 31 | } 32 | }); 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LoadSir 3 | Activity(empty) 4 | Activity(placeholder) 5 | Activity with Convertor 6 | single Fragment(custom) 7 | multiple Fragment 8 | multiple Fragment+ViewPager 9 | View(timeout) 10 | Animat Callback 11 | keep title bar in Fragment 12 | LoadSir 13 | Success 14 | keep title bar 15 | fine, no data. 16 | click me to retry! 17 | best practices 18 | default LoadSir Callback 19 | keep title bar in Activity 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment_mutil.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 11 |