├── .gitignore ├── LICENSE ├── README.md ├── apk └── loadview-debug.apk ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── gyf │ │ └── sample │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ ├── A.json │ │ ├── AndroidWave.json │ │ ├── B.json │ │ └── Voice.json │ ├── java │ │ └── com │ │ │ └── gyf │ │ │ └── sample │ │ │ ├── BaseActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── MyApp.java │ │ │ └── RecordAdapter.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── shape_point.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── item_load_record.xml │ │ ├── loading_58.xml │ │ ├── loading_lottie.xml │ │ ├── loading_square.xml │ │ └── loading_viscous_circle.xml │ │ ├── menu │ │ └── loading.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── 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-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── gyf │ └── sample │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── loadview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── gyf │ │ └── loadview │ │ ├── LoadManager.java │ │ ├── LoadStatus.java │ │ ├── LoadUtils.java │ │ └── LoadView.java │ └── res │ ├── drawable-xhdpi │ ├── icon_load_emtpy.png │ ├── icon_load_error_net.png │ └── icon_load_fail.png │ └── values │ ├── attrs.xml │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | /.idea 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LoadView 2 | android loadview是一个可以灵活自定义并且可以结合第三方动画解耦的库,使用起来也是超级方便 3 | ## 演示 4 | - 这里除了默认loading动画,还集成了第三方动画库作为演示,比如很火的[lottie-android](https://github.com/airbnb/lottie-android),还有其他比较优秀的动画,比如[LoadingView](https://github.com/ldoublem/LoadingView),详情见demo 5 | 6 | 7 | ## 下载demo 8 | ### [下载](https://github.com/gyf-dev/LoadView/tree/master/apk/loadview-debug.apk) 9 | 10 | ## 使用 11 | > android studio 12 | 13 | ```groovy 14 | implementation 'com.gyf.loadview:loadview:1.0.7' 15 | ``` 16 | ## 用法 17 | ### 简单用法 18 | - 使用一,默认加载Loading是ProgressBar圆形样式,可以通过属性修改颜色,默认是colorAccent颜色,如果想使用其他Loading样式请看使用二 19 | ```xml 20 | 29 | ``` 30 | - 使用二 31 | > 在xml中自定义loading样式 32 | ```xml 33 | 37 | 38 | 39 | 42 | 43 | ``` 44 | > 在java中自定义loading样式 45 | ```java 46 | loadView.setLoadingView(new ProgressBar(this)); 47 | ``` 48 | 或者 49 | 50 | ```java 51 | loadView.setLoadingView(R.layut.你的布局id); 52 | ``` 53 | - 使用三 54 | ```java 55 | LoadView loadView = new LoadView(this); 56 | addView(loadView); 57 | ``` 58 | ### 高级用法 59 | - 使用LoadManager自定义LoadView全局样式(LoadManager还有很多方法,请参考[LoadManager](https://github.com/gyf-dev/LoadView/blob/master/loadview/src/main/java/com/gyf/loadview/LoadManager.java)类,这里就不一一举例了) 60 | ```java 61 | LoadManager.getInstance().setEmpty("空的数据",R.mipmap.empty) //自定义加载为空,展示的样式 62 | .setFail("失败了",R.mipmap.fail); //自定义加载失败,展示的样式 63 | ``` 64 | 65 | - LoadView状态和方法监听 66 | 67 | >设置当前状态 68 | ```java 69 | loadView.setCurrentStatus(LoadStatus.UNDO); //默认值 70 | loadView.setCurrentStatus(LoadStatus.LOADING); //加载中 71 | loadView.setCurrentStatus(LoadStatus.FAIL); //加载失败 72 | loadView.setCurrentStatus(LoadStatus.ERROR_NET); //网络错误 73 | loadView.setCurrentStatus(LoadStatus.EMPTY); //数据为空 74 | loadView.setCurrentStatus(LoadStatus.SUCCESS); //加载成功 75 | ``` 76 | 77 | >设置加载失败监听 78 | ```java 79 | loadView.setOnFailClickListener(new LoadView.OnLoadFailClickListener() { 80 | @Override 81 | public void onLoadFailClick() { 82 | // do something,比如获取数据等 83 | } 84 | }); 85 | ``` 86 | >设置网络错误监听 87 | ```java 88 | loadView.setOnErrorNetClickListener(new LoadView.OnLoadErrorNetClickListener() { 89 | @Override 90 | public void onLoadErrorNetClick() { 91 | // do something,比如设置网络或者获取数据等 92 | } 93 | }); 94 | ``` 95 | >设置数据为空点击事件 96 | ```java 97 | loadView.setOnEmptyClickListener(new LoadView.OnLoadEmptyClickListener() { 98 | @Override 99 | public void onLoadEmptyClick() { 100 | // do something,比如重新获取数据等 101 | } 102 | }); 103 | ``` 104 | 105 | >设置加载中监听 106 | ```java 107 | loadView.setOnLoadingListener(new LoadView.OnLoadingListener() { 108 | @Override 109 | public void onLoadingStart(View loadingView) { 110 | //加载开始时,比如引用第三方动画库,开启动画等操作 111 | } 112 | 113 | @Override 114 | public void onLoadingEnd(View loadingView) { 115 | //加载结束时,比如引用第三方动画库,关闭动画等操作 116 | } 117 | }); 118 | ``` 119 | 120 | - LoadView属性和方法介绍 121 | 122 | | xml属性 | java方法 | 说明 | 123 | | :-------------: |:-------------:| :-------------:| 124 | | load_current_status | setCurrentStatus() | 设置当前loadView的状态 | 125 | | load_image_width | setImageViewSize() | 设置图片的大小 | 126 | | load_image_height | setImageViewSize() | 设置图片的大小 | 127 | | load_loading_width | setLoadingViewSize() | 设置Loading的大小 | 128 | | load_loading_height | setLoadingViewSize() | 设置Loading的大小 | 129 | | load_clickable | isLoadClickable() | 焦点是否在LoadView中 | 130 | | load_loading_clickable | isLoadingClickable() | 设置加载中,焦点是否在LoadView中 | 131 | | load_fail_clickable | isFailClickable() | 设置加载失败,焦点是否在LoadView中 | 132 | | load_error_net_clickable | isErrorNetClickable() | 设置加载网络错误,焦点是否在LoadView中 | 133 | | load_empty_clickable | isEmptyClickable() | 设置加载数据为空,焦点是否在LoadView中 | 134 | | load_gravity | setGravity() | 设置布局的位置 | 135 | | load_loading_gravity | setLoadingGravity() | 设置Loading布局的位置 | 136 | | load_image_text_gravity | setImageTextGravity() | 设置图片和文字布局的位置 | 137 | | load_margin | setMargins() | 设置布局的左右上下边界值,单位px | 138 | | load_margin_left | 无 | 设置布局的左边界值,单位px | 139 | | load_margin_top | 无 | 设置布局的顶部边界值,单位px | 140 | | load_margin_right | 无 | 设置布局的右边界值,单位px | 141 | | load_margin_bottom | 无 | 设置布局的底部边界值,单位px | 142 | | load_loading_margin | setLoadingMargins() | 设置Loading布局的左右上下边界值,单位px | 143 | | load_loading_margin_left | 无 | 设置Loading的左边界值,单位px | 144 | | load_loading_margin_top | 无 | 设置Loading的顶部边界值,单位px | 145 | | load_loading_margin_right | 无 | 设置Loading的右边界值,单位px | 146 | | load_loading_margin_bottom | 无 | 设置Loading的底部边界值,单位px | 147 | | load_image_text_margin | setImageTextMargins() | 设置ImageText布局的左右上下边界值,单位px | 148 | | load_image_text_margin_left | 无 | 设置ImageText的左边界值,单位px | 149 | | load_image_text_margin_top | 无 | 设置ImageText的顶部边界值,单位px | 150 | | load_image_text_margin_right | 无 | 设置ImageText的右边界值,单位px | 151 | | load_image_text_margin_bottom | 无 | 设置ImageText的底部边界值,单位px | 152 | | load_image_margin | setImageMargins() | 设置Image布局的左右上下边界值,单位px | 153 | | load_image_margin_left | 无 | 设置Image的左边界值,单位px | 154 | | load_image_margin_top | 无 | 设置Image的顶部边界值,单位px | 155 | | load_image_margin_right | 无 | 设置Image的右边界值,单位px | 156 | | load_image_margin_bottom | 无 | 设置Image的底部边界值,单位px | 157 | | load_text_margin | setTextMargins() | 设置Text布局的左右上下边界值,单位px | 158 | | load_text_margin_left | 无 | 设置Text的左边界值,单位px | 159 | | load_text_margin_top | 无 | 设置Text的顶部边界值,单位px | 160 | | load_text_margin_right | 无 | 设置Text的右边界值,单位px | 161 | | load_text_margin_bottom | 无 | 设置Text的底部边界值,单位px | 162 | | load_text_fail | setFailText() | 设置加载失败文字 | 163 | | load_text_error_net | setErrorNetText() | 设置加载网络错误文字 | 164 | | load_text_empty | setEmptyText() | 设置加载为空文字 | 165 | | load_image_fail | setFailRes() | 设置失败的图片资源 | 166 | | load_image_error_net | setErrorNetRes() | 设置网络错误的图片资源 | 167 | | load_image_empty | setEmptyRes() | 设置无数据的图片资源 | 168 | | load_text_color | setTextColor() | 设置文字的颜色 | 169 | | load_text_color_fail | setFailTextColor() | 设置失败展示的字体颜色 | 170 | | load_text_color_error_net | setErrorNetTextColor() | 设置网络加载错误展示的字体颜色 | 171 | | load_text_color_empty | setEmptyTextColor() | 设置数据为空展示的字体颜色 | 172 | | load_text_size | setTextSize() | 设置字体大小,单位sp | 173 | | load_image_color | setImageColor() |设置图片的颜色 | 174 | | load_image_color_fail | setFailImageColor() | 设置失败图片的颜色 | 175 | | load_image_color_error_net | setErrorNetImageColor() | 设置网络错误图片的颜色 | 176 | | load_image_color_empty | setEmptyImageColor() | 设置数据为空图片的颜色 | 177 | | load_image_color_enabled | setImageColorEnabled() |设置是否可以修改图片的颜色 | 178 | | load_image_color_fail_enabled | setFailImageColorEnabled() | 设置是否可以修改失败图片的颜色 | 179 | | load_image_color_error_net_enabled | setErrorNetImageColorEnabled() | 设置是否可以修改网络错误图片的颜色 | 180 | | load_image_color_empty_enabled | setEmptyImageColorEnabled() | 设置是否可以修改数据为空图片的颜色 | 181 | | load_default_loading_color | setDefaultLoadingColor() | 设置默认的loading的颜色 | 182 | 183 | 184 | ## 混淆 185 | 无 186 | 187 | -------------------------------------------------------------------------------- /apk/loadview-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/apk/loadview-debug.apk -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.gyf.loadview" 7 | minSdkVersion 19 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(include: ['*.jar'], dir: 'libs') 23 | testImplementation 'junit:junit:4.12' 24 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 25 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 26 | 27 | implementation 'com.android.support:appcompat-v7:28.0.0' 28 | implementation 'com.android.support:design:28.0.0' 29 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 30 | 31 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1' 32 | releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1' 33 | testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1' 34 | 35 | implementation project(':loadview') 36 | 37 | // https://github.com/ldoublem/LoadingView 38 | implementation 'com.ldoublem.loadingview:loadingviewlib:1.0' 39 | 40 | // https://github.com/Rogero0o/CatLoadingView 41 | implementation 'com.roger.catloadinglibrary:catloadinglibrary:1.0.4' 42 | 43 | // 44 | implementation 'me.wangyuwei:LoadingiVew:1.0.5' 45 | 46 | // https://github.com/Ajian-studio/GABottleLoading 47 | implementation 'com.github.Ajian-studio:GABottleLoading:1.0.1' 48 | 49 | // https://github.com/JeasonWong/SlackLoadingView 50 | implementation 'me.wangyuwei:SlackLoadingView:1.0.1' 51 | 52 | // https://github.com/yuweiguocn/SquareLoading 53 | implementation 'io.github.yuweiguocn:SquareLoading:1.3.0' 54 | 55 | // https://github.com/Carson-Ho/Kawaii_LoadingView 56 | implementation 'com.carson_ho:Kawaii_LoadingView:1.0.0' 57 | 58 | // https://github.com/zzz40500/android-shapeLoadingView 59 | implementation 'com.github.zzz40500:android-shapeLoadingView:1.0.3.2' 60 | 61 | implementation 'com.airbnb.android:lottie:2.6.0-beta19' 62 | 63 | } 64 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/gyf/sample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 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 | * Instrumented 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.gyf.loadview", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/assets/A.json: -------------------------------------------------------------------------------- 1 | {"assets":[],"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"smile","parent":10,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[0,-90,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":0.714,"y":0.995},"o":{"x":0.323,"y":0},"n":"0p714_0p995_0p323_0","t":1,"s":[{"i":[[0,0],[-10.378,0],[0,0]],"o":[[0,0],[10.378,0],[0,0]],"v":[[-17.75,13.562],[-0.466,7.938],[16,12.394]],"c":false}],"e":[{"i":[[0,0],[-19.708,0],[0,0]],"o":[[0,0],[19.708,0],[0,0]],"v":[[-30.557,-0.854],[-0.099,5.41],[30.186,-1.101]],"c":false}]},{"i":{"x":0.52,"y":0.944},"o":{"x":0.122,"y":0.002},"n":"0p52_0p944_0p122_0p002","t":5.5,"s":[{"i":[[0,0],[-19.708,0],[0,0]],"o":[[0,0],[19.708,0],[0,0]],"v":[[-30.557,-0.854],[-0.099,5.41],[30.186,-1.101]],"c":false}],"e":[{"i":[[0,0],[-22.217,0],[0,0]],"o":[[0,0],[22.217,0],[0,0]],"v":[[-34,-4.73],[0,4.73],[34,-4.73]],"c":false}]},{"t":19}]},"nm":"Path 1"},{"ty":"st","fillEnabled":true,"c":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":11.8,"s":[0,0.32,0.5,1],"e":[0,0.32,0.5,1]},{"t":25}]},"o":{"k":100},"w":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":6.4,"s":[2],"e":[8]},{"t":13.599609375}]},"lc":2,"lj":1,"ml":4,"nm":"Stroke 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":1,"op":20,"st":-2,"bm":0,"sr":1},{"ddd":0,"ind":1,"ty":4,"nm":"cap","parent":10,"ks":{"o":{"k":100},"r":{"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":8,"s":[0],"e":[-4]},{"t":18.099609375}]},"p":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":8,"s":[0,-160.338,0],"e":[0,-168.938,0],"to":[0,-1.43333327770233,0],"ti":[0,1.43333327770233,0]},{"t":18.099609375}]},"a":{"k":[0,-156.338,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[15.594,6.969],[9.216,-10.513],[-22.981,-10.513],[-30.517,10.492],[-2.884,10.504],[-2.884,10.513],[45.258,11.023],[45.258,7.479]],"c":true}},"nm":"Path 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[6.024,-156.338],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":2,"ty":4,"nm":"glasses","parent":10,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":8.2,"s":[0,-106,0],"e":[0,-126,0],"to":[0,-3.33333325386047,0],"ti":[0,3.33333325386047,0]},{"t":15.400390625}]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"s","pt":{"k":{"i":[[6.099,0],[0.456,5.986],[0,0.299],[-0.022,0.293],[-6.101,0],[-0.456,-5.985],[0,-0.299],[0.022,-0.293]],"o":[[-6.101,0],[-0.022,-0.293],[0,-0.299],[0.456,-5.985],[6.099,0],[0.022,0.293],[0,0.299],[-0.456,5.986]],"v":[[-14.967,11.605],[-26.528,0.885],[-26.573,-0.001],[-26.528,-0.887],[-14.967,-11.605],[-3.408,-0.887],[-3.363,-0.001],[-3.408,0.885]],"c":true}},"o":{"k":100},"x":{"k":0},"nm":"Mask 1"},{"inv":false,"mode":"s","pt":{"k":{"i":[[6.101,0],[0.455,5.986],[0,0.299],[-0.022,0.293],[-6.099,0],[-0.456,-5.985],[0,-0.299],[0.022,-0.293]],"o":[[-6.099,0],[-0.022,-0.293],[0,-0.299],[0.456,-5.985],[6.101,0],[0.022,0.293],[0,0.299],[-0.456,5.986]],"v":[[14.186,11.73],[2.627,1.01],[2.582,0.124],[2.627,-0.762],[14.186,-11.48],[25.747,-0.762],[25.792,0.124],[25.747,1.01]],"c":true}},"o":{"k":100},"x":{"k":0},"nm":"Mask 2"}],"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":{"i":[[0,0],[7.077,0],[0.459,-6.963],[0,0],[7.077,0],[0.46,-6.963],[0,0],[0,0],[0,0],[-7.077,0],[-0.46,6.963],[0,0],[-7.077,0],[-0.46,6.963],[0,0],[0,0]],"o":[[-0.46,-6.963],[-7.077,0],[0,0],[-0.46,-6.963],[-7.077,0],[0,0],[0,0],[0,0],[0.46,6.963],[7.077,0],[0,0],[0.459,6.963],[7.077,0],[0,0],[0,0],[0,0]],"v":[[27.473,-0.887],[14.14,-13.377],[0.808,-0.887],[-1.651,-0.887],[-14.982,-13.377],[-28.315,-0.887],[-41.647,-0.887],[-41.647,0.885],[-28.315,0.885],[-14.982,13.377],[-1.651,0.885],[0.808,0.885],[14.14,13.377],[27.473,0.885],[41.647,0.885],[41.647,-0.887]],"c":true}},"nm":"Path 1"},{"ty":"st","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"w":{"k":6},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":3,"ty":1,"nm":"mask darkblue 2","parent":17,"td":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,100,0]},"a":{"k":[250,300,0]},"s":{"k":[100,100,100]}},"ao":0,"ef":[{"ty":21,"nm":"Fill","mn":"ADBE Fill","ix":1,"ef":[{"ty":3,"nm":"Fill Mask","mn":"ADBE Fill-0001","ix":1,"v":{"k":0}},{"ty":7,"nm":"All Masks","mn":"ADBE Fill-0007","ix":2,"v":{"k":0}},{"ty":2,"nm":"Color","mn":"ADBE Fill-0002","ix":3,"v":{"k":[0,0,0.01,1]}},{"ty":7,"nm":"Invert","mn":"ADBE Fill-0006","ix":4,"v":{"k":0}},{"ty":0,"nm":"Horizontal Feather","mn":"ADBE Fill-0003","ix":5,"v":{"k":0}},{"ty":0,"nm":"Vertical Feather","mn":"ADBE Fill-0004","ix":6,"v":{"k":0}},{"ty":0,"nm":"Opacity","mn":"ADBE Fill-0005","ix":7,"v":{"k":1}}]}],"sw":500,"sh":600,"sc":"#000000","ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":4,"ty":4,"nm":"darkblue 2","parent":10,"tt":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[0,64.663,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.32,0.5,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":4,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":5,"ty":1,"nm":"mask darkblue","parent":17,"td":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,100,0]},"a":{"k":[250,300,0]},"s":{"k":[100,100,100]}},"ao":0,"ef":[{"ty":21,"nm":"Fill","mn":"ADBE Fill","ix":1,"ef":[{"ty":3,"nm":"Fill Mask","mn":"ADBE Fill-0001","ix":1,"v":{"k":0}},{"ty":7,"nm":"All Masks","mn":"ADBE Fill-0007","ix":2,"v":{"k":0}},{"ty":2,"nm":"Color","mn":"ADBE Fill-0002","ix":3,"v":{"k":[0,0,0.01,1]}},{"ty":7,"nm":"Invert","mn":"ADBE Fill-0006","ix":4,"v":{"k":0}},{"ty":0,"nm":"Horizontal Feather","mn":"ADBE Fill-0003","ix":5,"v":{"k":0}},{"ty":0,"nm":"Vertical Feather","mn":"ADBE Fill-0004","ix":6,"v":{"k":0}},{"ty":0,"nm":"Opacity","mn":"ADBE Fill-0005","ix":7,"v":{"k":1}}]}],"sw":500,"sh":600,"sc":"#000000","ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":6,"ty":4,"nm":"darkblue","parent":10,"tt":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[0,64.663,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":0.615,"y":1},"o":{"x":0.112,"y":1},"n":"0p615_1_0p112_1","t":4.257,"s":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[116.264,38.687],[-127.514,72.687],[-136.922,102.313],[-103.324,102.313],[-84.081,102.313],[42.391,102.313],[90.931,102.313],[136.922,102.313]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[62.264,-102.313],[-63.514,-102.313],[-136.922,102.313],[-103.324,102.313],[-84.081,102.313],[42.391,102.313],[90.931,102.313],[136.922,102.313]],"c":true}]},{"t":18.099609375}]},"nm":"Path 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":4,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":7,"ty":1,"nm":"mask lightblue","parent":17,"td":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,100,0]},"a":{"k":[250,300,0]},"s":{"k":[100,100,100]}},"ao":0,"ef":[{"ty":21,"nm":"Fill","mn":"ADBE Fill","ix":1,"ef":[{"ty":3,"nm":"Fill Mask","mn":"ADBE Fill-0001","ix":1,"v":{"k":0}},{"ty":7,"nm":"All Masks","mn":"ADBE Fill-0007","ix":2,"v":{"k":0}},{"ty":2,"nm":"Color","mn":"ADBE Fill-0002","ix":3,"v":{"k":[0,0,0.01,1]}},{"ty":7,"nm":"Invert","mn":"ADBE Fill-0006","ix":4,"v":{"k":0}},{"ty":0,"nm":"Horizontal Feather","mn":"ADBE Fill-0003","ix":5,"v":{"k":0}},{"ty":0,"nm":"Vertical Feather","mn":"ADBE Fill-0004","ix":6,"v":{"k":0}},{"ty":0,"nm":"Opacity","mn":"ADBE Fill-0005","ix":7,"v":{"k":1}}]}],"sw":500,"sh":600,"sc":"#000000","ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":8,"ty":4,"nm":"lightblue","parent":10,"tt":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[0,55.875,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":0.686,"y":1},"o":{"x":0.108,"y":1},"n":"0p686_1_0p108_1","t":1,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[104.851,19.399],[-112.209,39.899],[-136.922,111.101],[136.922,111.101]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[55.851,-111.101],[-57.209,-111.101],[-136.922,111.101],[136.922,111.101]],"c":true}]},{"t":5}]},"nm":"Path 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0.15,0.8,0.55,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":1,"op":20,"st":-3,"bm":0,"sr":1},{"ddd":0,"ind":9,"ty":1,"nm":"mask skin","parent":17,"td":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,100,0]},"a":{"k":[250,300,0]},"s":{"k":[100,100,100]}},"ao":0,"ef":[{"ty":21,"nm":"Fill","mn":"ADBE Fill","ix":1,"ef":[{"ty":3,"nm":"Fill Mask","mn":"ADBE Fill-0001","ix":1,"v":{"k":0}},{"ty":7,"nm":"All Masks","mn":"ADBE Fill-0007","ix":2,"v":{"k":0}},{"ty":2,"nm":"Color","mn":"ADBE Fill-0002","ix":3,"v":{"k":[0,0,0.01,1]}},{"ty":7,"nm":"Invert","mn":"ADBE Fill-0006","ix":4,"v":{"k":0}},{"ty":0,"nm":"Horizontal Feather","mn":"ADBE Fill-0003","ix":5,"v":{"k":0}},{"ty":0,"nm":"Vertical Feather","mn":"ADBE Fill-0004","ix":6,"v":{"k":0}},{"ty":0,"nm":"Opacity","mn":"ADBE Fill-0005","ix":7,"v":{"k":1}}]}],"sw":500,"sh":600,"sc":"#000000","ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":10,"ty":4,"nm":"skin","parent":17,"tt":1,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[{"i":{"x":0,"y":1},"o":{"x":0,"y":0},"n":"0_1_0_0","t":1,"s":[250,469,0],"e":[250,177.524,0],"to":[0,-122.367813110352,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":15.4,"s":[250,177.524,0],"e":[250,234.269,0],"to":[0,0,0],"ti":[0,-22.1301918029785,0]},{"t":19}]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[15.078,-166.976],[-17.119,-166.976],[-136.922,166.976],[136.922,166.976]],"c":true}},"nm":"Path 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0.86,0.86,0.86,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":1,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":11,"ty":4,"nm":"left arm ","parent":10,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[-93,-85.163,0]},"a":{"k":[0,0,0]},"s":{"k":[-100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":1,"y":1},"o":{"x":0.167,"y":0.167},"n":"1_1_0p167_0p167","t":4,"s":[{"i":[[0,0],[0,0]],"o":[[11.299,13.7],[0,0]],"v":[[-36.299,42.462],[-43.468,67.538]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[19.926,-2.45],[0,0]],"v":[[-36.299,42.462],[-2.82,20.313]],"c":false}]},{"i":{"x":0.833,"y":0.815},"o":{"x":0.18,"y":1},"n":"0p833_0p815_0p18_1","t":5,"s":[{"i":[[0,0],[0,0]],"o":[[19.926,-2.45],[0,0]],"v":[[-36.299,42.462],[-2.82,20.313]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[68.529,-28.784],[0,0]],"v":[[-36.299,42.462],[53.207,-43.838]],"c":false}]},{"i":{"x":0.547,"y":0},"o":{"x":0.167,"y":0.185},"n":"0p547_0_0p167_0p185","t":6.4,"s":[{"i":[[0,0],[0,0]],"o":[[68.529,-28.784],[0,0]],"v":[[-36.299,42.462],[53.207,-43.838]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[55.222,-34.123],[0,0]],"v":[[-36.299,42.462],[9.015,-58.738]],"c":false}]},{"i":{"x":0.8,"y":0.778},"o":{"x":0.453,"y":1},"n":"0p8_0p778_0p453_1","t":8.2,"s":[{"i":[[0,0],[0,0]],"o":[[55.222,-34.123],[0,0]],"v":[[-36.299,42.462],[9.015,-58.738]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[85.988,-8.836],[0,0]],"v":[[-36.299,42.462],[58.474,-42.979]],"c":false}]},{"i":{"x":0.8,"y":0.778},"o":{"x":0.519,"y":0},"n":"0p8_0p778_0p519_0","t":10,"s":[{"i":[[0,0],[0,0]],"o":[[85.988,-8.836],[0,0]],"v":[[-36.299,42.462],[58.474,-42.979]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[71.296,-41.974],[0,0]],"v":[[-36.299,42.462],[15.755,-73.378]],"c":false}]},{"i":{"x":0.547,"y":0},"o":{"x":0.514,"y":0},"n":"0p547_0_0p514_0","t":11.8,"s":[{"i":[[0,0],[0,0]],"o":[[71.296,-41.974],[0,0]],"v":[[-36.299,42.462],[15.755,-73.378]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[72.379,-50.965],[0,0]],"v":[[-36.299,42.462],[86.466,25.36]],"c":false}]},{"i":{"x":0.443,"y":0.381},"o":{"x":0.167,"y":0.368},"n":"0p443_0p381_0p167_0p368","t":17.2,"s":[{"i":[[0,0],[0,0]],"o":[[72.379,-50.965],[0,0]],"v":[[-36.299,42.462],[86.466,25.36]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[56.859,4.894],[0,0]],"v":[[-36.299,42.462],[11.877,128.595]],"c":false}]},{"t":19}]},"nm":"Path 1"},{"ty":"st","fillEnabled":true,"c":{"k":[0.15,0.8,0.55,1]},"o":{"k":100},"w":{"k":20},"lc":2,"lj":1,"ml":4,"nm":"Stroke 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":-0.533,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":4,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":12,"ty":4,"nm":"right arm","parent":10,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[92,-85.163,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":1,"y":1},"o":{"x":0.167,"y":0.167},"n":"1_1_0p167_0p167","t":4,"s":[{"i":[[0,0],[0,0]],"o":[[11.299,13.7],[0,0]],"v":[[-36.299,42.462],[-43.468,67.538]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[19.926,-2.45],[0,0]],"v":[[-36.299,42.462],[-2.82,20.313]],"c":false}]},{"i":{"x":0.833,"y":0.815},"o":{"x":0.18,"y":1},"n":"0p833_0p815_0p18_1","t":5,"s":[{"i":[[0,0],[0,0]],"o":[[19.926,-2.45],[0,0]],"v":[[-36.299,42.462],[-2.82,20.313]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[68.529,-28.784],[0,0]],"v":[[-36.299,42.462],[53.207,-43.838]],"c":false}]},{"i":{"x":0.547,"y":0},"o":{"x":0.167,"y":0.185},"n":"0p547_0_0p167_0p185","t":6.4,"s":[{"i":[[0,0],[0,0]],"o":[[68.529,-28.784],[0,0]],"v":[[-36.299,42.462],[53.207,-43.838]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[55.222,-34.123],[0,0]],"v":[[-36.299,42.462],[9.015,-58.738]],"c":false}]},{"i":{"x":0.8,"y":0.778},"o":{"x":0.453,"y":1},"n":"0p8_0p778_0p453_1","t":8.2,"s":[{"i":[[0,0],[0,0]],"o":[[55.222,-34.123],[0,0]],"v":[[-36.299,42.462],[9.015,-58.738]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[85.988,-8.836],[0,0]],"v":[[-36.299,42.462],[58.474,-42.979]],"c":false}]},{"i":{"x":0.8,"y":0.778},"o":{"x":0.519,"y":0},"n":"0p8_0p778_0p519_0","t":10,"s":[{"i":[[0,0],[0,0]],"o":[[85.988,-8.836],[0,0]],"v":[[-36.299,42.462],[58.474,-42.979]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[71.296,-41.974],[0,0]],"v":[[-36.299,42.462],[15.755,-73.378]],"c":false}]},{"i":{"x":0.547,"y":0},"o":{"x":0.514,"y":0},"n":"0p547_0_0p514_0","t":11.8,"s":[{"i":[[0,0],[0,0]],"o":[[71.296,-41.974],[0,0]],"v":[[-36.299,42.462],[15.755,-73.378]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[72.379,-50.965],[0,0]],"v":[[-36.299,42.462],[86.466,25.36]],"c":false}]},{"i":{"x":0.443,"y":0.381},"o":{"x":0.167,"y":0.368},"n":"0p443_0p381_0p167_0p368","t":17.2,"s":[{"i":[[0,0],[0,0]],"o":[[72.379,-50.965],[0,0]],"v":[[-36.299,42.462],[86.466,25.36]],"c":false}],"e":[{"i":[[0,0],[0,0]],"o":[[56.859,4.894],[0,0]],"v":[[-36.299,42.462],[11.877,128.595]],"c":false}]},{"t":19}]},"nm":"Path 1"},{"ty":"st","fillEnabled":true,"c":{"k":[0.15,0.8,0.55,1]},"o":{"k":100},"w":{"k":20},"lc":2,"lj":1,"ml":4,"nm":"Stroke 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":-0.533,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1"}],"ip":4,"op":20,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":13,"ty":4,"nm":"shadow","parent":17,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,246,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"k":[{"i":{"x":[0.416,0.416],"y":[1,1]},"o":{"x":[0.187,0.187],"y":[0.17,0.924]},"n":["0p416_1_0p187_0p17","0p416_1_0p187_0p924"],"t":5.5,"s":[14.338,2.637],"e":[72.797,13.391]},{"i":{"x":[0.833,0.833],"y":[0.833,0.833]},"o":{"x":[0.767,0.767],"y":[0,0]},"n":["0p833_0p833_0p767_0","0p833_0p833_0p767_0"],"t":12.7,"s":[72.797,13.391],"e":[19.869,3.655]},{"t":18.099609375}]},"p":{"k":[0,0]},"nm":"Ellipse Path 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.32,0.5,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[1.398,152.633],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[199.741,199.741],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1"}],"ip":6,"op":20,"st":7,"bm":0,"sr":1},{"ddd":0,"ind":14,"ty":4,"nm":"A Outlines 3","parent":17,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,400,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":-22,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[66.258,-44],[66.184,-83.343],[-70.187,-84.093],[-70.306,-44]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[66.258,-44],[21.299,-186.393],[-24.073,-187.042],[-70.306,-44]],"c":true}]},{"i":{"x":1,"y":1},"o":{"x":0.167,"y":0.167},"n":"1_1_0p167_0p167","t":20,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[66.258,-44],[21.299,-186.393],[-24.073,-187.042],[-70.306,-44]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[77.021,-18.988],[76.929,-58.331],[-80.995,-59.105],[-81.125,-19.012]],"c":true}]},{"i":{"x":0.8,"y":0.674},"o":{"x":0.123,"y":1},"n":"0p8_0p674_0p123_1","t":22,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[77.021,-18.988],[76.929,-58.331],[-80.995,-59.105],[-81.125,-19.012]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[66.258,-44],[66.184,-83.343],[-70.187,-84.093],[-70.306,-44]],"c":true}]},{"t":25}]},"nm":" "},{"ty":"mm","mm":1,"nm":"Merge Paths 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":-0.064,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"A"}],"ip":20,"op":26,"st":-22,"bm":0,"sr":1},{"ddd":0,"ind":15,"ty":4,"nm":"A Outlines 2","parent":17,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,400,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":1,"y":1},"o":{"x":0.167,"y":0.167},"n":"1_1_0p167_0p167","t":20,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[17.441,-226.593],[-25.687,-226.593],[-108.831,-0.095],[-57.067,-0.095]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[15.427,-204.577],[-27.702,-204.577],[-134.011,-0.189],[-82.246,-0.189]],"c":true}]},{"i":{"x":0.8,"y":0.674},"o":{"x":0.123,"y":1},"n":"0p8_0p674_0p123_1","t":22,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[15.427,-204.577],[-27.702,-204.577],[-134.011,-0.189],[-82.246,-0.189]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[17.441,-226.593],[-25.687,-226.593],[-108.831,-0.095],[-57.067,-0.095]],"c":true}]},{"t":25}]},"nm":"A"},{"ty":"mm","mm":1,"nm":"Merge Paths 1"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0,0],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[99.286,99.925],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"A"}],"ip":20,"op":26,"st":-13,"bm":0,"sr":1},{"ddd":0,"ind":16,"ty":4,"nm":"A Outlines 1","parent":17,"ks":{"o":{"k":100},"r":{"k":0},"p":{"k":[250,400,0]},"a":{"k":[0,0,0]},"s":{"k":[100,100,100]}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ks":{"k":[{"i":{"x":1,"y":1},"o":{"x":0.167,"y":0.167},"n":"1_1_0p167_0p167","t":20,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[57.6,0.453],[108.805,0.453],[26.544,-226.327],[-15.984,-226.327]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[74.6,0.906],[125.805,0.906],[26.559,-203.327],[-15.969,-203.327]],"c":true}]},{"i":{"x":0.8,"y":0.674},"o":{"x":0.123,"y":1},"n":"0p8_0p674_0p123_1","t":22,"s":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[74.6,0.906],[125.805,0.906],[26.559,-203.327],[-15.969,-203.327]],"c":true}],"e":[{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[57.6,0.453],[108.805,0.453],[26.544,-226.327],[-15.984,-226.327]],"c":true}]},{"t":25}]},"nm":"A"},{"ty":"fl","fillEnabled":true,"c":{"k":[0,0.01,0.24,1]},"o":{"k":100},"nm":"Fill 1"},{"ty":"tr","p":{"k":[0.441,-0.604],"ix":2},"a":{"k":[0,0],"ix":1},"s":{"k":[100,100],"ix":3},"r":{"k":0,"ix":6},"o":{"k":100,"ix":7},"sk":{"k":0,"ix":4},"sa":{"k":0,"ix":5},"nm":"Transform"}],"nm":"A"}],"ip":20,"op":26,"st":-8,"bm":0,"sr":1},{"ddd":0,"ind":17,"ty":1,"nm":"ResizerTemp","parent":18,"ks":{"o":{"k":0},"r":{"k":0},"p":{"k":[70,102,0]},"a":{"k":[250,300,0]},"s":{"k":[30,30,100]}},"ao":0,"sw":500,"sh":600,"sc":"#ffffff","ip":0,"op":26,"st":0,"bm":0,"sr":1},{"ddd":0,"ind":18,"ty":1,"nm":"White Solid 7","ks":{"o":{"k":0},"r":{"k":0},"p":{"k":[40,50,0]},"a":{"k":[70,100,0]},"s":{"k":[57.143,50,100]}},"ao":0,"sw":140,"sh":200,"sc":"#ffffff","ip":0,"op":26,"st":0,"bm":0,"sr":1}],"v":"4.4.26","ddd":0,"ip":0,"op":26,"fr":25,"w":80,"h":100} -------------------------------------------------------------------------------- /app/src/main/assets/AndroidWave.json: -------------------------------------------------------------------------------- 1 | {"v":"4.10.1","fr":60,"ip":0,"op":123,"w":400,"h":400,"nm":"AndroidWave","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"LeftArm","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0]},"n":["0_1_0p167_0"],"t":0,"s":[0],"e":[0]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p667_1_0p333_0"],"t":5,"s":[0],"e":[-176.582]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p45_1_0p333_0"],"t":19,"s":[-176.582],"e":[-134.443]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.55],"y":[0]},"n":["0p667_1_0p55_0"],"t":26,"s":[-134.443],"e":[-176.582]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p45_1_0p333_0"],"t":36,"s":[-176.582],"e":[-144.443]},{"i":{"x":[0.667],"y":[1]},"o":{"x":[0.55],"y":[0]},"n":["0p667_1_0p55_0"],"t":46,"s":[-144.443],"e":[-176.582]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0p45_1_0p333_0"],"t":56,"s":[-176.582],"e":[-144.443]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.55],"y":[0]},"n":["0p45_1_0p55_0"],"t":66,"s":[-144.443],"e":[-158]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.167],"y":[0]},"n":["0p45_1_0p167_0"],"t":77,"s":[-158],"e":[8]},{"i":{"x":[0.45],"y":[1]},"o":{"x":[0.167],"y":[0]},"n":["0p45_1_0p167_0"],"t":85,"s":[8],"e":[-2.9]},{"i":{"x":[0.833],"y":[1]},"o":{"x":[0.167],"y":[0]},"n":["0p833_1_0p167_0"],"t":97,"s":[-2.9],"e":[0]},{"t":107}],"ix":10},"p":{"a":1,"k":[{"i":{"x":0,"y":1},"o":{"x":0.333,"y":0},"n":"0_1_0p333_0","t":0,"s":[262.81,158.827,0],"e":[262.808,157.329,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0.433},"n":"0p667_1_0p333_0p433","t":5,"s":[262.808,157.329,0],"e":[263.017,165.823,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":11,"s":[263.017,165.823,0],"e":[262.81,158.827,0],"to":[0,0,0],"ti":[0,0,0]},{"t":19}],"ix":2},"a":{"a":0,"k":[371.949,334.279,0],"ix":1},"s":{"a":0,"k":[95.2,95.2,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.063,0],[0,-6.157],[0,0],[0,0],[0,0]],"o":[[-6.061,0],[0,0],[0,0],[0,0],[0,-6.157]],"v":[[66.199,-32.931],[55.223,-21.783],[55.223,-3.217],[77.176,-3.217],[77.176,-21.783]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.941176474094,0.360784322023,0.380392163992,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,367.21],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.063,0],[0,-6.157],[0,0],[-6.061,0],[0,6.157],[0,0]],"o":[[-6.061,0],[0,0],[0,6.157],[6.063,0],[0,0],[0,-6.157]],"v":[[66.199,-32.931],[55.223,-21.783],[55.223,21.783],[66.199,32.931],[77.176,21.783],[77.176,-21.783]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,367.21],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":600,"st":-7,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":3,"nm":"MasterController","sr":1,"ks":{"o":{"a":0,"k":0,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[200.538,209.347,0],"ix":2},"a":{"a":0,"k":[60,60,0],"ix":1},"s":{"a":0,"k":[95.2,95.2,100],"ix":6}},"ao":0,"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Head","parent":7,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[305.75,302.634,0],"ix":2},"a":{"a":0,"k":[305.75,302.634,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.985,0],[0,2.985],[-2.984,0],[0,-2.984]],"o":[[-2.984,0],[0,-2.984],[2.985,0],[0,2.985]],"v":[[21.278,11.496],[15.875,6.092],[21.278,0.688],[26.682,6.092]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[2.985,0],[0,2.985],[-2.985,0],[0,-2.984]],"o":[[-2.985,0],[0,-2.984],[2.985,0],[0,2.985]],"v":[[-20.603,11.496],[-26.007,6.092],[-20.603,0.688],[-15.2,6.092]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[14.344,6.673],[0,0],[0.7,0.482],[0.536,-0.779],[0,0],[7.228,0],[6.175,-2.433],[0,0],[0.7,-0.482],[-0.535,-0.778],[0,0],[1.28,-14.799],[0,0]],"o":[[0,0],[0.535,-0.778],[-0.701,-0.482],[0,0],[-6.175,-2.433],[-7.229,0],[0,0],[-0.535,-0.779],[-0.7,0.482],[0,0],[-14.344,6.673],[0,0],[-1.281,-14.799]],"v":[[23.151,-9.145],[32.174,-22.242],[31.876,-24.524],[29.638,-23.988],[20.266,-10.384],[0,-14.173],[-20.266,-10.384],[-29.639,-23.988],[-31.876,-24.524],[-32.174,-22.242],[-23.151,-9.145],[-48.835,25.006],[48.835,25.006]],"c":true},"ix":2},"nm":"Path 3","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,302.518],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":5,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Blink","parent":4,"sr":1,"ks":{"o":{"a":1,"k":[{"t":0,"s":[0],"h":1},{"t":28,"s":[100],"h":1},{"t":35,"s":[0],"h":1},{"t":68,"s":[100],"h":1},{"t":75,"s":[0],"h":1}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[305.973,303.999,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[105.042,105.042,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[59.258,5.43],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.643137276173,0.776470601559,0.223529413342,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0.629,2.035],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 2","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[65.58,12.271],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.643137276173,0.776470601559,0.223529413342,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[1.29,12.865],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Eyes","parent":7,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[305.75,302.634,0],"ix":2},"a":{"a":0,"k":[305.75,302.634,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[2.985,0],[0,2.985],[-2.984,0],[0,-2.984]],"o":[[-2.984,0],[0,-2.984],[2.985,0],[0,2.985]],"v":[[21.278,11.496],[15.875,6.092],[21.278,0.688],[26.682,6.092]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[2.985,0],[0,2.985],[-2.985,0],[0,-2.984]],"o":[[-2.985,0],[0,-2.984],[2.985,0],[0,2.985]],"v":[[-20.603,11.496],[-26.007,6.092],[-20.603,0.688],[-15.2,6.092]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"mm","mm":1,"nm":"Merge Paths 1","mn":"ADBE Vector Filter - Merge","hd":false},{"ty":"fl","c":{"a":0,"k":[1,1,1,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,302.518],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 3","np":4,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":5,"ty":4,"nm":"BeloOutlines","parent":7,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[306.138,370.824,0],"ix":2},"a":{"a":0,"k":[186.059,695.577,0],"ix":1},"s":{"a":0,"k":[66.333,66.333,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[-3.218,-1.811],[-1.897,-0.22],[-1.765,0.716],[-0.546,3.813],[0.646,1.82],[0.296,0.669],[0.482,1.046],[0,0],[4.648,9.02],[0.562,1.045],[0.782,0.916],[2.469,0],[1.591,-1.864],[0.563,-1.048],[0.543,-1.054],[4.158,-9.021],[0.465,-1.053],[0.245,-0.69],[-0.277,-1.932],[-3.57,-1.449],[-1.886,0.219],[-1.647,0.927],[-2.333,2.741]],"o":[[2.333,2.741],[1.647,0.927],[1.886,0.219],[3.57,-1.449],[0.277,-1.932],[-0.245,-0.69],[-0.465,-1.053],[0,0],[-4.158,-9.021],[-0.543,-1.055],[-0.564,-1.048],[-1.59,-1.863],[-2.47,0],[-0.781,0.916],[-0.561,1.044],[-4.647,9.021],[-0.482,1.046],[-0.296,0.669],[-0.646,1.82],[0.546,3.813],[1.765,0.716],[1.897,-0.22],[3.217,-1.811],[0,0]],"v":[[-9,105.655],[-0.604,113.123],[4.706,114.928],[10.246,114.197],[16.89,105.701],[16.267,100.15],[15.439,98.119],[14.009,94.975],[14.009,94.975],[0.801,67.913],[-0.844,64.757],[-2.766,61.774],[-9,58.853],[-15.235,61.775],[-17.157,64.758],[-18.801,67.913],[-32.009,94.975],[-33.439,98.119],[-34.267,100.15],[-34.89,105.701],[-28.246,114.197],[-22.706,114.928],[-17.396,113.123],[-9,105.655]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[3.137,-3.685],[1.132,4.965],[-0.226,1.471],[-0.685,0.999],[-2.676,0],[-1.557,-2.272],[-0.182,-1.19],[0.327,-1.434]],"o":[[-3.137,-3.686],[-0.327,-1.433],[0.183,-1.189],[1.557,-2.271],[2.676,0],[0.685,0.999],[0.226,1.472],[-1.132,4.964]],"v":[[-9,105.655],[-16.931,91.894],[-17.165,87.496],[-15.885,84.187],[-9.001,80.743],[-2.115,84.187],[-0.834,87.497],[-1.07,91.897]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":4,"ix":5},"lc":2,"lj":2,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[195.059,608.647],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":6,"ty":4,"nm":"Shirt","parent":7,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[305.968,378.693,0],"ix":2},"a":{"a":0,"k":[305.968,378.693,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-48.835,-44.077],[-48.835,27.183],[48.835,27.183],[48.835,-44.077]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.941176474094,0.360784322023,0.380392163992,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.968,378.693],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":7,"ty":4,"nm":"Body","parent":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":0,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0.35014006495476,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":10,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":20,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":30,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":40,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":50,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":60,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":70,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":80,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":92,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":102,"s":[59.43,51.347,0],"e":[59.43,53.447,0],"to":[0,0,0],"ti":[0,0,0]},{"i":{"x":0.667,"y":1},"o":{"x":0.333,"y":0},"n":"0p667_1_0p333_0","t":112,"s":[59.43,53.447,0],"e":[59.43,51.347,0],"to":[0,0,0],"ti":[0,0.35014006495476,0]},{"t":122}],"ix":2},"a":{"a":0,"k":[305.968,378.693,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[-4.727,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,4.728],[0,0]],"o":[[0,0],[0,4.728],[0,0],[0,0],[0,0],[0,0],[0,0],[4.729,0],[0,0],[0,0]],"v":[[-48.835,-44.077],[-48.835,35.517],[-40.275,44.077],[-30.496,44.077],[-8.542,44.077],[8.542,44.077],[30.496,44.077],[40.274,44.077],[48.835,35.517],[48.835,-44.077]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.968,378.693],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 4","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":8,"ty":4,"nm":"LeftFoot","parent":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[79.457,64.948,0],"ix":2},"a":{"a":0,"k":[325.995,392.295,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.062,0],[0,-6.156],[0,0],[-6.062,0],[0,6.157],[0,0]],"o":[[-6.062,0],[0,0],[0,6.157],[6.062,0],[0,0],[0,-6.156]],"v":[[0,-32.931],[-10.977,-21.784],[-10.977,21.783],[0,32.931],[10.977,21.783],[10.977,-21.784]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[325.995,425.225],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":9,"ty":4,"nm":"RightFoot","parent":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[40.543,64.948,0],"ix":2},"a":{"a":0,"k":[287.08,392.295,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.062,0],[0,-6.156],[0,0],[-6.062,0],[0,6.157],[0,0]],"o":[[-6.062,0],[0,0],[0,6.157],[6.062,0],[0,0],[0,-6.156]],"v":[[0,-32.931],[-10.977,-21.784],[-10.977,21.783],[0,32.931],[10.977,21.783],[10.977,-21.784]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[287.08,425.225],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 2","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0},{"ddd":0,"ind":10,"ty":0,"nm":"LeftArmWave","parent":11,"refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[307.023,377.529,0],"ix":2},"a":{"a":0,"k":[200,200,0],"ix":1},"s":{"a":0,"k":[105.042,105.042,100],"ix":6}},"ao":0,"w":400,"h":400,"ip":0,"op":123,"st":0,"bm":0},{"ddd":0,"ind":11,"ty":4,"nm":"RightArm","parent":7,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[238.5,334.279,0],"ix":2},"a":{"a":0,"k":[239.551,334.279,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.062,0],[0,-6.157],[0,0],[0,0],[0,0]],"o":[[-6.062,0],[0,0],[0,0],[0,0],[0,-6.157]],"v":[[-66.199,-32.931],[-77.176,-21.783],[-77.176,-3.217],[-55.222,-3.217],[-55.222,-21.783]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.941176474094,0.360784322023,0.380392163992,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,367.21],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 6","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[6.062,0],[0,-6.157],[0,0],[-6.062,0],[0,6.157],[0,0]],"o":[[-6.062,0],[0,0],[0,6.157],[6.062,0],[0,0],[0,-6.157]],"v":[[-66.199,-32.931],[-77.176,-21.783],[-77.176,21.783],[-66.199,32.931],[-55.222,21.783],[-55.222,-21.783]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.642999985639,0.776000019148,0.224000010771,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[305.75,367.21],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 5","np":2,"cix":2,"ix":2,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":123,"st":-7,"bm":0}]} -------------------------------------------------------------------------------- /app/src/main/assets/Voice.json: -------------------------------------------------------------------------------- 1 | {"v":"5.4.2","fr":25,"ip":0,"op":25,"w":50,"h":50,"nm":"播放","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":4,"nm":"形状图层 3","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.333],"y":[0]},"n":["0_1_0p333_0"],"t":12,"s":[0],"e":[60]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.333],"y":[0]},"n":["0p833_0p833_0p333_0"],"t":24,"s":[60],"e":[0]},{"t":124}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[37.867,15.466,0],"ix":2},"a":{"a":0,"k":[-11.008,3.216,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[2,14],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.035294117647,0.396078431373,0.290196078431,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-11.008,3.216],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":125,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"形状图层 2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.667],"y":[1]},"o":{"x":[1],"y":[0]},"n":["0p667_1_1_0"],"t":0,"s":[0],"e":[60]},{"t":12}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[19.117,15.466,0],"ix":2},"a":{"a":0,"k":[-11.008,3.216,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[2,31],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.035294117647,0.396078431373,0.290196078431,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-11.008,3.216],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":125,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"形状图层 1","sr":1,"ks":{"o":{"a":0,"k":60,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[1.617,15.466,0],"ix":2},"a":{"a":0,"k":[-11.008,3.216,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[2,25],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"矩形路径 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[0.035294117647,0.396078431373,0.290196078431,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"填充 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[-11.008,3.216],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"变换"}],"nm":"矩形 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":125,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"预合成 1","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[25,25,0],"ix":2},"a":{"a":0,"k":[19.5,15.5,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":39,"h":31,"ip":0,"op":125,"st":0,"bm":0}],"markers":[]} -------------------------------------------------------------------------------- /app/src/main/java/com/gyf/sample/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 2 | 3 | import android.support.v7.app.ActionBar; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.widget.FrameLayout; 7 | 8 | import com.gyf.loadview.LoadView; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author geyifeng 15 | * @date 2018/7/2 下午12:24 16 | */ 17 | public class BaseActivity extends AppCompatActivity implements LoadView.OnLoadFailClickListener, 18 | LoadView.OnLoadingListener, LoadView.OnLoadErrorNetClickListener, LoadView.OnLoadEmptyClickListener { 19 | 20 | public RecordAdapter mAdapter = new RecordAdapter(); 21 | public List mData = new ArrayList<>(); 22 | 23 | public LoadView mLoadView; 24 | 25 | @Override 26 | public void setContentView(int layoutResID) { 27 | super.setContentView(layoutResID); 28 | ActionBar actionBar = getSupportActionBar(); 29 | if (actionBar != null) { 30 | actionBar.setElevation(0); 31 | } 32 | FrameLayout frameLayout = getWindow().getDecorView().findViewById(android.R.id.content); 33 | mLoadView = new LoadView(this); 34 | mLoadView.setOnFailClickListener(this); 35 | mLoadView.setOnLoadingListener(this); 36 | mLoadView.setOnErrorNetClickListener(this); 37 | mLoadView.setOnEmptyClickListener(this); 38 | frameLayout.addView(mLoadView); 39 | } 40 | 41 | @Override 42 | public void onLoadFailClick() { 43 | mAdapter.addData("加载失败点击事件"); 44 | } 45 | 46 | @Override 47 | public void onLoadingStart(View loadingView) { 48 | mAdapter.addData("加载开始"); 49 | } 50 | 51 | @Override 52 | public void onLoadingEnd(View loadingView) { 53 | mAdapter.addData("加载结束"); 54 | } 55 | 56 | @Override 57 | public void onLoadErrorNetClick() { 58 | mAdapter.addData("网络错误点击事件"); 59 | } 60 | 61 | @Override 62 | public void onLoadEmptyClick() { 63 | mAdapter.addData("数据为空点击事件"); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/gyf/sample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.os.Handler; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.LayoutInflater; 8 | import android.view.Menu; 9 | import android.view.MenuItem; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.Toast; 13 | 14 | import com.airbnb.lottie.LottieAnimationView; 15 | import com.gastudio.gabottleloading.library.GABottleLoadingView; 16 | import com.gyf.loadview.LoadStatus; 17 | import com.ldoublem.loadingviewlib.view.LVBattery; 18 | import com.ldoublem.loadingviewlib.view.LVBlazeWood; 19 | import com.ldoublem.loadingviewlib.view.LVBlock; 20 | import com.ldoublem.loadingviewlib.view.LVCircularSmile; 21 | import com.ldoublem.loadingviewlib.view.LVEatBeans; 22 | import com.ldoublem.loadingviewlib.view.LVFinePoiStar; 23 | import com.ldoublem.loadingviewlib.view.LVFunnyBar; 24 | import com.ldoublem.loadingviewlib.view.LVGhost; 25 | import com.ldoublem.loadingviewlib.view.base.LVBase; 26 | import com.roger.catloadinglibrary.CatLoadingView; 27 | 28 | import me.wangyuwei.loadingview.LoadingView; 29 | import me.wangyuwei.slackloadingview.SlackLoadingView; 30 | import scut.carson_ho.kawaii_loadingview.Kawaii_LoadingView; 31 | 32 | /** 33 | * @author geyifeng 34 | */ 35 | public class MainActivity extends BaseActivity { 36 | 37 | private int mCurrentLoadingId; 38 | private LVBase mLVBase; 39 | private RecyclerView mRecyclerView; 40 | private CatLoadingView mCatLoadingView; 41 | private LoadingView mLoadingView; 42 | private GABottleLoadingView mGaBottleLoadingView; 43 | private SlackLoadingView mSlackLoadingView; 44 | private Kawaii_LoadingView mKawaiiLoadingView; 45 | private LottieAnimationView mLottieView; 46 | 47 | @Override 48 | protected void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | setContentView(R.layout.activity_main); 51 | mRecyclerView = findViewById(R.id.recyclerView); 52 | mRecyclerView.setAdapter(mAdapter); 53 | mAdapter.setData(mData); 54 | // mLoadView = findViewById(R.id.load_view); 55 | // mLoadView.setOnFailClickListener(this); 56 | // mLoadView.setOnLoadingListener(this); 57 | // mLoadView.setOnErrorNetClickListener(this); 58 | // mLoadView.setImageViewSize(400,400); 59 | // mLoadView.setLoadingViewSize(200,400); 60 | mLoadView.setCurrentStatus(LoadStatus.FAIL); 61 | } 62 | 63 | @Override 64 | public boolean onCreateOptionsMenu(Menu menu) { 65 | getMenuInflater().inflate(R.menu.loading, menu); 66 | return true; 67 | } 68 | 69 | @Override 70 | public boolean onOptionsItemSelected(MenuItem item) { 71 | if (!mLoadView.isLoading()) { 72 | switch (item.getItemId()) { 73 | case R.id.lVFunnyBar: 74 | mLVBase = new LVFunnyBar(this); 75 | mLoadView.setLoadingView(mLVBase, 200, 200); 76 | break; 77 | case R.id.lVGhost: 78 | mLVBase = new LVGhost(this); 79 | mLoadView.setLoadingView(mLVBase, 200, 200); 80 | break; 81 | case R.id.lVBattery: 82 | mLVBase = new LVBattery(this); 83 | mLoadView.setLoadingView(mLVBase, 200, 200); 84 | break; 85 | case R.id.lVBlock: 86 | mLVBase = new LVBlock(this); 87 | mLoadView.setLoadingView(mLVBase, 200, 200); 88 | break; 89 | case R.id.lVEatBeans: 90 | mLVBase = new LVEatBeans(this); 91 | mLoadView.setLoadingView(mLVBase, 200, 200); 92 | break; 93 | case R.id.lVCircularSmile: 94 | mLVBase = new LVCircularSmile(this); 95 | ((LVCircularSmile) mLVBase).setViewColor(Color.parseColor("#8CE793")); 96 | mLoadView.setLoadingView(mLVBase, 200, 200); 97 | break; 98 | case R.id.lVFinePoiStar: 99 | mLVBase = new LVFinePoiStar(this); 100 | ((LVFinePoiStar) mLVBase).setViewColor(Color.parseColor("#8CE793")); 101 | ((LVFinePoiStar) mLVBase).setCircleColor(Color.parseColor("#C3CC63")); 102 | mLoadView.setLoadingView(mLVBase, 200, 200); 103 | break; 104 | case R.id.lVBlazeWood: 105 | mLVBase = new LVBlazeWood(this); 106 | mLoadView.setLoadingView(mLVBase, 200, 200); 107 | break; 108 | case R.id.catLoadingView: 109 | mCatLoadingView = new CatLoadingView(); 110 | break; 111 | case R.id.viscousCircleView: 112 | View view = LayoutInflater.from(this).inflate(R.layout.loading_viscous_circle, mLoadView, false); 113 | mLoadingView = (LoadingView) view; 114 | mLoadView.setLoadingView(mLoadingView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); 115 | break; 116 | case R.id.gABottleLoadingView: 117 | mGaBottleLoadingView = new GABottleLoadingView(this); 118 | mLoadView.setLoadingView(mGaBottleLoadingView, 200, 200); 119 | break; 120 | case R.id.slackLoadingView: 121 | mSlackLoadingView = new SlackLoadingView(this); 122 | mLoadView.setLoadingView(mSlackLoadingView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 123 | break; 124 | case R.id.squareLoading: 125 | mLoadView.setLoadingView(R.layout.loading_square, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 126 | break; 127 | case R.id.kawaii_LoadingView: 128 | mKawaiiLoadingView = new Kawaii_LoadingView(this); 129 | mLoadView.setLoadingView(mKawaiiLoadingView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 130 | break; 131 | case R.id.loadingView58: 132 | mLoadView.setLoadingView(R.layout.loading_58); 133 | break; 134 | case R.id.lottie_android: 135 | if (mLottieView == null) { 136 | mLottieView = (LottieAnimationView) LayoutInflater.from(this).inflate(R.layout.loading_lottie, mLoadView, false); 137 | } 138 | mLottieView.setAnimation("AndroidWave.json"); 139 | mLoadView.setLoadingView(mLottieView, 400, 400); 140 | break; 141 | case R.id.lottie_a: 142 | if (mLottieView == null) { 143 | mLottieView = (LottieAnimationView) LayoutInflater.from(this).inflate(R.layout.loading_lottie, mLoadView, false); 144 | } 145 | mLottieView.setAnimation("A.json"); 146 | mLoadView.setLoadingView(mLottieView, 400, 400); 147 | break; 148 | case R.id.lottie_b: 149 | if (mLottieView == null) { 150 | mLottieView = (LottieAnimationView) LayoutInflater.from(this).inflate(R.layout.loading_lottie, mLoadView, false); 151 | } 152 | mLottieView.setAnimation("B.json"); 153 | mLoadView.setLoadingView(mLottieView, 400, 400); 154 | break; 155 | default: 156 | break; 157 | } 158 | mCurrentLoadingId = item.getItemId(); 159 | new Handler().post(new Runnable() { 160 | @Override 161 | public void run() { 162 | mLoadView.setCurrentStatus(LoadStatus.LOADING); 163 | } 164 | }); 165 | setStatus(); 166 | } else { 167 | Toast.makeText(this, "加载结束在切换动画", Toast.LENGTH_SHORT).show(); 168 | } 169 | return super.onOptionsItemSelected(item); 170 | } 171 | 172 | @Override 173 | public void onLoadFailClick() { 174 | super.onLoadFailClick(); 175 | setStatus(); 176 | } 177 | 178 | @Override 179 | public void onLoadErrorNetClick() { 180 | super.onLoadErrorNetClick(); 181 | setStatus(); 182 | } 183 | 184 | @Override 185 | public void onLoadEmptyClick() { 186 | super.onLoadEmptyClick(); 187 | setStatus(); 188 | } 189 | 190 | private void setStatus() { 191 | new Handler().postDelayed(new Runnable() { 192 | @Override 193 | public void run() { 194 | int i = (int) (1 + Math.random() * (5)); 195 | switch (i) { 196 | case 1: 197 | mLoadView.setCurrentStatus(LoadStatus.UNDO); 198 | mAdapter.addData("默认(undo)"); 199 | break; 200 | case 2: 201 | mLoadView.setCurrentStatus(LoadStatus.SUCCESS); 202 | mAdapter.addData("成功(success)"); 203 | break; 204 | case 3: 205 | mLoadView.setCurrentStatus(LoadStatus.EMPTY); 206 | mAdapter.addData("数据为空(empty)"); 207 | break; 208 | case 4: 209 | mLoadView.setCurrentStatus(LoadStatus.FAIL); 210 | mAdapter.addData("失败(fail)"); 211 | break; 212 | case 5: 213 | mLoadView.setCurrentStatus(LoadStatus.ERROR_NET); 214 | mAdapter.addData("网络错误(error_net)"); 215 | break; 216 | default: 217 | break; 218 | } 219 | mRecyclerView.smoothScrollToPosition(mAdapter.getItemCount() - 1); 220 | } 221 | }, 3000); 222 | } 223 | 224 | @Override 225 | public void onLoadingStart(View loadingView) { 226 | super.onLoadingStart(loadingView); 227 | switch (mCurrentLoadingId) { 228 | case R.id.catLoadingView: 229 | loadingView.setVisibility(View.GONE); 230 | mCatLoadingView.show(getSupportFragmentManager(), ""); 231 | break; 232 | case R.id.viscousCircleView: 233 | mLoadingView.start(); 234 | break; 235 | case R.id.gABottleLoadingView: 236 | mGaBottleLoadingView.performAnimation(); 237 | break; 238 | case R.id.slackLoadingView: 239 | mSlackLoadingView.start(); 240 | break; 241 | case R.id.squareLoading: 242 | break; 243 | case R.id.kawaii_LoadingView: 244 | mKawaiiLoadingView.startMoving(); 245 | break; 246 | case R.id.loadingView58: 247 | break; 248 | case R.id.lottie_android: 249 | case R.id.lottie_a: 250 | case R.id.lottie_b: 251 | break; 252 | default: 253 | if (mLVBase != null) { 254 | mLVBase.startAnim(); 255 | } 256 | break; 257 | } 258 | mRecyclerView.smoothScrollToPosition(mAdapter.getItemCount() - 1); 259 | } 260 | 261 | @Override 262 | public void onLoadingEnd(View loadingView) { 263 | super.onLoadingEnd(loadingView); 264 | switch (mCurrentLoadingId) { 265 | case R.id.catLoadingView: 266 | mCatLoadingView.dismiss(); 267 | break; 268 | case R.id.viscousCircleView: 269 | mLoadingView.stop(); 270 | break; 271 | case R.id.gABottleLoadingView: 272 | mGaBottleLoadingView.cancel(); 273 | break; 274 | case R.id.slackLoadingView: 275 | mSlackLoadingView.reset(); 276 | break; 277 | case R.id.squareLoading: 278 | break; 279 | case R.id.kawaii_LoadingView: 280 | mKawaiiLoadingView.stopMoving(); 281 | break; 282 | case R.id.loadingView58: 283 | break; 284 | case R.id.lottie_android: 285 | case R.id.lottie_a: 286 | case R.id.lottie_b: 287 | break; 288 | default: 289 | if (mLVBase != null) { 290 | mLVBase.stopAnim(); 291 | } 292 | break; 293 | } 294 | mRecyclerView.smoothScrollToPosition(mAdapter.getItemCount() - 1); 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /app/src/main/java/com/gyf/sample/MyApp.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 2 | 3 | import android.app.Application; 4 | import android.graphics.Color; 5 | import android.text.SpannableString; 6 | import android.text.Spanned; 7 | import android.text.style.ForegroundColorSpan; 8 | 9 | import com.gyf.loadview.LoadManager; 10 | import com.squareup.leakcanary.LeakCanary; 11 | 12 | /** 13 | * @author geyifeng 14 | * @date 2018/7/2 下午12:02 15 | */ 16 | public class MyApp extends Application { 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | if (BuildConfig.DEBUG) { 21 | if (LeakCanary.isInAnalyzerProcess(this)) { 22 | return; 23 | } 24 | LeakCanary.install(this); 25 | } 26 | SpannableString spannableString = new SpannableString("加载失败了哦,点我重试"); 27 | ForegroundColorSpan colorSpan = new ForegroundColorSpan(Color.parseColor("#3F51B5")); 28 | spannableString.setSpan(colorSpan, 7, spannableString.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); 29 | LoadManager.getInstance().setFailText(spannableString); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/gyf/sample/RecordAdapter.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.TextView; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | /** 14 | * @author geyifeng 15 | * @date 2018/8/29 下午12:05 16 | */ 17 | public class RecordAdapter extends RecyclerView.Adapter { 18 | 19 | private List mData = new ArrayList<>(); 20 | 21 | @NonNull 22 | @Override 23 | public RecordViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { 24 | return new RecordViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_load_record, viewGroup, false)); 25 | } 26 | 27 | @Override 28 | public void onBindViewHolder(@NonNull RecordViewHolder holder, int i) { 29 | holder.textView.setText(mData.get(i)); 30 | if (i == 0) { 31 | holder.point.setVisibility(View.GONE); 32 | } else { 33 | holder.point.setVisibility(View.VISIBLE); 34 | } 35 | } 36 | 37 | @Override 38 | public int getItemCount() { 39 | return mData.size(); 40 | } 41 | 42 | public void setData(List mData) { 43 | this.mData = mData; 44 | notifyDataSetChanged(); 45 | } 46 | 47 | public void addData(String data) { 48 | mData.add(data); 49 | notifyDataSetChanged(); 50 | } 51 | 52 | static class RecordViewHolder extends RecyclerView.ViewHolder { 53 | 54 | private final TextView textView; 55 | private final View point; 56 | 57 | RecordViewHolder(@NonNull View itemView) { 58 | super(itemView); 59 | textView = itemView.findViewById(R.id.textView); 60 | point = itemView.findViewById(R.id.point); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_point.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_load_record.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | 20 | 29 | 30 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loading_58.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loading_lottie.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loading_square.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/loading_viscous_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/menu/loading.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 | 27 | 30 | 33 | 36 | 39 | 42 | 45 | 48 | 51 | 54 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #3F51B5 5 | #3F51B5 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LoadView 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/test/java/com/gyf/sample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.gyf.sample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | maven { 9 | url "https://jitpack.io" 10 | } 11 | maven { 12 | url 'https://dl.bintray.com/wangyuwei/maven' 13 | } 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.1.4' 17 | classpath 'com.novoda:bintray-release:0.8.1' 18 | 19 | // NOTE: Do not place your application dependencies here; they belong 20 | // in the individual module build.gradle files 21 | } 22 | } 23 | 24 | allprojects { 25 | repositories { 26 | google() 27 | jcenter() 28 | maven { 29 | url "https://jitpack.io" 30 | } 31 | maven { 32 | url 'https://dl.bintray.com/wangyuwei/maven' 33 | } 34 | } 35 | tasks.withType(Javadoc) { 36 | options { 37 | encoding "UTF-8" 38 | charSet 'UTF-8' 39 | links "http://docs.oracle.com/javase/7/docs/api" 40 | } 41 | options.addStringOption('Xdoclint:none', '-quiet') 42 | options.addStringOption('encoding', 'UTF-8') 43 | } 44 | } 45 | 46 | task clean(type: Delete) { 47 | delete rootProject.buildDir 48 | } 49 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | android.useAndroidX=true 16 | android.enableJetifier=true 17 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 02 15:54:23 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.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /loadview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /loadview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.novoda.bintray-release' 3 | 4 | android { 5 | compileSdkVersion 28 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 28 10 | } 11 | 12 | buildTypes { 13 | release { 14 | minifyEnabled false 15 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 16 | } 17 | } 18 | 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'com.android.support:appcompat-v7:28.0.0' 24 | } 25 | 26 | publish { 27 | userOrg = 'geyifeng' 28 | groupId = 'com.gyf.loadview' 29 | artifactId = 'loadview' 30 | publishVersion = '1.0.7' 31 | desc = 'Android Load View' 32 | website = 'https://github.com/gyf-dev/LoadView' 33 | } 34 | -------------------------------------------------------------------------------- /loadview/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /loadview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /loadview/src/main/java/com/gyf/loadview/LoadManager.java: -------------------------------------------------------------------------------- 1 | package com.gyf.loadview; 2 | 3 | import android.graphics.Color; 4 | import android.support.annotation.ColorInt; 5 | import android.support.annotation.DrawableRes; 6 | import android.support.annotation.LayoutRes; 7 | import android.view.Gravity; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * The type Load manager. 12 | * 13 | * @author geyifeng 14 | */ 15 | public class LoadManager { 16 | 17 | /** 18 | * The constant mInstance. 19 | */ 20 | private static final LoadManager mInstance = new LoadManager(); 21 | 22 | /** 23 | * The loading layout id. 24 | */ 25 | @LayoutRes 26 | private int mLoadingLayoutId = 0; 27 | 28 | /** 29 | * The fail text. 30 | */ 31 | private CharSequence mFailText = "加载失败,点击重试"; 32 | /** 33 | * The error net text. 34 | */ 35 | private CharSequence mErrorNetText = "网络错误"; 36 | /** 37 | * The empty text. 38 | */ 39 | private CharSequence mEmptyText = "数据为空"; 40 | 41 | 42 | /** 43 | * The gravity. 44 | */ 45 | private int mGravity = Gravity.CENTER; 46 | /** 47 | * The loading gravity. 48 | */ 49 | private int mLoadingGravity = mGravity; 50 | /** 51 | * The image text gravity. 52 | */ 53 | private int mImageTextGravity = mGravity; 54 | 55 | /** 56 | * The margin. 57 | */ 58 | private int mMargin = 0; 59 | 60 | /** 61 | * The loading left margin. 62 | */ 63 | private int mLoadingLeftMargin = mMargin; 64 | /** 65 | * The loading top margin. 66 | */ 67 | private int mLoadingTopMargin = mMargin; 68 | /** 69 | * The loading right margin. 70 | */ 71 | private int mLoadingRightMargin = mMargin; 72 | /** 73 | * The loading bottom margin. 74 | */ 75 | private int mLoadingBottomMargin = mMargin; 76 | 77 | /** 78 | * The image text left margin. 79 | */ 80 | private int mImageTextLeftMargin = mMargin; 81 | /** 82 | * The image text top margin. 83 | */ 84 | private int mImageTextTopMargin = mMargin; 85 | /** 86 | * The image text right margin. 87 | */ 88 | private int mImageTextRightMargin = mMargin; 89 | /** 90 | * The image text bottom margin. 91 | */ 92 | private int mImageTextBottomMargin = mMargin; 93 | 94 | /** 95 | * The image left margin. 96 | */ 97 | private int mImageLeftMargin = 0; 98 | /** 99 | * The image top margin. 100 | */ 101 | private int mImageTopMargin = 0; 102 | /** 103 | * The image right margin. 104 | */ 105 | private int mImageRightMargin = 0; 106 | /** 107 | * The image bottom margin. 108 | */ 109 | private int mImageBottomMargin = 0; 110 | 111 | /** 112 | * The text left margin. 113 | */ 114 | private int mTextLeftMargin = 0; 115 | /** 116 | * The text top margin. 117 | */ 118 | private int mTextTopMargin = 100; 119 | /** 120 | * The text right margin. 121 | */ 122 | private int mTextRightMargin = 0; 123 | /** 124 | * The text bottom margin. 125 | */ 126 | private int mTextBottomMargin = 0; 127 | /** 128 | * The fail res. 129 | */ 130 | @DrawableRes 131 | private int mFailRes = R.drawable.icon_load_fail; 132 | /** 133 | * The error net res. 134 | */ 135 | @DrawableRes 136 | private int mErrorNetRes = R.drawable.icon_load_error_net; 137 | /** 138 | * The empty res. 139 | */ 140 | @DrawableRes 141 | private int mEmptyRes = R.drawable.icon_load_emtpy; 142 | /** 143 | * The text color. 144 | */ 145 | @ColorInt 146 | private int mTextColor = Color.parseColor("#000000"); 147 | /** 148 | * The fail text color. 149 | */ 150 | @ColorInt 151 | private int mFailTextColor = mTextColor; 152 | /** 153 | * The error net text color. 154 | */ 155 | @ColorInt 156 | private int mErrorNetTextColor = mTextColor; 157 | /** 158 | * The empty text color. 159 | */ 160 | @ColorInt 161 | private int mEmptyTextColor = mTextColor; 162 | /** 163 | * The image color. 164 | */ 165 | @ColorInt 166 | private int mImageColor = Color.parseColor("#000000"); 167 | /** 168 | * The fail image color. 169 | */ 170 | @ColorInt 171 | private int mFailImageColor = mImageColor; 172 | /** 173 | * The error net image color. 174 | */ 175 | @ColorInt 176 | private int mErrorNetImageColor = mImageColor; 177 | /** 178 | * The empty image color. 179 | */ 180 | @ColorInt 181 | private int mEmptyImageColor = mImageColor; 182 | /** 183 | * The default loading color. 184 | */ 185 | @ColorInt 186 | private int mDefaultLoadingColor = 0; 187 | 188 | /** 189 | * The text size. 190 | */ 191 | private int mTextSize = 16; 192 | 193 | /** 194 | * The fail image color enabled. 195 | */ 196 | private boolean mFailImageColorEnabled = false; 197 | /** 198 | * The error net image color enabled. 199 | */ 200 | private boolean mErrorNetImageColorEnabled = false; 201 | /** 202 | * The empty image color enabled. 203 | */ 204 | private boolean mEmptyImageColorEnabled = false; 205 | 206 | /** 207 | * The image width. 208 | */ 209 | private float mImageViewWidth = ViewGroup.LayoutParams.WRAP_CONTENT; 210 | /** 211 | * The image height. 212 | */ 213 | private float mImageViewHeight = ViewGroup.LayoutParams.WRAP_CONTENT; 214 | 215 | /** 216 | * The loading width. 217 | */ 218 | private float mLoadingViewWidth = ViewGroup.LayoutParams.WRAP_CONTENT; 219 | /** 220 | * The loading height. 221 | */ 222 | private float mLoadingViewHeight = ViewGroup.LayoutParams.WRAP_CONTENT; 223 | 224 | /** 225 | * The is loading focusable. 226 | */ 227 | private Boolean mIsLoadingClickable = true; 228 | 229 | /** 230 | * The is fail clickable. 231 | */ 232 | private Boolean mIsFailClickable = true; 233 | 234 | /** 235 | * The is error net clickable. 236 | */ 237 | private Boolean mIsErrorNetClickable = true; 238 | 239 | /** 240 | * The is empty clickable. 241 | */ 242 | private Boolean mIsEmptyClickable = true; 243 | 244 | /** 245 | * Gets instance. 246 | * 247 | * @return the instance 248 | */ 249 | public static LoadManager getInstance() { 250 | return mInstance; 251 | } 252 | 253 | /** 254 | * Sets loading layout id. 255 | * 256 | * @param layoutId the layout id 257 | * @return the loading layout id 258 | */ 259 | public LoadManager setLoadingLayoutId(@LayoutRes int layoutId) { 260 | this.mLoadingLayoutId = layoutId; 261 | return this; 262 | } 263 | 264 | /** 265 | * Gets loading layout id. 266 | * 267 | * @return the loading layout id 268 | */ 269 | public int getLoadingLayoutId() { 270 | return mLoadingLayoutId; 271 | } 272 | 273 | /** 274 | * Sets fail. 275 | * 276 | * @param failText the fail text 277 | * @param failRes the fail res 278 | * @return the fail 279 | */ 280 | public LoadManager setFail(CharSequence failText, @DrawableRes int failRes) { 281 | mFailText = failText; 282 | mFailRes = failRes; 283 | return this; 284 | } 285 | 286 | /** 287 | * Sets error net. 288 | * 289 | * @param errorNetText the error net text 290 | * @param errorNetRes the error net res 291 | * @return the error net 292 | */ 293 | public LoadManager setErrorNet(CharSequence errorNetText, @DrawableRes int errorNetRes) { 294 | mErrorNetText = errorNetText; 295 | mErrorNetRes = errorNetRes; 296 | return this; 297 | } 298 | 299 | /** 300 | * Sets empty. 301 | * 302 | * @param emptyText the empty text 303 | * @param emptyRes the empty res 304 | * @return the empty 305 | */ 306 | public LoadManager setEmpty(CharSequence emptyText, @DrawableRes int emptyRes) { 307 | mEmptyText = emptyText; 308 | mEmptyRes = emptyRes; 309 | return this; 310 | } 311 | 312 | /** 313 | * Sets fail res. 314 | * 315 | * @param failRes the fail res 316 | * @return the fail res 317 | */ 318 | public LoadManager setFailRes(@DrawableRes int failRes) { 319 | this.mFailRes = failRes; 320 | return this; 321 | } 322 | 323 | /** 324 | * Gets fail res. 325 | * 326 | * @return the fail res 327 | */ 328 | public int getFailRes() { 329 | return mFailRes; 330 | } 331 | 332 | /** 333 | * Sets error net res. 334 | * 335 | * @param errorNetRes the error net res 336 | * @return the error net res 337 | */ 338 | public LoadManager setErrorNetRes(@DrawableRes int errorNetRes) { 339 | this.mErrorNetRes = errorNetRes; 340 | return this; 341 | } 342 | 343 | /** 344 | * Gets error net res. 345 | * 346 | * @return the error net res 347 | */ 348 | public int getErrorNetRes() { 349 | return mErrorNetRes; 350 | } 351 | 352 | /** 353 | * Sets empty res. 354 | * 355 | * @param emptyRes the empty res 356 | * @return the empty res 357 | */ 358 | public LoadManager setEmptyRes(@DrawableRes int emptyRes) { 359 | this.mEmptyRes = emptyRes; 360 | return this; 361 | } 362 | 363 | /** 364 | * Gets empty res. 365 | * 366 | * @return the empty res 367 | */ 368 | public int getEmptyRes() { 369 | return mEmptyRes; 370 | } 371 | 372 | /** 373 | * Sets fail text. 374 | * 375 | * @param failText the fail text 376 | * @return the fail text 377 | */ 378 | public LoadManager setFailText(CharSequence failText) { 379 | this.mFailText = failText; 380 | return this; 381 | } 382 | 383 | /** 384 | * Gets fail text. 385 | * 386 | * @return the fail text 387 | */ 388 | public CharSequence getFailText() { 389 | return mFailText; 390 | } 391 | 392 | /** 393 | * Sets error net text. 394 | * 395 | * @param errorNetText the error net text 396 | * @return the error net text 397 | */ 398 | public LoadManager setErrorNetText(CharSequence errorNetText) { 399 | this.mErrorNetText = errorNetText; 400 | return this; 401 | } 402 | 403 | /** 404 | * Gets error net text. 405 | * 406 | * @return the error net text 407 | */ 408 | public CharSequence getErrorNetText() { 409 | return mErrorNetText; 410 | } 411 | 412 | /** 413 | * Sets empty text. 414 | * 415 | * @param emptyText the empty text 416 | * @return the empty text 417 | */ 418 | public LoadManager setEmptyText(CharSequence emptyText) { 419 | this.mEmptyText = emptyText; 420 | return this; 421 | } 422 | 423 | /** 424 | * Gets empty text. 425 | * 426 | * @return the empty text 427 | */ 428 | public CharSequence getEmptyText() { 429 | return mEmptyText; 430 | } 431 | 432 | /** 433 | * Sets text color. 434 | * 435 | * @param textColor the text color 436 | * @return the text color 437 | */ 438 | public LoadManager setTextColor(@ColorInt int textColor) { 439 | mTextColor = textColor; 440 | mFailTextColor = textColor; 441 | mErrorNetTextColor = textColor; 442 | mEmptyTextColor = textColor; 443 | return this; 444 | } 445 | 446 | /** 447 | * Gets text color. 448 | * 449 | * @return the text color 450 | */ 451 | public int getTextColor() { 452 | return mTextColor; 453 | } 454 | 455 | /** 456 | * Sets fail text color. 457 | * 458 | * @param failTextColor the fail text color 459 | * @return the fail text color 460 | */ 461 | public LoadManager setFailTextColor(@ColorInt int failTextColor) { 462 | mFailTextColor = failTextColor; 463 | return this; 464 | } 465 | 466 | /** 467 | * Gets fail text color. 468 | * 469 | * @return the fail text color 470 | */ 471 | public int getFailTextColor() { 472 | return mFailTextColor; 473 | } 474 | 475 | /** 476 | * Sets error net text color. 477 | * 478 | * @param errorNetTextColor the error net text color 479 | * @return the error net text color 480 | */ 481 | public LoadManager setErrorNetTextColor(@ColorInt int errorNetTextColor) { 482 | mErrorNetTextColor = errorNetTextColor; 483 | return this; 484 | } 485 | 486 | /** 487 | * Gets error net text color. 488 | * 489 | * @return the error net text color 490 | */ 491 | public int getErrorNetTextColor() { 492 | return mErrorNetTextColor; 493 | } 494 | 495 | /** 496 | * Sets empty text color. 497 | * 498 | * @param emptyTextColor the empty text color 499 | * @return the empty text color 500 | */ 501 | public LoadManager setEmptyTextColor(@ColorInt int emptyTextColor) { 502 | mEmptyTextColor = emptyTextColor; 503 | return this; 504 | } 505 | 506 | /** 507 | * Gets empty text color. 508 | * 509 | * @return the empty text color 510 | */ 511 | public int getEmptyTextColor() { 512 | return mEmptyTextColor; 513 | } 514 | 515 | /** 516 | * Sets image color. 517 | * 518 | * @param imageColor the image color 519 | * @return the image color 520 | */ 521 | public LoadManager setImageColor(@ColorInt int imageColor) { 522 | this.mImageColor = imageColor; 523 | this.mFailImageColor = imageColor; 524 | this.mErrorNetImageColor = imageColor; 525 | this.mEmptyImageColor = imageColor; 526 | return this; 527 | } 528 | 529 | /** 530 | * Gets image color. 531 | * 532 | * @return the image color 533 | */ 534 | public int getImageColor() { 535 | return mImageColor; 536 | } 537 | 538 | /** 539 | * Sets fail image color. 540 | * 541 | * @param failImageColor the fail image color 542 | * @return the fail image color 543 | */ 544 | public LoadManager setFailImageColor(@ColorInt int failImageColor) { 545 | this.mFailImageColor = failImageColor; 546 | return this; 547 | } 548 | 549 | /** 550 | * Gets fail image color. 551 | * 552 | * @return the fail image color 553 | */ 554 | public int getFailImageColor() { 555 | return mFailImageColor; 556 | } 557 | 558 | /** 559 | * Sets error net image color. 560 | * 561 | * @param errorNetImageColor the error net image color 562 | * @return the error net image color 563 | */ 564 | public LoadManager setErrorNetImageColor(@ColorInt int errorNetImageColor) { 565 | this.mErrorNetImageColor = errorNetImageColor; 566 | return this; 567 | } 568 | 569 | /** 570 | * Gets error net image color. 571 | * 572 | * @return the error net image color 573 | */ 574 | public int getErrorNetImageColor() { 575 | return mErrorNetImageColor; 576 | } 577 | 578 | /** 579 | * Sets empty image color. 580 | * 581 | * @param emptyImageColor the empty image color 582 | * @return the empty image color 583 | */ 584 | public LoadManager setEmptyImageColor(@ColorInt int emptyImageColor) { 585 | this.mEmptyImageColor = emptyImageColor; 586 | return this; 587 | } 588 | 589 | /** 590 | * Gets empty image color. 591 | * 592 | * @return the empty image color 593 | */ 594 | public int getEmptyImageColor() { 595 | return mEmptyImageColor; 596 | } 597 | 598 | /** 599 | * Sets default loading color. 600 | * 601 | * @param defaultLoadingColor the default loading color 602 | * @return the default loading color 603 | */ 604 | public LoadManager setDefaultLoadingColor(@ColorInt int defaultLoadingColor) { 605 | this.mDefaultLoadingColor = defaultLoadingColor; 606 | return this; 607 | } 608 | 609 | /** 610 | * Gets default loading color. 611 | * 612 | * @return the default loading color 613 | */ 614 | public int getDefaultLoadingColor() { 615 | return mDefaultLoadingColor; 616 | } 617 | 618 | /** 619 | * Sets text size. 620 | * 621 | * @param textSize the text size 622 | * @return the text size 623 | */ 624 | public LoadManager setTextSize(int textSize) { 625 | this.mTextSize = textSize; 626 | return this; 627 | } 628 | 629 | /** 630 | * Gets text size. 631 | * 632 | * @return the text size 633 | */ 634 | public int getTextSize() { 635 | return mTextSize; 636 | } 637 | 638 | /** 639 | * Sets gravity. 640 | * 641 | * @param gravity the gravity 642 | * @return the gravity 643 | */ 644 | public LoadManager setGravity(int gravity) { 645 | this.mGravity = gravity; 646 | this.mLoadingGravity = gravity; 647 | this.mImageTextGravity = gravity; 648 | return this; 649 | } 650 | 651 | /** 652 | * Gets gravity. 653 | * 654 | * @return the gravity 655 | */ 656 | public int getGravity() { 657 | return mGravity; 658 | } 659 | 660 | /** 661 | * Sets loading gravity. 662 | * 663 | * @param loadingGravity the loading gravity 664 | * @return the loading gravity 665 | */ 666 | public LoadManager setLoadingGravity(int loadingGravity) { 667 | this.mLoadingGravity = loadingGravity; 668 | return this; 669 | } 670 | 671 | /** 672 | * Gets loading gravity. 673 | * 674 | * @return the loading gravity 675 | */ 676 | public int getLoadingGravity() { 677 | return mLoadingGravity; 678 | } 679 | 680 | /** 681 | * Sets image text gravity. 682 | * 683 | * @param imageTextGravity the image text gravity 684 | * @return the image text gravity 685 | */ 686 | public LoadManager setImageTextGravity(int imageTextGravity) { 687 | this.mImageTextGravity = imageTextGravity; 688 | return this; 689 | } 690 | 691 | /** 692 | * Gets image text gravity. 693 | * 694 | * @return the image text gravity 695 | */ 696 | public int getImageTextGravity() { 697 | return mImageTextGravity; 698 | } 699 | 700 | /** 701 | * Sets margins. 702 | * 703 | * @param margin the margin 704 | * @return the margins 705 | */ 706 | public LoadManager setMargins(int margin) { 707 | return setMargins(margin, margin, margin, margin); 708 | } 709 | 710 | /** 711 | * Sets margins. 712 | * 713 | * @param left the left 714 | * @param top the top 715 | * @param right the right 716 | * @param bottom the bottom 717 | * @return the margins 718 | */ 719 | public LoadManager setMargins(int left, int top, int right, int bottom) { 720 | mImageTextLeftMargin = left; 721 | mImageTextTopMargin = top; 722 | mImageTextRightMargin = right; 723 | mImageTextBottomMargin = bottom; 724 | 725 | mLoadingLeftMargin = left; 726 | mLoadingTopMargin = top; 727 | mLoadingRightMargin = right; 728 | mLoadingBottomMargin = bottom; 729 | return this; 730 | } 731 | 732 | /** 733 | * Sets image text margins. 734 | * 735 | * @param left the left 736 | * @param top the top 737 | * @param right the right 738 | * @param bottom the bottom 739 | * @return the image text margins 740 | */ 741 | public LoadManager setImageTextMargins(int left, int top, int right, int bottom) { 742 | mImageTextLeftMargin = left; 743 | mImageTextTopMargin = top; 744 | mImageTextRightMargin = right; 745 | mImageTextBottomMargin = bottom; 746 | return this; 747 | } 748 | 749 | /** 750 | * Sets loading margins. 751 | * 752 | * @param left the left 753 | * @param top the top 754 | * @param right the right 755 | * @param bottom the bottom 756 | * @return the loading margins 757 | */ 758 | public LoadManager setLoadingMargins(int left, int top, int right, int bottom) { 759 | mLoadingLeftMargin = left; 760 | mLoadingTopMargin = top; 761 | mLoadingRightMargin = right; 762 | mLoadingBottomMargin = bottom; 763 | return this; 764 | } 765 | 766 | /** 767 | * Gets loading left margin. 768 | * 769 | * @return the loading left margin 770 | */ 771 | public int getLoadingLeftMargin() { 772 | return mLoadingLeftMargin; 773 | } 774 | 775 | /** 776 | * Gets loading top margin. 777 | * 778 | * @return the loading top margin 779 | */ 780 | public int getLoadingTopMargin() { 781 | return mLoadingTopMargin; 782 | } 783 | 784 | /** 785 | * Gets loading right margin. 786 | * 787 | * @return the loading right margin 788 | */ 789 | public int getLoadingRightMargin() { 790 | return mLoadingRightMargin; 791 | } 792 | 793 | /** 794 | * Gets loading bottom margin. 795 | * 796 | * @return the loading bottom margin 797 | */ 798 | public int getLoadingBottomMargin() { 799 | return mLoadingBottomMargin; 800 | } 801 | 802 | /** 803 | * Gets image text left margin. 804 | * 805 | * @return the image text left margin 806 | */ 807 | public int getImageTextLeftMargin() { 808 | return mImageTextLeftMargin; 809 | } 810 | 811 | /** 812 | * Gets image text top margin. 813 | * 814 | * @return the image text top margin 815 | */ 816 | public int getImageTextTopMargin() { 817 | return mImageTextTopMargin; 818 | } 819 | 820 | /** 821 | * Gets image text right margin. 822 | * 823 | * @return the image text right margin 824 | */ 825 | public int getImageTextRightMargin() { 826 | return mImageTextRightMargin; 827 | } 828 | 829 | /** 830 | * Gets image text bottom margin. 831 | * 832 | * @return the image text bottom margin 833 | */ 834 | public int getImageTextBottomMargin() { 835 | return mImageTextBottomMargin; 836 | } 837 | 838 | /** 839 | * Sets image margins. 840 | * 841 | * @param left the left 842 | * @param top the top 843 | * @param right the right 844 | * @param bottom the bottom 845 | * @return the image margins 846 | */ 847 | public LoadManager setImageMargins(int left, int top, int right, int bottom) { 848 | mImageLeftMargin = left; 849 | mImageTopMargin = top; 850 | mImageRightMargin = right; 851 | mImageBottomMargin = bottom; 852 | return this; 853 | } 854 | 855 | /** 856 | * Sets text margins. 857 | * 858 | * @param left the left 859 | * @param top the top 860 | * @param right the right 861 | * @param bottom the bottom 862 | * @return the text margins 863 | */ 864 | public LoadManager setTextMargins(int left, int top, int right, int bottom) { 865 | mTextLeftMargin = left; 866 | mTextTopMargin = top; 867 | mTextRightMargin = right; 868 | mTextBottomMargin = bottom; 869 | return this; 870 | } 871 | 872 | /** 873 | * Gets image left margin. 874 | * 875 | * @return the image left margin 876 | */ 877 | public int getImageLeftMargin() { 878 | return mImageLeftMargin; 879 | } 880 | 881 | /** 882 | * Gets image top margin. 883 | * 884 | * @return the image top margin 885 | */ 886 | public int getImageTopMargin() { 887 | return mImageTopMargin; 888 | } 889 | 890 | /** 891 | * Gets image right margin. 892 | * 893 | * @return the image right margin 894 | */ 895 | public int getImageRightMargin() { 896 | return mImageRightMargin; 897 | } 898 | 899 | /** 900 | * Gets image bottom margin. 901 | * 902 | * @return the image bottom margin 903 | */ 904 | public int getImageBottomMargin() { 905 | return mImageBottomMargin; 906 | } 907 | 908 | /** 909 | * Gets text left margin. 910 | * 911 | * @return the text left margin 912 | */ 913 | public int getTextLeftMargin() { 914 | return mTextLeftMargin; 915 | } 916 | 917 | /** 918 | * Gets text top margin. 919 | * 920 | * @return the text top margin 921 | */ 922 | public int getTextTopMargin() { 923 | return mTextTopMargin; 924 | } 925 | 926 | /** 927 | * Gets text right margin. 928 | * 929 | * @return the text right margin 930 | */ 931 | public int getTextRightMargin() { 932 | return mTextRightMargin; 933 | } 934 | 935 | /** 936 | * Gets text bottom margin. 937 | * 938 | * @return the text bottom margin 939 | */ 940 | public int getTextBottomMargin() { 941 | return mTextBottomMargin; 942 | } 943 | 944 | /** 945 | * Sets image color enabled. 946 | * 947 | * @param imageColorEnabled the image color enabled 948 | * @return the image color enabled 949 | */ 950 | public LoadManager setImageColorEnabled(boolean imageColorEnabled) { 951 | this.mFailImageColorEnabled = imageColorEnabled; 952 | this.mErrorNetImageColorEnabled = imageColorEnabled; 953 | this.mEmptyImageColorEnabled = imageColorEnabled; 954 | return this; 955 | } 956 | 957 | /** 958 | * Sets fail image color enabled. 959 | * 960 | * @param failImageColorEnabled the fail image color enabled 961 | * @return the fail image color enabled 962 | */ 963 | public LoadManager setFailImageColorEnabled(boolean failImageColorEnabled) { 964 | this.mFailImageColorEnabled = failImageColorEnabled; 965 | return this; 966 | } 967 | 968 | /** 969 | * Is fail image color enabled boolean. 970 | * 971 | * @return the boolean 972 | */ 973 | public boolean isFailImageColorEnabled() { 974 | return mFailImageColorEnabled; 975 | } 976 | 977 | /** 978 | * Sets error net image color enabled. 979 | * 980 | * @param errorNetImageColorEnabled the error net image color enabled 981 | * @return the error net image color enabled 982 | */ 983 | public LoadManager setErrorNetImageColorEnabled(boolean errorNetImageColorEnabled) { 984 | this.mErrorNetImageColorEnabled = errorNetImageColorEnabled; 985 | return this; 986 | } 987 | 988 | /** 989 | * Is error net image color enabled boolean. 990 | * 991 | * @return the boolean 992 | */ 993 | public boolean isErrorNetImageColorEnabled() { 994 | return mErrorNetImageColorEnabled; 995 | } 996 | 997 | /** 998 | * Sets empty image color enabled. 999 | * 1000 | * @param emptyImageColorEnabled the empty image color enabled 1001 | * @return the empty image color enabled 1002 | */ 1003 | public LoadManager setEmptyImageColorEnabled(boolean emptyImageColorEnabled) { 1004 | this.mEmptyImageColorEnabled = emptyImageColorEnabled; 1005 | return this; 1006 | } 1007 | 1008 | /** 1009 | * Is empty image color enabled boolean. 1010 | * 1011 | * @return the boolean 1012 | */ 1013 | public boolean isEmptyImageColorEnabled() { 1014 | return mEmptyImageColorEnabled; 1015 | } 1016 | 1017 | 1018 | /** 1019 | * Sets image size. 1020 | * 1021 | * @param width the width 1022 | * @param heigh the heigh 1023 | * @return the image size 1024 | */ 1025 | public LoadManager setImageViewSize(float width, float heigh) { 1026 | this.mImageViewWidth = width; 1027 | this.mImageViewHeight = heigh; 1028 | return this; 1029 | } 1030 | 1031 | /** 1032 | * Gets image width. 1033 | * 1034 | * @return the image width 1035 | */ 1036 | public float getImageViewWidth() { 1037 | return mImageViewWidth; 1038 | } 1039 | 1040 | /** 1041 | * Gets image height. 1042 | * 1043 | * @return the image height 1044 | */ 1045 | public float getImageViewHeight() { 1046 | return mImageViewHeight; 1047 | } 1048 | 1049 | /** 1050 | * Set loading size load manager. 1051 | * 1052 | * @param width the width 1053 | * @param height the height 1054 | * @return the load manager 1055 | */ 1056 | public LoadManager setLoadingViewSize(float width, float height) { 1057 | this.mLoadingViewWidth = width; 1058 | this.mLoadingViewHeight = height; 1059 | return this; 1060 | } 1061 | 1062 | /** 1063 | * Gets loading width. 1064 | * 1065 | * @return the loading width 1066 | */ 1067 | public float getLoadingViewWidth() { 1068 | return mLoadingViewWidth; 1069 | } 1070 | 1071 | /** 1072 | * Gets loading height. 1073 | * 1074 | * @return the loading height 1075 | */ 1076 | public float getLoadingViewHeight() { 1077 | return mLoadingViewHeight; 1078 | } 1079 | 1080 | /** 1081 | * Gets loading focusable. 1082 | * 1083 | * @return the loading clickable 1084 | */ 1085 | public Boolean getLoadingClickable() { 1086 | return mIsLoadingClickable; 1087 | } 1088 | 1089 | /** 1090 | * Is loading focusable load manager. 1091 | * 1092 | * @param loadingClickable the loadingClickable 1093 | * @return the load manager 1094 | */ 1095 | public LoadManager isLoadingClickable(Boolean loadingClickable) { 1096 | this.mIsLoadingClickable = loadingClickable; 1097 | return this; 1098 | } 1099 | 1100 | /** 1101 | * Is load clickable load manager. 1102 | * 1103 | * @param clickable the clickable 1104 | * @return the load manager 1105 | */ 1106 | public LoadManager isLoadClickable(Boolean clickable) { 1107 | this.mIsLoadingClickable = clickable; 1108 | this.mIsFailClickable = clickable; 1109 | this.mIsErrorNetClickable = clickable; 1110 | this.mIsEmptyClickable = clickable; 1111 | return this; 1112 | } 1113 | 1114 | /** 1115 | * Is fail clickable boolean. 1116 | * 1117 | * @return the boolean 1118 | */ 1119 | public Boolean getFailClickable() { 1120 | return mIsFailClickable; 1121 | } 1122 | 1123 | /** 1124 | * Is fail clickable load manager. 1125 | * 1126 | * @param failClickable the fail clickable 1127 | * @return the load manager 1128 | */ 1129 | public LoadManager isFailClickable(Boolean failClickable) { 1130 | this.mIsFailClickable = failClickable; 1131 | return this; 1132 | } 1133 | 1134 | /** 1135 | * Is error net clickable boolean. 1136 | * 1137 | * @return the boolean 1138 | */ 1139 | public Boolean getErrorNetClickable() { 1140 | return mIsErrorNetClickable; 1141 | } 1142 | 1143 | /** 1144 | * Is error net clickable load manager. 1145 | * 1146 | * @param errorNetClickable the error net clickable 1147 | * @return the load manager 1148 | */ 1149 | public LoadManager isErrorNetClickable(Boolean errorNetClickable) { 1150 | this.mIsErrorNetClickable = errorNetClickable; 1151 | return this; 1152 | } 1153 | 1154 | /** 1155 | * Is empty clickable boolean. 1156 | * 1157 | * @return the boolean 1158 | */ 1159 | public Boolean getEmptyClickable() { 1160 | return mIsEmptyClickable; 1161 | } 1162 | 1163 | /** 1164 | * Is empty clickable load manager. 1165 | * 1166 | * @param emptyClickable the empty clickable 1167 | * @return the load manager 1168 | */ 1169 | public LoadManager isEmptyClickable(Boolean emptyClickable) { 1170 | this.mIsEmptyClickable = emptyClickable; 1171 | return this; 1172 | } 1173 | } 1174 | -------------------------------------------------------------------------------- /loadview/src/main/java/com/gyf/loadview/LoadStatus.java: -------------------------------------------------------------------------------- 1 | package com.gyf.loadview; 2 | 3 | /** 4 | * The enum Load status. 5 | * 6 | * @author geyifeng 7 | */ 8 | public enum LoadStatus { 9 | /** 10 | * 默认状态 11 | */ 12 | UNDO, 13 | /** 14 | * 加载中状态 15 | */ 16 | LOADING, 17 | /** 18 | * 失败状态 19 | */ 20 | FAIL, 21 | /** 22 | * 网络错误状态 23 | */ 24 | ERROR_NET, 25 | /** 26 | * 数据为空状态 27 | */ 28 | EMPTY, 29 | /** 30 | * 成功状态 31 | */ 32 | SUCCESS 33 | } 34 | -------------------------------------------------------------------------------- /loadview/src/main/java/com/gyf/loadview/LoadUtils.java: -------------------------------------------------------------------------------- 1 | package com.gyf.loadview; 2 | 3 | import android.content.Context; 4 | import android.util.TypedValue; 5 | 6 | /** 7 | * The type Load utils. 8 | * 9 | * @author geyifeng 10 | */ 11 | class LoadUtils { 12 | 13 | /** 14 | * 获得colorPrimary颜色 15 | * 16 | * @param context the context 17 | * @return the color primary 18 | */ 19 | public static int getColorPrimary(Context context) { 20 | TypedValue typedValue = new TypedValue(); 21 | context.getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true); 22 | return typedValue.data; 23 | } 24 | 25 | 26 | /** 27 | * 获取colorPrimaryDark颜色 28 | * 29 | * @param context the context 30 | * @return dark color primary 31 | */ 32 | public static int getDarkColorPrimary(Context context) { 33 | TypedValue typedValue = new TypedValue(); 34 | context.getTheme().resolveAttribute(R.attr.colorPrimaryDark, typedValue, true); 35 | return typedValue.data; 36 | } 37 | 38 | /** 39 | * 获得colorAccent颜色 40 | * 41 | * @param context the context 42 | * @return the dark color accent 43 | */ 44 | public static int getDarkColorAccent(Context context) { 45 | TypedValue typedValue = new TypedValue(); 46 | context.getTheme().resolveAttribute(R.attr.colorAccent, typedValue, true); 47 | return typedValue.data; 48 | } 49 | 50 | /** 51 | * sp转像素 52 | * 53 | * @param c the c 54 | * @param spValue the sp value 55 | * @return the int 56 | */ 57 | public static int sp2px(Context c, float spValue) { 58 | float fontScale = c.getResources().getDisplayMetrics().scaledDensity; 59 | return (int) (spValue * fontScale + 0.5f); 60 | } 61 | 62 | /** 63 | * 像素转sp 64 | * 65 | * @param c the c 66 | * @param pxValue the px value 67 | * @return the int 68 | */ 69 | public static int px2sp(Context c, float pxValue) { 70 | float fontScale = c.getResources().getDisplayMetrics().scaledDensity; 71 | return (int) (pxValue / fontScale + 0.5f); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /loadview/src/main/java/com/gyf/loadview/LoadView.java: -------------------------------------------------------------------------------- 1 | package com.gyf.loadview; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.content.res.TypedArray; 6 | import android.graphics.PorterDuff; 7 | import android.graphics.drawable.Drawable; 8 | import android.os.Build; 9 | import android.support.annotation.ColorInt; 10 | import android.support.annotation.DrawableRes; 11 | import android.support.annotation.LayoutRes; 12 | import android.support.annotation.NonNull; 13 | import android.support.annotation.Nullable; 14 | import android.util.AttributeSet; 15 | import android.util.TypedValue; 16 | import android.view.Gravity; 17 | import android.view.LayoutInflater; 18 | import android.view.View; 19 | import android.view.ViewGroup; 20 | import android.widget.FrameLayout; 21 | import android.widget.ImageView; 22 | import android.widget.LinearLayout; 23 | import android.widget.ProgressBar; 24 | import android.widget.TextView; 25 | 26 | /** 27 | * Load view. 28 | * 29 | * @author geyifeng 30 | */ 31 | public class LoadView extends FrameLayout { 32 | 33 | private Context mContext; 34 | 35 | private ImageView mImageView; 36 | private TextView mTextView; 37 | private LinearLayout mLinearLayout; 38 | private ProgressBar mProgressBar; 39 | private View mLoadView; 40 | 41 | /** 42 | * The current status. 43 | */ 44 | private LoadStatus mCurrentStatus; 45 | 46 | /** 47 | * The loading gravity. 48 | */ 49 | private int mLoadingGravity; 50 | /** 51 | * The image text gravity. 52 | */ 53 | private int mImageTextGravity; 54 | 55 | /** 56 | * The loading left margin. 57 | */ 58 | private int mLoadingLeftMargin; 59 | /** 60 | * The loading top margin. 61 | */ 62 | private int mLoadingTopMargin; 63 | /** 64 | * The loading right margin. 65 | */ 66 | private int mLoadingRightMargin; 67 | /** 68 | * The loading bottom margin. 69 | */ 70 | private int mLoadingBottomMargin; 71 | 72 | /** 73 | * The image text left margin. 74 | */ 75 | private int mImageTextLeftMargin; 76 | /** 77 | * The image text top margin. 78 | */ 79 | private int mImageTextTopMargin; 80 | /** 81 | * The image text right margin. 82 | */ 83 | private int mImageTextRightMargin; 84 | /** 85 | * The image text bottom margin. 86 | */ 87 | private int mImageTextBottomMargin; 88 | 89 | /** 90 | * The image left margin. 91 | */ 92 | private int mImageLeftMargin; 93 | /** 94 | * The image top margin. 95 | */ 96 | private int mImageTopMargin; 97 | /** 98 | * The image right margin. 99 | */ 100 | private int mImageRightMargin; 101 | /** 102 | * The image bottom margin. 103 | */ 104 | private int mImageBottomMargin; 105 | 106 | /** 107 | * The text left margin. 108 | */ 109 | private int mTextLeftMargin; 110 | /** 111 | * The text top margin. 112 | */ 113 | private int mTextTopMargin; 114 | /** 115 | * The text right margin. 116 | */ 117 | private int mTextRightMargin; 118 | /** 119 | * The text bottom margin. 120 | */ 121 | private int mTextBottomMargin; 122 | 123 | /** 124 | * The fail text. 125 | */ 126 | private CharSequence mFailText; 127 | /** 128 | * The error net text. 129 | */ 130 | private CharSequence mErrorNetText; 131 | /** 132 | * The empty text. 133 | */ 134 | private CharSequence mEmptyText; 135 | 136 | /** 137 | * The fail res. 138 | */ 139 | @DrawableRes 140 | private int mFailRes; 141 | /** 142 | * The error net res. 143 | */ 144 | @DrawableRes 145 | private int mErrorNetRes; 146 | /** 147 | * The empty res. 148 | */ 149 | @DrawableRes 150 | private int mEmptyRes; 151 | /** 152 | * The fail text color. 153 | */ 154 | @ColorInt 155 | private int mFailTextColor; 156 | /** 157 | * The error net text color. 158 | */ 159 | @ColorInt 160 | private int mErrorNetTextColor; 161 | /** 162 | * The empty text color. 163 | */ 164 | @ColorInt 165 | private int mEmptyTextColor; 166 | /** 167 | * The fail image color. 168 | */ 169 | @ColorInt 170 | private int mFailImageColor; 171 | /** 172 | * The error net image color. 173 | */ 174 | @ColorInt 175 | private int mErrorNetImageColor; 176 | /** 177 | * The empty image color. 178 | */ 179 | @ColorInt 180 | private int mEmptyImageColor; 181 | /** 182 | * The default loading color. 183 | */ 184 | @ColorInt 185 | private int mDefaultLoadingColor = 0; 186 | /** 187 | * The text size. 188 | */ 189 | private float mTextSize; 190 | 191 | /** 192 | * The fail image color enabled. 193 | */ 194 | private boolean mFailImageColorEnabled; 195 | /** 196 | * The error net image color enabled. 197 | */ 198 | private boolean mErrorNetImageColorEnabled; 199 | /** 200 | * The empty image color enabled. 201 | */ 202 | private boolean mEmptyImageColorEnabled; 203 | private OnLoadFailClickListener mOnLoadFailClickListener; 204 | private OnLoadErrorNetClickListener mOnLoadErrorNetClickListener; 205 | private OnLoadEmptyClickListener mOnLoadEmptyClickListener; 206 | 207 | /** 208 | * The on loading listener. 209 | */ 210 | private OnLoadingListener mOnLoadingListener; 211 | /** 212 | * The is loading. 213 | */ 214 | private boolean mIsLoading; 215 | /** 216 | * The loading view width. 217 | */ 218 | private float mLoadingViewWidth; 219 | /** 220 | * The loading view height. 221 | */ 222 | private float mLoadingViewHeight; 223 | 224 | /** 225 | * The M image view width. 226 | */ 227 | private float mImageViewWidth; 228 | /** 229 | * The M image view height. 230 | */ 231 | private float mImageViewHeight; 232 | 233 | /** 234 | * The M is loading clickable. 235 | */ 236 | private Boolean mIsLoadingClickable; 237 | 238 | private Boolean mIsFailClickable; 239 | 240 | private Boolean mIsErrorNetClickable; 241 | 242 | private Boolean mIsEmptyClickable; 243 | 244 | /** 245 | * Instantiates a new Load view. 246 | * 247 | * @param context the context 248 | */ 249 | public LoadView(@NonNull Context context) { 250 | this(context, null); 251 | } 252 | 253 | /** 254 | * Instantiates a new Load view. 255 | * 256 | * @param context the context 257 | * @param attrs the attrs 258 | */ 259 | public LoadView(@NonNull Context context, @Nullable AttributeSet attrs) { 260 | super(context, attrs); 261 | mContext = context; 262 | TypedArray typedArray = mContext.obtainStyledAttributes(attrs, R.styleable.LoadView); 263 | 264 | //初始化当前状态 265 | initCurrentStatus(typedArray.getInt(R.styleable.LoadView_load_current_status, 0)); 266 | 267 | //获得Loading的Gravity 268 | mLoadingGravity = typedArray.getInt(R.styleable.LoadView_load_loading_gravity, 269 | typedArray.getInt(R.styleable.LoadView_load_gravity, 270 | LoadManager.getInstance().getLoadingGravity())); 271 | //获得ImageText的Gravity 272 | mImageTextGravity = typedArray.getInt(R.styleable.LoadView_load_image_text_gravity, 273 | typedArray.getInt(R.styleable.LoadView_load_gravity, 274 | LoadManager.getInstance().getImageTextGravity())); 275 | 276 | //获得Loading的Margin 277 | mLoadingLeftMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_loading_margin_left, 278 | typedArray.getDimension(R.styleable.LoadView_load_loading_margin, 279 | typedArray.getDimension(R.styleable.LoadView_load_margin_left, 280 | typedArray.getDimension(R.styleable.LoadView_load_margin, 281 | LoadManager.getInstance().getLoadingLeftMargin())))); 282 | mLoadingTopMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_loading_margin_top, 283 | typedArray.getDimension(R.styleable.LoadView_load_loading_margin, 284 | typedArray.getDimension(R.styleable.LoadView_load_margin_top, 285 | typedArray.getDimension(R.styleable.LoadView_load_margin, 286 | LoadManager.getInstance().getLoadingTopMargin())))); 287 | mLoadingRightMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_loading_margin_right, 288 | typedArray.getDimension(R.styleable.LoadView_load_loading_margin, 289 | typedArray.getDimension(R.styleable.LoadView_load_margin_right, 290 | typedArray.getDimension(R.styleable.LoadView_load_margin, 291 | LoadManager.getInstance().getLoadingRightMargin())))); 292 | mLoadingBottomMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_loading_margin_bottom, 293 | typedArray.getDimension(R.styleable.LoadView_load_loading_margin, 294 | typedArray.getDimension(R.styleable.LoadView_load_margin_bottom, 295 | typedArray.getDimension(R.styleable.LoadView_load_margin, 296 | LoadManager.getInstance().getLoadingBottomMargin())))); 297 | 298 | //获得ImageText的Margin 299 | mImageTextLeftMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_text_margin_left, 300 | typedArray.getDimension(R.styleable.LoadView_load_image_text_margin, 301 | typedArray.getDimension(R.styleable.LoadView_load_margin_left, 302 | typedArray.getDimension(R.styleable.LoadView_load_margin, 303 | LoadManager.getInstance().getImageTextLeftMargin())))); 304 | mImageTextTopMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_text_margin_top, 305 | typedArray.getDimension(R.styleable.LoadView_load_image_text_margin, 306 | typedArray.getDimension(R.styleable.LoadView_load_margin_top, 307 | typedArray.getDimension(R.styleable.LoadView_load_margin, 308 | LoadManager.getInstance().getImageTextTopMargin())))); 309 | mImageTextRightMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_text_margin_right, 310 | typedArray.getDimension(R.styleable.LoadView_load_image_text_margin, 311 | typedArray.getDimension(R.styleable.LoadView_load_margin_right, 312 | typedArray.getDimension(R.styleable.LoadView_load_margin, 313 | LoadManager.getInstance().getImageTextRightMargin())))); 314 | mImageTextBottomMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_text_margin_bottom, 315 | typedArray.getDimension(R.styleable.LoadView_load_image_text_margin, 316 | typedArray.getDimension(R.styleable.LoadView_load_margin_bottom, 317 | typedArray.getDimension(R.styleable.LoadView_load_margin, 318 | LoadManager.getInstance().getImageTextBottomMargin())))); 319 | 320 | //获得Image的Margin 321 | mImageLeftMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_margin_left, 322 | typedArray.getDimension(R.styleable.LoadView_load_image_margin, 323 | LoadManager.getInstance().getImageLeftMargin())); 324 | mImageTopMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_margin_top, 325 | typedArray.getDimension(R.styleable.LoadView_load_image_margin, 326 | LoadManager.getInstance().getImageTopMargin())); 327 | mImageRightMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_margin_right, 328 | typedArray.getDimension(R.styleable.LoadView_load_image_margin, 329 | LoadManager.getInstance().getImageRightMargin())); 330 | mImageBottomMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_image_margin_bottom, 331 | typedArray.getDimension(R.styleable.LoadView_load_image_margin, 332 | LoadManager.getInstance().getImageBottomMargin())); 333 | 334 | //获得Text的Margin 335 | mTextLeftMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_text_margin_left, 336 | typedArray.getDimension(R.styleable.LoadView_load_text_margin, 337 | LoadManager.getInstance().getTextLeftMargin())); 338 | mTextTopMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_text_margin_top, 339 | typedArray.getDimension(R.styleable.LoadView_load_text_margin, 340 | LoadManager.getInstance().getTextTopMargin())); 341 | mTextRightMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_text_margin_right, 342 | typedArray.getDimension(R.styleable.LoadView_load_text_margin, 343 | LoadManager.getInstance().getTextRightMargin())); 344 | mTextBottomMargin = (int) typedArray.getDimension(R.styleable.LoadView_load_text_margin_bottom, 345 | typedArray.getDimension(R.styleable.LoadView_load_text_margin, 346 | LoadManager.getInstance().getTextBottomMargin())); 347 | 348 | //获得加载失败显示的文字 349 | String failText = typedArray.getString(R.styleable.LoadView_load_text_fail); 350 | mFailText = failText != null ? failText : LoadManager.getInstance().getFailText(); 351 | 352 | //获得加载网络错误显示的文字 353 | String errorNetText = typedArray.getString(R.styleable.LoadView_load_text_error_net); 354 | mErrorNetText = errorNetText != null ? errorNetText : LoadManager.getInstance().getErrorNetText(); 355 | 356 | //获得加载数据为空显示的文字 357 | String emptyText = typedArray.getString(R.styleable.LoadView_load_text_empty); 358 | mEmptyText = emptyText != null ? emptyText : LoadManager.getInstance().getEmptyText(); 359 | 360 | //获得加载失败显示的图片 361 | mFailRes = typedArray.getResourceId(R.styleable.LoadView_load_image_fail, 362 | LoadManager.getInstance().getFailRes()); 363 | 364 | //获得加载网络错误显示的图片 365 | mErrorNetRes = typedArray.getResourceId(R.styleable.LoadView_load_image_error_net, 366 | LoadManager.getInstance().getErrorNetRes()); 367 | 368 | //获得加载数据为空显示的图片 369 | mEmptyRes = typedArray.getResourceId(R.styleable.LoadView_load_image_empty, 370 | LoadManager.getInstance().getEmptyRes()); 371 | 372 | //获得加载失败显示的文字颜色 373 | mFailTextColor = typedArray.getColor(R.styleable.LoadView_load_text_color_fail, 374 | typedArray.getColor(R.styleable.LoadView_load_text_color, 375 | LoadManager.getInstance().getFailTextColor())); 376 | 377 | //获得加载网络错误显示的文字颜色 378 | mErrorNetTextColor = typedArray.getColor(R.styleable.LoadView_load_text_color_error_net, 379 | typedArray.getColor(R.styleable.LoadView_load_text_color, 380 | LoadManager.getInstance().getErrorNetTextColor())); 381 | 382 | //获得加载数据为空显示的文字颜色 383 | mEmptyTextColor = typedArray.getColor(R.styleable.LoadView_load_text_color_empty, 384 | typedArray.getColor(R.styleable.LoadView_load_text_color, 385 | LoadManager.getInstance().getEmptyTextColor())); 386 | 387 | //获得加载失败显示的图片颜色 388 | mFailImageColor = typedArray.getColor(R.styleable.LoadView_load_image_color_fail, 389 | typedArray.getColor(R.styleable.LoadView_load_image_color, 390 | LoadManager.getInstance().getFailImageColor())); 391 | 392 | //获得加载网络错误显示的图片颜色 393 | mErrorNetImageColor = typedArray.getColor(R.styleable.LoadView_load_image_color_error_net, 394 | typedArray.getColor(R.styleable.LoadView_load_image_color, 395 | LoadManager.getInstance().getErrorNetImageColor())); 396 | 397 | //获得加载数据为空显示的图片颜色 398 | mEmptyImageColor = typedArray.getColor(R.styleable.LoadView_load_image_color_empty, 399 | typedArray.getColor(R.styleable.LoadView_load_image_color, 400 | LoadManager.getInstance().getEmptyImageColor())); 401 | 402 | //文字的大小 403 | mTextSize = typedArray.getDimension(R.styleable.LoadView_load_text_size, 404 | LoadUtils.sp2px(mContext, LoadManager.getInstance().getTextSize())); 405 | 406 | //默认loading的颜色 407 | mDefaultLoadingColor = typedArray.getColor(R.styleable.LoadView_load_default_loading_color, 408 | LoadManager.getInstance().getDefaultLoadingColor()); 409 | if (mDefaultLoadingColor == 0) { 410 | mDefaultLoadingColor = LoadUtils.getDarkColorAccent(context); 411 | } 412 | 413 | //加载失败图片的颜色是否可以修改,默认不可以 414 | mFailImageColorEnabled = typedArray.getBoolean(R.styleable.LoadView_load_image_color_fail_enabled, 415 | typedArray.getBoolean(R.styleable.LoadView_load_image_color_enabled, 416 | LoadManager.getInstance().isFailImageColorEnabled())); 417 | //加载w网络失败图片的颜色是否可以修改,默认不可以 418 | mErrorNetImageColorEnabled = typedArray.getBoolean(R.styleable.LoadView_load_image_color_error_net_enabled, 419 | typedArray.getBoolean(R.styleable.LoadView_load_image_color_enabled, 420 | LoadManager.getInstance().isErrorNetImageColorEnabled())); 421 | //加载数据为空图片的颜色是否可以修改,默认不可以 422 | mEmptyImageColorEnabled = typedArray.getBoolean(R.styleable.LoadView_load_image_color_empty_enabled, 423 | typedArray.getBoolean(R.styleable.LoadView_load_image_color_enabled, 424 | LoadManager.getInstance().isEmptyImageColorEnabled())); 425 | 426 | //图片的宽度 427 | mImageViewWidth = typedArray.getDimension(R.styleable.LoadView_load_image_width, LoadManager.getInstance().getImageViewWidth()); 428 | //图片的高度 429 | mImageViewHeight = typedArray.getDimension(R.styleable.LoadView_load_image_height, LoadManager.getInstance().getImageViewHeight()); 430 | 431 | //loading的宽度 432 | mLoadingViewWidth = typedArray.getDimension(R.styleable.LoadView_load_loading_width, LoadManager.getInstance().getLoadingViewWidth()); 433 | //loading的高度 434 | mLoadingViewHeight = typedArray.getDimension(R.styleable.LoadView_load_loading_height, LoadManager.getInstance().getLoadingViewHeight()); 435 | 436 | //加载中,焦点是否在LoadView中 437 | mIsLoadingClickable = typedArray.getBoolean(R.styleable.LoadView_load_loading_clickable, 438 | typedArray.getBoolean(R.styleable.LoadView_load_clickable, 439 | LoadManager.getInstance().getLoadingClickable())); 440 | //加载失败,焦点是否在LoadView中 441 | mIsFailClickable = typedArray.getBoolean(R.styleable.LoadView_load_fail_clickable, 442 | typedArray.getBoolean(R.styleable.LoadView_load_clickable, 443 | LoadManager.getInstance().getFailClickable())); 444 | //加载网络错误,焦点是否在LoadView中 445 | mIsErrorNetClickable = typedArray.getBoolean(R.styleable.LoadView_load_error_net_clickable, 446 | typedArray.getBoolean(R.styleable.LoadView_load_clickable, 447 | LoadManager.getInstance().getErrorNetClickable())); 448 | //加载数据为空,焦点是否在LoadView中 449 | mIsEmptyClickable = typedArray.getBoolean(R.styleable.LoadView_load_empty_clickable, 450 | typedArray.getBoolean(R.styleable.LoadView_load_clickable, 451 | LoadManager.getInstance().getEmptyClickable())); 452 | 453 | initView(); 454 | typedArray.recycle(); 455 | } 456 | 457 | 458 | @Override 459 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 460 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 461 | int childCount = getChildCount(); 462 | if (childCount > 3) { 463 | throw new IllegalStateException("LoadView can host only one ‘Loading’ child view"); 464 | } 465 | if (childCount == 3) { 466 | View loadingChild = getChildAt(2); 467 | removeView(loadingChild); 468 | removeView(getChildAt(1)); 469 | addView(loadingChild); 470 | mLoadView = loadingChild; 471 | mLoadingViewWidth = mLoadView.getMeasuredWidth(); 472 | mLoadingViewHeight = mLoadView.getMeasuredHeight(); 473 | changeView(); 474 | } 475 | 476 | for (int i = 0; i < getChildCount(); i++) { 477 | LayoutParams params = (LayoutParams) getChildAt(i).getLayoutParams(); 478 | if (i == 0) { 479 | params.width = LayoutParams.WRAP_CONTENT; 480 | params.height = LayoutParams.WRAP_CONTENT; 481 | } else if (i == 1) { 482 | params.width = (int) mLoadingViewWidth; 483 | params.height = (int) mLoadingViewHeight; 484 | } 485 | } 486 | 487 | setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 488 | MeasureSpec.getSize(heightMeasureSpec)); 489 | } 490 | 491 | @Override 492 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 493 | setLayout(); 494 | super.onLayout(changed, left, top, right, bottom); 495 | } 496 | 497 | private void initView() { 498 | 499 | mImageView = new ImageView(mContext); 500 | 501 | mTextView = new TextView(mContext); 502 | mTextView.setGravity(Gravity.CENTER); 503 | 504 | mLinearLayout = new LinearLayout(mContext); 505 | mLinearLayout.setOrientation(LinearLayout.VERTICAL); 506 | mLinearLayout.setClickable(true); 507 | 508 | mLinearLayout.addView(mImageView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 509 | mLinearLayout.addView(mTextView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 510 | mLinearLayout.setOnClickListener(new MyOnClickListener()); 511 | 512 | setImageTextSize(); 513 | 514 | addView(mLinearLayout, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 515 | 516 | 517 | if (LoadManager.getInstance().getLoadingLayoutId() != 0) { 518 | mLoadView = LayoutInflater.from(mContext).inflate(LoadManager.getInstance(). 519 | getLoadingLayoutId(), this, false); 520 | } 521 | if (mLoadView == null) { 522 | mProgressBar = new ProgressBar(mContext); 523 | setDefaultLoadingColor(); 524 | mLoadView = mProgressBar; 525 | } 526 | addView(mLoadView, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); 527 | setLayout(); 528 | changeView(); 529 | } 530 | 531 | private void setLayout() { 532 | int childCount = getChildCount(); 533 | for (int i = 0; i < childCount; i++) { 534 | View childView = getChildAt(i); 535 | LayoutParams params = (LayoutParams) childView.getLayoutParams(); 536 | if (i == 0) { 537 | params.gravity = mImageTextGravity; 538 | params.setMargins(mImageTextLeftMargin, mImageTextTopMargin, 539 | mImageTextRightMargin, mImageTextBottomMargin); 540 | } 541 | if (i == 1) { 542 | params.gravity = mLoadingGravity; 543 | params.setMargins(mLoadingLeftMargin, mLoadingTopMargin, 544 | mLoadingRightMargin, mLoadingBottomMargin); 545 | } 546 | } 547 | } 548 | 549 | private void changeView() { 550 | switch (mCurrentStatus) { 551 | case UNDO: 552 | case SUCCESS: 553 | setClickable(false); 554 | mLinearLayout.setVisibility(GONE); 555 | mLoadView.setVisibility(GONE); 556 | mLinearLayout.setClickable(false); 557 | loadingEnd(); 558 | break; 559 | case LOADING: 560 | setClickable(mIsLoadingClickable); 561 | mLinearLayout.setVisibility(GONE); 562 | mLoadView.setVisibility(VISIBLE); 563 | mLinearLayout.setClickable(false); 564 | loadingStart(); 565 | break; 566 | case FAIL: 567 | setClickable(mIsFailClickable); 568 | mImageView.setImageResource(mFailRes); 569 | if (mFailImageColorEnabled) { 570 | setImageDrawable(mFailImageColor); 571 | } 572 | mTextView.setText(mFailText); 573 | mTextView.setTextColor(mFailTextColor); 574 | mLinearLayout.setVisibility(VISIBLE); 575 | mLoadView.setVisibility(GONE); 576 | mLinearLayout.setClickable(true); 577 | loadingEnd(); 578 | break; 579 | case ERROR_NET: 580 | setClickable(mIsErrorNetClickable); 581 | mImageView.setImageResource(mErrorNetRes); 582 | if (mErrorNetImageColorEnabled) { 583 | setImageDrawable(mErrorNetImageColor); 584 | } 585 | mTextView.setText(mErrorNetText); 586 | mTextView.setTextColor(mErrorNetTextColor); 587 | mLinearLayout.setVisibility(VISIBLE); 588 | mLoadView.setVisibility(GONE); 589 | mLinearLayout.setClickable(true); 590 | loadingEnd(); 591 | break; 592 | case EMPTY: 593 | setClickable(mIsEmptyClickable); 594 | mImageView.setImageResource(mEmptyRes); 595 | if (mEmptyImageColorEnabled) { 596 | setImageDrawable(mEmptyImageColor); 597 | } 598 | mTextView.setText(mEmptyText); 599 | mTextView.setTextColor(mEmptyTextColor); 600 | mLinearLayout.setVisibility(VISIBLE); 601 | mLoadView.setVisibility(GONE); 602 | mLinearLayout.setClickable(true); 603 | loadingEnd(); 604 | break; 605 | default: 606 | break; 607 | } 608 | changeImageTextView(); 609 | } 610 | 611 | private void loadingStart() { 612 | if (mOnLoadingListener != null && !mIsLoading) { 613 | mIsLoading = true; 614 | mOnLoadingListener.onLoadingStart(mLoadView); 615 | } 616 | } 617 | 618 | private void loadingEnd() { 619 | if (mOnLoadingListener != null && mIsLoading) { 620 | mIsLoading = false; 621 | mOnLoadingListener.onLoadingEnd(mLoadView); 622 | } 623 | } 624 | 625 | private void changeImageTextView() { 626 | LinearLayout.LayoutParams imageParams = (LinearLayout.LayoutParams) mImageView.getLayoutParams(); 627 | imageParams.setMargins(mImageLeftMargin, mImageTopMargin, mImageRightMargin, mImageBottomMargin); 628 | mImageView.setLayoutParams(imageParams); 629 | mImageView.setVisibility(mImageView.getDrawable() == null ? GONE : VISIBLE); 630 | 631 | LinearLayout.LayoutParams textParams = (LinearLayout.LayoutParams) mTextView.getLayoutParams(); 632 | textParams.setMargins(mTextLeftMargin, mTextTopMargin, mTextRightMargin, mTextBottomMargin); 633 | mTextView.setLayoutParams(textParams); 634 | mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); 635 | mTextView.setVisibility("".equals(mTextView.getText().toString().trim()) ? GONE : VISIBLE); 636 | } 637 | 638 | 639 | /** 640 | * 设置当前loadView的状态 641 | * 642 | * @param loadStatus the load status 643 | */ 644 | public void setCurrentStatus(LoadStatus loadStatus) { 645 | mCurrentStatus = loadStatus; 646 | changeView(); 647 | } 648 | 649 | /** 650 | * 获得当前loadView的状态 651 | * 652 | * @return the current status 653 | */ 654 | public LoadStatus getCurrentStatus() { 655 | return mCurrentStatus; 656 | } 657 | 658 | /** 659 | * 设置加载中的view 660 | * 661 | * @param layoutId the layout id 662 | */ 663 | public void setLoadingView(@LayoutRes int layoutId) { 664 | setLoadingView(LayoutInflater.from(mContext).inflate(layoutId, this, false), 665 | (int) mLoadingViewWidth, 666 | (int) mLoadingViewHeight); 667 | } 668 | 669 | /** 670 | * 设置加载中的view 671 | * 672 | * @param layoutId the layout id 673 | * @param width the width 674 | * @param height the height 675 | */ 676 | public void setLoadingView(@LayoutRes int layoutId, int width, int height) { 677 | setLoadingView(LayoutInflater.from(mContext).inflate(layoutId, this, false), width, height); 678 | } 679 | 680 | /** 681 | * 设置加载中的view 682 | * 683 | * @param view the view 684 | */ 685 | public void setLoadingView(View view) { 686 | setLoadingView(view, (int) mLoadingViewWidth, (int) mLoadingViewHeight); 687 | } 688 | 689 | /** 690 | * 设置加载中的view 691 | * 692 | * @param view the view 693 | * @param width the width 单位px 694 | * @param height the height 单位px 695 | */ 696 | public void setLoadingView(View view, int width, int height) { 697 | if (!mIsLoading) { 698 | mLoadingViewWidth = width; 699 | mLoadingViewHeight = height; 700 | removeView(mLoadView); 701 | this.mLoadView = view; 702 | addView(mLoadView); 703 | changeView(); 704 | } 705 | } 706 | 707 | /** 708 | * Sets loading view size. 709 | * 710 | * @param width the width 711 | * @param height the height 712 | */ 713 | public void setLoadingViewSize(int width, int height) { 714 | mLoadingViewWidth = width; 715 | mLoadingViewHeight = height; 716 | requestLayout(); 717 | } 718 | 719 | /** 720 | * 设置失败的图片资源 721 | * 722 | * @param failRes the fail res 723 | */ 724 | public void setFailRes(@DrawableRes int failRes) { 725 | this.mFailRes = failRes; 726 | changeView(); 727 | } 728 | 729 | /** 730 | * 设置网络错误的图片资源 731 | * 732 | * @param errorNetRes the error net res 733 | */ 734 | public void setErrorNetRes(@DrawableRes int errorNetRes) { 735 | this.mErrorNetRes = errorNetRes; 736 | changeView(); 737 | } 738 | 739 | 740 | /** 741 | * 设置无数据的图片资源 742 | * 743 | * @param emptyRes the empty res 744 | */ 745 | public void setEmptyRes(@DrawableRes int emptyRes) { 746 | this.mEmptyRes = emptyRes; 747 | changeView(); 748 | } 749 | 750 | /** 751 | * 设置加载失败文字 752 | * 753 | * @param failText the fail text 754 | */ 755 | public void setFailText(CharSequence failText) { 756 | this.mFailText = failText; 757 | changeView(); 758 | } 759 | 760 | /** 761 | * 设置加载网络错误文字 762 | * 763 | * @param errorNetText the error net text 764 | */ 765 | public void setErrorNetText(CharSequence errorNetText) { 766 | this.mErrorNetText = errorNetText; 767 | changeView(); 768 | } 769 | 770 | /** 771 | * 设置加载为空文字 772 | * 773 | * @param emptyText the empty text 774 | */ 775 | public void setEmptyText(CharSequence emptyText) { 776 | this.mEmptyText = emptyText; 777 | changeView(); 778 | } 779 | 780 | /** 781 | * 设置文字的颜色 782 | * 783 | * @param textColor the text color 784 | */ 785 | public void setTextColor(@ColorInt int textColor) { 786 | mFailTextColor = textColor; 787 | mErrorNetTextColor = textColor; 788 | mEmptyTextColor = textColor; 789 | changeView(); 790 | } 791 | 792 | /** 793 | * 设置失败展示的字体颜色 794 | * 795 | * @param failTextColor the fail text color 796 | */ 797 | public void setFailTextColor(@ColorInt int failTextColor) { 798 | this.mFailTextColor = failTextColor; 799 | changeView(); 800 | } 801 | 802 | /** 803 | * 设置网络加载错误展示的字体颜色 804 | * 805 | * @param errorNetTextColor the error net text color 806 | */ 807 | public void setErrorNetTextColor(@ColorInt int errorNetTextColor) { 808 | this.mErrorNetTextColor = errorNetTextColor; 809 | changeView(); 810 | } 811 | 812 | /** 813 | * 设置数据为空展示的字体颜色 814 | * 815 | * @param emptyTextColor the empty text color 816 | */ 817 | public void setEmptyTextColor(@ColorInt int emptyTextColor) { 818 | this.mEmptyTextColor = emptyTextColor; 819 | changeView(); 820 | } 821 | 822 | /** 823 | * 设置图片的颜色 824 | * 825 | * @param imageColor the image color 826 | */ 827 | public void setImageColor(@ColorInt int imageColor) { 828 | this.mFailImageColor = imageColor; 829 | this.mErrorNetImageColor = imageColor; 830 | this.mEmptyImageColor = imageColor; 831 | changeView(); 832 | } 833 | 834 | /** 835 | * 设置失败图片的颜色 836 | * 837 | * @param failImageColor the fail image color 838 | */ 839 | public void setFailImageColor(@ColorInt int failImageColor) { 840 | this.mFailImageColor = failImageColor; 841 | changeView(); 842 | } 843 | 844 | /** 845 | * 设置网络错误图片的颜色 846 | * 847 | * @param errorNetImageColor the error net image color 848 | */ 849 | public void setErrorNetImageColor(@ColorInt int errorNetImageColor) { 850 | this.mErrorNetImageColor = errorNetImageColor; 851 | changeView(); 852 | } 853 | 854 | /** 855 | * 设置数据为空图片的颜色 856 | * 857 | * @param emptyImageColor the empty image color 858 | */ 859 | public void setEmptyImageColor(@ColorInt int emptyImageColor) { 860 | this.mEmptyImageColor = emptyImageColor; 861 | changeView(); 862 | } 863 | 864 | /** 865 | * 设置默认的loading的颜色 866 | * 867 | * @param defaultLoadingColor the default loading color 868 | */ 869 | public void setDefaultLoadingColor(@ColorInt int defaultLoadingColor) { 870 | this.mDefaultLoadingColor = defaultLoadingColor; 871 | setDefaultLoadingColor(); 872 | changeView(); 873 | } 874 | 875 | /** 876 | * android 5.0 支持修改progressBar颜色 877 | */ 878 | private void setDefaultLoadingColor() { 879 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 880 | ColorStateList colorStateList = ColorStateList.valueOf(mDefaultLoadingColor); 881 | mProgressBar.setIndeterminateTintList(colorStateList); 882 | mProgressBar.setIndeterminateTintMode(PorterDuff.Mode.SRC_ATOP); 883 | } 884 | } 885 | 886 | /** 887 | * 设置字体大小,单位sp 888 | * 889 | * @param textSize the text size 890 | */ 891 | public void setTextSize(int textSize) { 892 | this.mTextSize = LoadUtils.sp2px(mContext, textSize); 893 | changeView(); 894 | } 895 | 896 | /** 897 | * 设置图片的颜色 898 | * 899 | * @param color the color 900 | */ 901 | private void setImageDrawable(@ColorInt int color) { 902 | Drawable drawable = mImageView.getDrawable(); 903 | if (drawable != null) { 904 | drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN); 905 | mImageView.setImageDrawable(drawable); 906 | } 907 | } 908 | 909 | /** 910 | * 设置是否可以修改图片的颜色 911 | * 912 | * @param imageColorEnabled the image color enabled 913 | */ 914 | public void setImageColorEnabled(boolean imageColorEnabled) { 915 | this.mFailImageColorEnabled = imageColorEnabled; 916 | this.mErrorNetImageColorEnabled = imageColorEnabled; 917 | this.mEmptyImageColorEnabled = imageColorEnabled; 918 | changeView(); 919 | } 920 | 921 | /** 922 | * 设置是否可以修改失败图片的颜色 923 | * 924 | * @param failImageColorEnabled the fail image color enabled 925 | */ 926 | public void setFailImageColorEnabled(boolean failImageColorEnabled) { 927 | this.mFailImageColorEnabled = failImageColorEnabled; 928 | changeView(); 929 | } 930 | 931 | /** 932 | * 设置是否可以修改网络错误图片的颜色 933 | * 934 | * @param errorNetImageColorEnabled the error net image color enabled 935 | */ 936 | public void setErrorNetImageColorEnabled(boolean errorNetImageColorEnabled) { 937 | this.mErrorNetImageColorEnabled = errorNetImageColorEnabled; 938 | changeView(); 939 | } 940 | 941 | /** 942 | * 设置是否可以修改数据为空图片的颜色 943 | * 944 | * @param emptyImageColorEnabled the empty image color enabled 945 | */ 946 | public void setEmptyImageColorEnabled(boolean emptyImageColorEnabled) { 947 | this.mEmptyImageColorEnabled = emptyImageColorEnabled; 948 | changeView(); 949 | } 950 | 951 | /** 952 | * Sets margins.单位px 953 | * 954 | * @param left the left 955 | * @param top the top 956 | * @param right the right 957 | * @param bottom the bottom 958 | */ 959 | public void setMargins(int left, int top, int right, int bottom) { 960 | mImageTextLeftMargin = left; 961 | mImageTextTopMargin = top; 962 | mImageTextRightMargin = right; 963 | mImageTextBottomMargin = bottom; 964 | 965 | mLoadingLeftMargin = left; 966 | mLoadingTopMargin = top; 967 | mLoadingRightMargin = right; 968 | mLoadingBottomMargin = bottom; 969 | 970 | requestLayout(); 971 | } 972 | 973 | /** 974 | * Sets image text margins.单位px 975 | * 976 | * @param left the left 977 | * @param top the top 978 | * @param right the right 979 | * @param bottom the bottom 980 | */ 981 | public void setImageTextMargins(int left, int top, int right, int bottom) { 982 | mImageTextLeftMargin = left; 983 | mImageTextTopMargin = top; 984 | mImageTextRightMargin = right; 985 | mImageTextBottomMargin = bottom; 986 | 987 | requestLayout(); 988 | } 989 | 990 | /** 991 | * Sets loading margins.单位px 992 | * 993 | * @param left the left 994 | * @param top the top 995 | * @param right the right 996 | * @param bottom the bottom 997 | */ 998 | public void setLoadingMargins(int left, int top, int right, int bottom) { 999 | mLoadingLeftMargin = left; 1000 | mLoadingTopMargin = top; 1001 | mLoadingRightMargin = right; 1002 | mLoadingBottomMargin = bottom; 1003 | 1004 | requestLayout(); 1005 | } 1006 | 1007 | /** 1008 | * Sets imageView margins.单位px 1009 | * 1010 | * @param left the left 1011 | * @param top the top 1012 | * @param right the right 1013 | * @param bottom the bottom 1014 | */ 1015 | public void setImageMargins(int left, int top, int right, int bottom) { 1016 | mImageLeftMargin = left; 1017 | mImageTopMargin = top; 1018 | mImageRightMargin = right; 1019 | mImageBottomMargin = bottom; 1020 | changeView(); 1021 | } 1022 | 1023 | /** 1024 | * Sets textView margins.单位px 1025 | * 1026 | * @param left the left 1027 | * @param top the top 1028 | * @param right the right 1029 | * @param bottom the bottom 1030 | */ 1031 | public void setTextMargins(int left, int top, int right, int bottom) { 1032 | mTextLeftMargin = left; 1033 | mTextTopMargin = top; 1034 | mTextRightMargin = right; 1035 | mTextBottomMargin = bottom; 1036 | changeView(); 1037 | } 1038 | 1039 | /** 1040 | * 设置图片的大小 1041 | * 1042 | * @param imageWidth the image width 1043 | * @param imageHeight the image height 1044 | */ 1045 | public void setImageViewSize(float imageWidth, float imageHeight) { 1046 | this.mImageViewWidth = imageWidth; 1047 | this.mImageViewHeight = imageHeight; 1048 | setImageTextSize(); 1049 | } 1050 | 1051 | /** 1052 | * 设置布局的位置 1053 | * 1054 | * @param gravity the gravity 1055 | */ 1056 | public void setGravity(int gravity) { 1057 | gravity = getCommonGravity(gravity); 1058 | if (gravity != mLoadingGravity || gravity != mImageTextGravity) { 1059 | requestLayout(); 1060 | } 1061 | mLoadingGravity = gravity; 1062 | mImageTextGravity = gravity; 1063 | } 1064 | 1065 | /** 1066 | * 设置Loading布局的位置 1067 | * 1068 | * @param gravity the gravity 1069 | */ 1070 | public void setLoadingGravity(int gravity) { 1071 | gravity = getCommonGravity(gravity); 1072 | if (gravity != mLoadingGravity) { 1073 | requestLayout(); 1074 | } 1075 | mLoadingGravity = gravity; 1076 | } 1077 | 1078 | /** 1079 | * 设置图片和文字布局的位置 1080 | * 1081 | * @param gravity the gravity 1082 | */ 1083 | public void setImageTextGravity(int gravity) { 1084 | gravity = getCommonGravity(gravity); 1085 | if (gravity != mImageTextGravity) { 1086 | requestLayout(); 1087 | } 1088 | mImageTextGravity = gravity; 1089 | } 1090 | 1091 | /** 1092 | * 焦点是否在LoadView中 1093 | * 1094 | * @param clickable the clickable 1095 | */ 1096 | public void isLoadClickable(Boolean clickable) { 1097 | this.mIsLoadingClickable = clickable; 1098 | this.mIsFailClickable = clickable; 1099 | this.mIsErrorNetClickable = clickable; 1100 | this.mIsEmptyClickable = clickable; 1101 | changeView(); 1102 | } 1103 | 1104 | /** 1105 | * 设置加载中,焦点是否在LoadView中 1106 | * 1107 | * @param loadingClickable the loadingClickable 1108 | */ 1109 | public void isLoadingClickable(Boolean loadingClickable) { 1110 | this.mIsLoadingClickable = loadingClickable; 1111 | changeView(); 1112 | } 1113 | 1114 | /** 1115 | * 设置加载失败,焦点是否在LoadView中 1116 | * 1117 | * @param failClickable the fail clickable 1118 | */ 1119 | public void isFailClickable(Boolean failClickable) { 1120 | this.mIsFailClickable = failClickable; 1121 | changeView(); 1122 | } 1123 | 1124 | /** 1125 | * 设置加载网络错误,焦点是否在LoadView中 1126 | * 1127 | * @param errorNetClickable the error net clickable 1128 | */ 1129 | public void isErrorNetClickable(Boolean errorNetClickable) { 1130 | this.mIsErrorNetClickable = errorNetClickable; 1131 | changeView(); 1132 | } 1133 | 1134 | /** 1135 | * 设置加载数据为空,焦点是否在LoadView中 1136 | * 1137 | * @param emptyClickable the empty clickable 1138 | */ 1139 | public void isEmptyClickable(Boolean emptyClickable) { 1140 | this.mIsEmptyClickable = emptyClickable; 1141 | changeView(); 1142 | } 1143 | 1144 | private int getCommonGravity(int gravity) { 1145 | if ((gravity & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) == 0) { 1146 | gravity |= Gravity.START; 1147 | } 1148 | if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == 0) { 1149 | gravity |= Gravity.TOP; 1150 | } 1151 | return gravity; 1152 | } 1153 | 1154 | 1155 | /** 1156 | * 设置失败回调监听 1157 | * 1158 | * @param listener the listener 1159 | */ 1160 | public void setOnFailClickListener(final OnLoadFailClickListener listener) { 1161 | mOnLoadFailClickListener = listener; 1162 | } 1163 | 1164 | /** 1165 | * 加载失败时的监听 1166 | */ 1167 | public interface OnLoadFailClickListener { 1168 | /** 1169 | * 失败点击事件 1170 | */ 1171 | void onLoadFailClick(); 1172 | } 1173 | 1174 | /** 1175 | * 设置网络错误回调监听 1176 | * 1177 | * @param listener the listener 1178 | */ 1179 | public void setOnErrorNetClickListener(final OnLoadErrorNetClickListener listener) { 1180 | mOnLoadErrorNetClickListener = listener; 1181 | } 1182 | 1183 | /** 1184 | * 网络错误时的监听 1185 | */ 1186 | public interface OnLoadErrorNetClickListener { 1187 | /** 1188 | * 失败点击事件 1189 | */ 1190 | void onLoadErrorNetClick(); 1191 | } 1192 | 1193 | 1194 | /** 1195 | * 设置数据为空回调监听 1196 | * 1197 | * @param listener the listener 1198 | */ 1199 | public void setOnEmptyClickListener(final OnLoadEmptyClickListener listener) { 1200 | mOnLoadEmptyClickListener = listener; 1201 | } 1202 | 1203 | /** 1204 | * 数据为空时的监听 1205 | */ 1206 | public interface OnLoadEmptyClickListener { 1207 | /** 1208 | * 数据为空点击事件 1209 | */ 1210 | void onLoadEmptyClick(); 1211 | } 1212 | 1213 | /** 1214 | * 加载监听 1215 | * 1216 | * @param listener the listener 1217 | */ 1218 | public void setOnLoadingListener(final OnLoadingListener listener) { 1219 | mOnLoadingListener = listener; 1220 | } 1221 | 1222 | /** 1223 | * The interface On loading listener. 1224 | */ 1225 | public interface OnLoadingListener { 1226 | /** 1227 | * 加载开始时的回调 1228 | * 1229 | * @param loadingView the loading view 1230 | */ 1231 | void onLoadingStart(View loadingView); 1232 | 1233 | /** 1234 | * 加载结束时的回调 1235 | * 1236 | * @param loadingView the loading view 1237 | */ 1238 | void onLoadingEnd(View loadingView); 1239 | } 1240 | 1241 | /** 1242 | * 获得当前是否在加载中 1243 | * 1244 | * @return the boolean 1245 | */ 1246 | public boolean isLoading() { 1247 | return mIsLoading; 1248 | } 1249 | 1250 | /** 1251 | * The type My on click listener. 1252 | */ 1253 | class MyOnClickListener implements OnClickListener { 1254 | @Override 1255 | public void onClick(View v) { 1256 | if (mCurrentStatus == LoadStatus.FAIL) { 1257 | if (mOnLoadFailClickListener != null) { 1258 | setCurrentStatus(LoadStatus.LOADING); 1259 | mOnLoadFailClickListener.onLoadFailClick(); 1260 | } 1261 | } else if (mCurrentStatus == LoadStatus.ERROR_NET) { 1262 | if (mOnLoadErrorNetClickListener != null) { 1263 | setCurrentStatus(LoadStatus.LOADING); 1264 | mOnLoadErrorNetClickListener.onLoadErrorNetClick(); 1265 | } 1266 | } else if (mCurrentStatus == LoadStatus.EMPTY) { 1267 | if (mOnLoadEmptyClickListener != null) { 1268 | setCurrentStatus(LoadStatus.LOADING); 1269 | mOnLoadEmptyClickListener.onLoadEmptyClick(); 1270 | } 1271 | } 1272 | } 1273 | } 1274 | 1275 | /** 1276 | * 初始化当前状态 1277 | * 1278 | * @param currentStatusTemp the current status temp 1279 | */ 1280 | private void initCurrentStatus(int currentStatusTemp) { 1281 | switch (currentStatusTemp) { 1282 | case 0: 1283 | mCurrentStatus = LoadStatus.UNDO; 1284 | break; 1285 | case 1: 1286 | mCurrentStatus = LoadStatus.LOADING; 1287 | break; 1288 | case 2: 1289 | mCurrentStatus = LoadStatus.FAIL; 1290 | break; 1291 | case 3: 1292 | mCurrentStatus = LoadStatus.ERROR_NET; 1293 | break; 1294 | case 4: 1295 | mCurrentStatus = LoadStatus.EMPTY; 1296 | break; 1297 | case 5: 1298 | mCurrentStatus = LoadStatus.SUCCESS; 1299 | break; 1300 | default: 1301 | break; 1302 | } 1303 | } 1304 | 1305 | 1306 | /** 1307 | * 设置图片大小 1308 | */ 1309 | private void setImageTextSize() { 1310 | if (mImageView != null) { 1311 | LinearLayout.LayoutParams imageParams = (LinearLayout.LayoutParams) mImageView.getLayoutParams(); 1312 | imageParams.width = (int) mImageViewWidth; 1313 | imageParams.height = (int) mImageViewHeight; 1314 | imageParams.gravity = Gravity.CENTER_HORIZONTAL; 1315 | mImageView.setLayoutParams(imageParams); 1316 | 1317 | LinearLayout.LayoutParams textParams = (LinearLayout.LayoutParams) mTextView.getLayoutParams(); 1318 | textParams.width = ViewGroup.LayoutParams.WRAP_CONTENT; 1319 | textParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; 1320 | textParams.gravity = Gravity.CENTER_HORIZONTAL; 1321 | mTextView.setLayoutParams(textParams); 1322 | } 1323 | } 1324 | } 1325 | -------------------------------------------------------------------------------- /loadview/src/main/res/drawable-xhdpi/icon_load_emtpy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/loadview/src/main/res/drawable-xhdpi/icon_load_emtpy.png -------------------------------------------------------------------------------- /loadview/src/main/res/drawable-xhdpi/icon_load_error_net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/loadview/src/main/res/drawable-xhdpi/icon_load_error_net.png -------------------------------------------------------------------------------- /loadview/src/main/res/drawable-xhdpi/icon_load_fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gyf-dev/LoadView/61cd2daf012de9830cb91c0988a28da37a1f7702/loadview/src/main/res/drawable-xhdpi/icon_load_fail.png -------------------------------------------------------------------------------- /loadview/src/main/res/values/attrs.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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /loadview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Library 3 | 4 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':loadview' 2 | --------------------------------------------------------------------------------