├── .gitignore ├── LICENSE ├── README.md ├── README_EN.md ├── app ├── .gitignore ├── build.gradle ├── debug.keystore ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── horizontal │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── scwang │ │ │ └── smart │ │ │ └── refresh │ │ │ └── horizontal │ │ │ └── demo │ │ │ ├── App.java │ │ │ ├── MainActivity.kt │ │ │ ├── activity │ │ │ └── FragmentActivity.java │ │ │ ├── adapter │ │ │ ├── BaseRecyclerAdapter.java │ │ │ └── SmartViewHolder.java │ │ │ ├── fragment │ │ │ ├── ExampleBasicFragment.java │ │ │ ├── PracticeGoodsFragment.kt │ │ │ ├── PracticePagerFragment.kt │ │ │ └── index │ │ │ │ └── IndexHomeFragment.kt │ │ │ ├── util │ │ │ └── StatusBarUtil.java │ │ │ └── widget │ │ │ ├── DetailHorizontalFooter.java │ │ │ └── SmartViewPager.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── bg_panel_bottom.xml │ │ ├── bg_panel_common.xml │ │ ├── bg_panel_top.xml │ │ ├── bg_round_alpha.xml │ │ ├── bg_tab_selected.xml │ │ ├── ic_chevron_right.xml │ │ ├── ic_chevron_right_gray.xml │ │ ├── ic_dashboard_black_24dp.xml │ │ ├── ic_footer_detail_gray_24dp.xml │ │ ├── ic_home_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_more_white_24dp.xml │ │ ├── ic_navigate_before_white_24dp.xml │ │ ├── ic_notifications_black_24dp.xml │ │ ├── ic_service_gray_24dp.xml │ │ ├── ic_star_gray_24dp.xml │ │ ├── ic_store_gray_24dp.xml │ │ ├── ic_trolley_white_24dp.xml │ │ └── loading_rabbit.xml │ │ ├── layout │ │ ├── activity_main.xml │ │ ├── fragment_example_horizontal.xml │ │ ├── fragment_index_home.xml │ │ ├── fragment_practice_goods.xml │ │ ├── fragment_practice_pager.xml │ │ └── widget_footer_detail_horizontal.xml │ │ ├── menu │ │ └── navigation.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 │ │ ├── ic_loading_1.png │ │ ├── ic_loading_2.png │ │ ├── ic_loading_3.png │ │ ├── image_goods_banner_1.jpg │ │ ├── image_goods_banner_2.jpg │ │ └── image_goods_banner_3.jpg │ │ ├── mipmap-xxhdpi │ │ ├── card_cover1.png │ │ ├── card_cover2.png │ │ ├── card_cover3.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── image_detail_comment_mi.jpg │ │ ├── image_detail_description_mi.jpg │ │ └── image_detail_goods_mi.jpg │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── scwang │ └── smartrefresh │ └── horizontal │ └── ExampleUnitTest.kt ├── art ├── app-release.apk ├── gif_basic.gif ├── gif_goods.gif ├── gif_pager.gif ├── jpg_apk_demo.jpg ├── md_update.md └── png_apk_rqcode.png ├── bintrayUpload.bat ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── library ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── scwang │ │ └── smartrefresh │ │ └── horizontal │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── scwang │ │ │ └── smart │ │ │ └── refresh │ │ │ └── horizontal │ │ │ ├── HorizontalComponent.java │ │ │ ├── HorizontalFooter.java │ │ │ ├── HorizontalHeader.java │ │ │ ├── RefreshContentHorizontal.java │ │ │ ├── ScrollBoundaryHorizontal.java │ │ │ └── SmartRefreshHorizontal.java │ └── res │ │ └── values │ │ ├── ids.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── scwang │ └── smartrefresh │ └── horizontal │ └── ExampleUnitTest.java └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches/build_file_checksums.ser 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea 9 | .DS_Store 10 | /build 11 | /captures 12 | .externalNativeBuild 13 | bintrayUpload-key.bat 14 | .* -------------------------------------------------------------------------------- /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 | # Android横向智能刷新框架-SmartRefreshHorizontal 2 | 3 | [![License](https://img.shields.io/badge/License%20-Apache%202-337ab7.svg)](https://www.apache.org/licenses/LICENSE-2.0) 4 | [![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg)](https://android-arsenal.com/api?level=12) 5 | [![JCenter](https://img.shields.io/badge/%20JCenter%20-1.1.1-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshHorizontal/_latestVersion) 6 | [![Author](https://img.shields.io/badge/Author-scwang90-11bbff.svg)](https://github.com/scwang90) 7 | 8 | ## [English](https://github.com/scwang90/SmartRefreshHorizontal/blob/master/README_EN.md) | 中文 9 | 10 | SmartRefreshHorizontal 作为 SmartRefreshLayout 的扩展库,实现了横向刷新和加载的功能, 11 | 虽然是独立的开源库,但是并没有重复做实现, 12 | 而是对 SmartRefreshLayout 做了封装和转换,使其支持横向刷新。 13 | 所以 SmartRefreshHorizontal 继承了 SmartRefreshLayout 所有的特性,只是方向改成了横向。 14 | 15 | ## 特点: 16 | 17 | - 支持 横向滚动 18 | - 支持 [SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout) 的所有特性 19 | - 支持 AndroidX 20 | 21 | ## 由来 22 | 23 | SmartRefreshLayout 的设计灵活多样,扩展性高,我想这应该是它受欢迎的原因之一。 24 | 在 issue 区有不少人建议让 SmartRefreshLayout 支持横向刷新。 25 | 其实大家都知道横向刷新的库已经有了不少,我给他们的回复是使用其他现有的横向刷新库。 26 | 但这在 issue 引发热议,可能是那些横向刷新库的使用、功能、扩展与 SmartRefreshLayout有很大差距。 27 | 所以我自己认为要做横向刷新库也需要能够像 SmartRefreshLayout 一样的多功能与易扩展。 28 | 如果直接扩展 SmartRefreshLayout 的功能使其直接支持横向,将会增加代码量。 29 | 然而当此时它已经足够庞大,并且也有不少人抱怨它太大需要分包细化功能。所以一开始的时候我几乎没有开发横向刷新功能的想法。 30 | 因为用到横向刷新的应用场景比竖向刷新少很多,我自己也很少会用到这样的场景。 31 | 如果为了实现一个我自己不常用的功能库要花费我太多时间和精力实在划不来,仅仅实现一个简单的横向刷新又没有必要... 32 | 33 | ## 原理 34 | 35 | 终于!有一天我在开发旋转动画过程中,产生了一个奇妙的想法:如果把 SmartRefreshLayout 旋转90度会怎样? 36 | 然后开始做试验:把 SmartRefreshLayout 旋转90度,再把 Content 旋转-90度。结果竟然真的可以用!! 37 | 这样就不用让我花大量时间精力去做横向刷新代码实现,SmartRefreshLayout 原有的所有功能多可以直接使用, 38 | 之前设计的十多个 Header 和 Footer 也可以不用任何修改直接使用!这让我产生了开发横向刷新库的动力。 39 | 于是基于这个试验想法就诞生了这个 SmartRefreshHorizontal 库 ! 40 | 41 | 明白了 SmartRefreshHorizontal 与 SmartRefreshLayout 的关系,那么大家在使用本库的使用同时也要依赖 42 | SmartRefreshLayout,并且版本要大于 1.1.0-beta-1 ,否则会出现找不到类的错误。 43 | 44 | ## 传送门 45 | 46 | - [属性文档](https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_property.md) 47 | - [常见问题](https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_faq.md) 48 | - [更新日志](https://github.com/scwang90/SmartRefreshHorizontal/blob/master/art/md_update.md) 49 | - [博客文章](https://segmentfault.com/a/1190000020038792) 50 | - [源码下载](https://github.com/scwang90/SmartRefreshHorizontal/releases) 51 | - [自定义Header](https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_custom.md) 52 | 53 | ## Demo 54 | [下载 APK-Demo](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/app-release.apk) 55 | 56 | ![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/png_apk_rqcode.png) 57 | 58 | #### 效果演示 59 | |商品详情|ViewPager| 60 | |:---:|:---:| 61 | |![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_goods.gif)|![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_pager.gif)| 62 | 63 | |数据演示| 64 | |:---:| 65 | |![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_basic.gif)| 66 | 67 | ## 简单用例 68 | 69 | ### 1. 在 build.gradle 中添加依赖 70 | ```gradle 71 | //2.x 72 | implementation 'com.scwang.smart:refresh-layout-horizontal:2.0.0' 73 | implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' 74 | implementation 'com.scwang.smart:refresh-header-classics:2.0.1' //经典刷新头 75 | implementation 'com.scwang.smart:refresh-header-material:2.0.1' //谷歌刷新头 76 | 77 | //1.x 78 | implementation 'com.scwang.smartrefresh:SmartRefreshHorizontal:1.1.2' 79 | implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3' //必须依赖 版本 1.1.0 以上 80 | 81 | //androidx 82 | implementation 'com.scwang.smartrefresh:SmartRefreshHorizontal:1.1.2-x' 83 | implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3' //必须依赖 版本 1.1.0 以上 84 | 85 | ``` 86 | 87 | ### 2. 在XML布局文件中添加 SmartRefreshHorizontal 88 | ```xml 89 | 90 | 94 | 101 | 102 | ``` 103 | ### 3. 在 Activity 或者 Fragment 中添加代码 104 | ```java 105 | RefreshLayout refreshLayout = root.findViewById(R.id.refreshLayout); 106 | refreshLayout.setRefreshHeader(new MaterialHeader(root.getContext())); 107 | refreshLayout.setRefreshFooter(new RefreshFooterWrapper(new MaterialHeader(root.getContext())), -1, -2); 108 | ``` 109 | 110 | ## 混淆 111 | 112 | SmartRefreshHorizontal 不需要添加混淆过滤代码,并且已经混淆测试通过,如果你在项目的使用中混淆之后出现问题,请及时通知我。 113 | 114 | ## 其他作品 115 | [MultiWaveHeader](https://github.com/scwang90/MultiWaveHeader) 116 | [SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout) 117 | [诗和远方](http://android.myapp.com/myapp/detail.htm?apkName=com.poetry.kernel) 118 | 119 | License 120 | ------- 121 | 122 | Copyright 2019 scwang90 123 | 124 | Licensed under the Apache License, Version 2.0 (the "License"); 125 | you may not use this file except in compliance with the License. 126 | You may obtain a copy of the License at 127 | 128 | http://www.apache.org/licenses/LICENSE-2.0 129 | 130 | Unless required by applicable law or agreed to in writing, software 131 | distributed under the License is distributed on an "AS IS" BASIS, 132 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133 | See the License for the specific language governing permissions and 134 | limitations under the License. 135 | -------------------------------------------------------------------------------- /README_EN.md: -------------------------------------------------------------------------------- 1 | # SmartRefreshHorizontal 2 | 3 | [![License](https://img.shields.io/badge/License%20-Apache%202-337ab7.svg)](https://www.apache.org/licenses/LICENSE-2.0) 4 | [![MinSdk](https://img.shields.io/badge/%20MinSdk%20-%2012%2B%20-f0ad4e.svg)](https://android-arsenal.com/api?level=12) 5 | [![JCenter](https://img.shields.io/badge/%20JCenter%20-1.1.1-5bc0de.svg)](https://bintray.com/scwang90/maven/SmartRefreshHorizontal/_latestVersion) 6 | [![Author](https://img.shields.io/badge/Author-scwang90-11bbff.svg)](https://github.com/scwang90) 7 | 8 | ## English | [中文](README.md) 9 | 10 | As an extension library of SmartRefreshLayout, SmartRefreshHorizontal realizes the function of horizontal refresh and loading. 11 | Although it is an independent open source library, it has not been implemented repeatedly. 12 | Instead, SmartRefreshLayout is encapsulated and converted to support horizontal refresh. 13 | So SmartRefreshHorizontal inherits all the features of SmartRefreshLayout, but the direction changes to horizontal. 14 | 15 | ## Features 16 | 17 | - Support horizontal scrol. 18 | - Support all features of [SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout). 19 | - Support AndroidX 20 | 21 | ## Gateway 22 | 23 | - [Update log](https://github.com/scwang90/SmartRefreshHorizontal/blob/master/art/md_update.md) 24 | - [Attribute method](https://github.com/scwang90/SmartRefreshLayout/blob/master/art/md_property.md) 25 | - [Blog posts](https://segmentfault.com/a/1190000010066071) 26 | - [Download the source code](https://github.com/scwang90/SmartRefreshHorizontal/releases) 27 | 28 | 29 | ## Demo 30 | [Download APK-Demo](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/app-release.apk) 31 | 32 | ![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/png_apk_rqcode.png) 33 | 34 | #### Preview 35 | 36 | |Goods|ViewPager| 37 | |:---:|:---:| 38 | |![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_goods.gif)|![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_pager.gif)| 39 | 40 | |LoadData| 41 | |:---:| 42 | |![](https://github.com/scwang90/SmartRefreshHorizontal/raw/master/art/gif_basic.gif)| 43 | 44 | ## Usage 45 | #### 1.Add a gradle dependency. 46 | ``` 47 | //2.x 48 | implementation 'com.scwang.smart:refresh-layout-horizontal:2.0.0' 49 | implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' 50 | implementation 'com.scwang.smart:refresh-header-classics:2.0.1' 51 | implementation 'com.scwang.smart:refresh-header-material:2.0.1' 52 | 53 | //1.x 54 | implementation 'com.scwang.smartrefresh:SmartRefreshHorizontal:1.1.2' 55 | implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3' 56 | 57 | //androidx 58 | implementation 'com.scwang.smartrefresh:SmartRefreshHorizontal:1.1.2-x' 59 | implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3' 60 | 61 | ``` 62 | 63 | #### 2.Add SmartRefreshLayout in the layout xml. 64 | ```xml 65 | 66 | 70 | 77 | 78 | ``` 79 | 80 | #### 3.Coding in the Activity or Fragment. 81 | ```java 82 | RefreshLayout refreshLayout = root.findViewById(R.id.refreshLayout); 83 | refreshLayout.setRefreshHeader(new MaterialHeader(root.getContext())); 84 | refreshLayout.setRefreshFooter(new RefreshFooterWrapper(new MaterialHeader(root.getContext())), -1, -2); 85 | ``` 86 | 87 | ## ProGuard 88 | 89 | This library is no need to add confusing filtering code, and it has been confusing tests pass, if you after the confusion in the use of the project appear problem, please inform me. 90 | 91 | ## Donate 92 | 93 | If you like this library's design, feel it help to you, you can point the upper right corner "Star" support Thank you! ^ _ ^ 94 | You can also click the PayPal below to ask the author to drink a cup of coffee. 95 | 96 | [![](https://www.paypalobjects.com/webstatic/i/logo/rebrand/ppcom.svg 'click to donate')](https://www.paypal.me/scwang90) 97 | 98 | ## Discuss 99 | 100 | Contact me: scwang90@hotmail.com 101 | 102 | ## Other Works 103 | [SmartRefreshLayout](https://github.com/scwang90/SmartRefreshLayout) 104 | [MultiWaveHeader](https://github.com/scwang90/MultiWaveHeader) 105 | 106 | License 107 | ------- 108 | 109 | Copyright 2019 scwang90 110 | 111 | Licensed under the Apache License, Version 2.0 (the "License"); 112 | you may not use this file except in compliance with the License. 113 | You may obtain a copy of the License at 114 | 115 | http://www.apache.org/licenses/LICENSE-2.0 116 | 117 | Unless required by applicable law or agreed to in writing, software 118 | distributed under the License is distributed on an "AS IS" BASIS, 119 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 120 | See the License for the specific language governing permissions and 121 | limitations under the License. 122 | 123 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | .* -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | apply plugin: 'kotlin-android-extensions' 4 | 5 | android { 6 | compileSdkVersion 28 7 | defaultConfig { 8 | applicationId "com.scwang.smartrefresh.horizontal.demo" 9 | minSdkVersion 16 10 | targetSdkVersion 28 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | } 15 | signingConfigs { 16 | debug { 17 | storeFile file('debug.keystore') 18 | storePassword "android" 19 | keyAlias "androiddebugkey" 20 | keyPassword "android" 21 | } 22 | } 23 | buildTypes { 24 | debug { 25 | signingConfig = signingConfigs.debug 26 | } 27 | release { 28 | minifyEnabled true 29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 30 | signingConfig = signingConfigs.debug 31 | } 32 | } 33 | } 34 | 35 | repositories { 36 | maven { url "https://jitpack.io" }//BaseRecyclerViewAdapterHelper 37 | // maven { url "https://bintray.com/scwang90/maven" } 38 | } 39 | 40 | dependencies { 41 | implementation fileTree(include: ['*.jar'], dir: 'libs') 42 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 43 | implementation 'com.android.support:appcompat-v7:28.0.0' 44 | implementation 'com.android.support:design:28.0.0' 45 | implementation 'com.android.support:support-v4:28.0.0' 46 | implementation 'com.android.support:cardview-v7:28.0.0' 47 | implementation 'com.android.support:support-vector-drawable:28.0.0' 48 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 49 | testImplementation 'junit:junit:4.12' 50 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 51 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 52 | implementation project(':library') 53 | 54 | // 基础依赖包,必须要依赖 55 | implementation 'com.gyf.immersionbar:immersionbar:3.0.0-beta02' 56 | implementation 'com.jaeger.statusbarutil:library:1.5.1' 57 | 58 | // implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0' 59 | // implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0' 60 | implementation 'com.scwang.smart:refresh-layout-kernel:2.0.1' 61 | implementation 'com.scwang.smart:refresh-header-classics:2.0.1' 62 | implementation 'com.scwang.smart:refresh-header-material:2.0.1' //谷歌刷新头 63 | implementation 'com.scwang.smart:refresh-header-falsify:2.0.1' //虚拟刷新头 64 | // implementation 'com.scwang.smart:refresh-layout-horizontal:2.0.0-alpha-1' 65 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.50' 66 | 67 | implementation 'com.ogaclejapan.smarttablayout:library:1.7.0@aar' 68 | implementation 'com.ogaclejapan.smarttablayout:utils-v4:1.7.0@aar' 69 | } 70 | -------------------------------------------------------------------------------- /app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scwang90/SmartRefreshHorizontal/63a5193ed419bb175961e75a77ef6f1581756394/app/debug.keystore -------------------------------------------------------------------------------- /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/scwang/smartrefresh/horizontal/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.scwang.smartrefresh.horizontal 2 | 3 | import android.support.test.InstrumentationRegistry 4 | import android.support.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.scwang.smartrefresh.horizontal", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/App.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.support.annotation.NonNull; 6 | 7 | import com.scwang.smart.refresh.header.ClassicsHeader; 8 | import com.scwang.smart.refresh.header.MaterialHeader; 9 | import com.scwang.smart.refresh.layout.SmartRefreshLayout; 10 | import com.scwang.smart.refresh.layout.api.RefreshFooter; 11 | import com.scwang.smart.refresh.layout.api.RefreshHeader; 12 | import com.scwang.smart.refresh.layout.api.RefreshLayout; 13 | import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator; 14 | import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator; 15 | import com.scwang.smart.refresh.layout.listener.DefaultRefreshInitializer; 16 | import com.scwang.smart.refresh.layout.wrapper.RefreshFooterWrapper; 17 | import com.scwang.smart.refresh.horizontal.SmartRefreshHorizontal; 18 | import com.scwang.smartrefresh.horizontal.demo.R; 19 | 20 | public class App extends Application { 21 | static { 22 | SmartRefreshLayout.setDefaultRefreshInitializer(new DefaultRefreshInitializer() { 23 | @Override 24 | public void initialize(@NonNull Context context, @NonNull RefreshLayout layout) { 25 | layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); 26 | } 27 | }); 28 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 29 | @NonNull 30 | @Override 31 | public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) { 32 | return new ClassicsHeader(context); 33 | } 34 | }); 35 | SmartRefreshHorizontal.setDefaultRefreshInitializer(new DefaultRefreshInitializer() { 36 | @Override 37 | public void initialize(@NonNull Context context, @NonNull RefreshLayout layout) { 38 | layout.setEnableAutoLoadMore(false); 39 | layout.setPrimaryColorsId(R.color.colorPrimary, android.R.color.white); 40 | } 41 | }); 42 | SmartRefreshHorizontal.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 43 | @NonNull 44 | @Override 45 | public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) { 46 | layout.setEnableHeaderTranslationContent(true); 47 | return new MaterialHeader(context); 48 | } 49 | }); 50 | SmartRefreshHorizontal.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() { 51 | @NonNull 52 | @Override 53 | public RefreshFooter createRefreshFooter(@NonNull Context context, @NonNull RefreshLayout layout) { 54 | layout.setEnableFooterTranslationContent(true); 55 | return new RefreshFooterWrapper(new MaterialHeader(context)); 56 | } 57 | }); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo 2 | 3 | import android.os.Bundle 4 | import android.support.design.widget.BottomNavigationView 5 | import android.support.v4.app.Fragment 6 | import android.support.v7.app.AppCompatActivity 7 | import android.view.View 8 | import com.scwang.smart.refresh.horizontal.demo.fragment.ExampleBasicFragment 9 | import com.scwang.smart.refresh.horizontal.demo.fragment.PracticeGoodsFragment 10 | import com.scwang.smart.refresh.horizontal.demo.fragment.index.IndexHomeFragment 11 | import com.scwang.smartrefresh.horizontal.demo.R 12 | import kotlinx.android.synthetic.main.activity_main.* 13 | 14 | class MainActivity : AppCompatActivity() { 15 | 16 | private val homeFragment: Fragment by lazy { 17 | IndexHomeFragment() 18 | } 19 | 20 | private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item -> 21 | when (item.itemId) { 22 | R.id.navigation_home -> { 23 | message.setText(R.string.title_home) 24 | supportFragmentManager.beginTransaction().replace(R.id.fragment, homeFragment).commit() 25 | return@OnNavigationItemSelectedListener true 26 | } 27 | R.id.navigation_dashboard -> { 28 | message.setText(R.string.title_dashboard) 29 | supportFragmentManager.beginTransaction().replace( 30 | R.id.fragment, 31 | PracticeGoodsFragment() 32 | ).commit() 33 | return@OnNavigationItemSelectedListener true 34 | } 35 | R.id.navigation_notifications -> { 36 | message.setText(R.string.title_notifications) 37 | supportFragmentManager.beginTransaction().replace( 38 | R.id.fragment, 39 | ExampleBasicFragment() 40 | ).commit() 41 | return@OnNavigationItemSelectedListener true 42 | } 43 | } 44 | false 45 | } 46 | 47 | override fun onCreate(savedInstanceState: Bundle?) { 48 | super.onCreate(savedInstanceState) 49 | setContentView(R.layout.activity_main) 50 | 51 | navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener) 52 | navigation.visibility = View.GONE 53 | 54 | supportFragmentManager.beginTransaction().replace( 55 | R.id.fragment, 56 | IndexHomeFragment() 57 | ).commit() 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/activity/FragmentActivity.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.activity; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.app.Fragment; 9 | import android.support.v4.app.FragmentManager; 10 | import android.support.v4.app.FragmentTransaction; 11 | import android.support.v7.app.AppCompatActivity; 12 | import android.widget.FrameLayout; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | import static android.R.id.widget_frame; 18 | 19 | /** 20 | * Fragment 容器页面 21 | * Created by SCWANG on 2017/10/10. 22 | */ 23 | 24 | @SuppressWarnings({"UnusedParameters", "unused"}) 25 | public class FragmentActivity extends AppCompatActivity { 26 | 27 | protected static final String EXTRA_FRAGMENT = "EXTRA_FRAGMENT"; 28 | private Fragment mFragment; 29 | 30 | // 31 | private static void start(Context context, Class clazz, Object... params){ 32 | if (context != null && Fragment.class.isAssignableFrom(clazz)) { 33 | context.startActivity(newIntent(clazz, context, params)); 34 | } 35 | } 36 | 37 | public static void start(Activity activity, Class clazz, Object... params){ 38 | start((Context) activity, clazz, params); 39 | } 40 | 41 | public static void start(Fragment fragment, Class clazz, Object... params){ 42 | if (fragment != null) { 43 | start((Context) fragment.getActivity(), clazz, params); 44 | } 45 | } 46 | 47 | private static Intent newIntent(Class clazz, Context context, Object... params) { 48 | Intent intent = new Intent(context, FragmentActivity.class); 49 | intent.putExtra(EXTRA_FRAGMENT, clazz.getName()); 50 | return intent; 51 | } 52 | // 53 | 54 | // 55 | 56 | //@InjectExtra(value = EXTRA_FRAGMENT,remark = "Fragment类名") 57 | protected String mFragmentClazz = null; 58 | 59 | @Override 60 | protected void onCreate(@Nullable Bundle savedInstanceState) { 61 | super.onCreate(savedInstanceState); 62 | mFragmentClazz = getIntent().getStringExtra(EXTRA_FRAGMENT); 63 | FrameLayout frameLayout = new FrameLayout(this); 64 | frameLayout.setId(widget_frame); 65 | setContentView(frameLayout); 66 | replaceFragment(); 67 | } 68 | 69 | protected void replaceFragment() { 70 | try { 71 | mFragment = (Fragment) getFragmentClass().newInstance(); 72 | FragmentManager manager = getSupportFragmentManager(); 73 | FragmentTransaction transaction = manager.beginTransaction(); 74 | transaction.replace(widget_frame, mFragment); 75 | transaction.commit(); 76 | } catch (Exception e) { 77 | e.printStackTrace(); 78 | // AfExceptionHandler.handle(e, "AfFragmentActivity Fragment 类型错误:" + mFragmentClazz); 79 | } 80 | } 81 | 82 | // 83 | private static Map typeCache = new HashMap<>(); 84 | private Class getFragmentClass() throws ClassNotFoundException { 85 | Class type = typeCache.get(mFragmentClazz); 86 | if (type == null) { 87 | typeCache.put(mFragmentClazz, type = Class.forName(mFragmentClazz)); 88 | } 89 | return type; 90 | } 91 | // 92 | 93 | public Fragment getFragment() { 94 | return mFragment; 95 | } 96 | 97 | // 98 | 99 | 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/adapter/BaseRecyclerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.adapter; 2 | 3 | import android.database.DataSetObservable; 4 | import android.database.DataSetObserver; 5 | import android.support.annotation.LayoutRes; 6 | import android.support.annotation.NonNull; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.AdapterView; 12 | import android.widget.ListAdapter; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Collection; 16 | import java.util.List; 17 | 18 | /** 19 | * 20 | * Created by SCWANG on 2017/6/11. 21 | */ 22 | 23 | @SuppressWarnings({"UnusedReturnValue", "unused"}) 24 | public abstract class BaseRecyclerAdapter extends RecyclerView.Adapter implements ListAdapter { 25 | 26 | 27 | // 28 | 29 | private final int mLayoutId; 30 | private final List mList; 31 | private int mLastPosition = -1; 32 | private boolean mOpenAnimationEnable = true; 33 | protected AdapterView.OnItemClickListener mListener; 34 | 35 | public BaseRecyclerAdapter(@LayoutRes int layoutId) { 36 | setHasStableIds(false); 37 | this.mList = new ArrayList<>(); 38 | this.mLayoutId = layoutId; 39 | } 40 | 41 | public BaseRecyclerAdapter(Collection collection, @LayoutRes int layoutId) { 42 | setHasStableIds(false); 43 | this.mList = new ArrayList<>(collection); 44 | this.mLayoutId = layoutId; 45 | } 46 | 47 | public BaseRecyclerAdapter(Collection collection, @LayoutRes int layoutId, AdapterView.OnItemClickListener listener) { 48 | setHasStableIds(false); 49 | setOnItemClickListener(listener); 50 | this.mList = new ArrayList<>(collection); 51 | this.mLayoutId = layoutId; 52 | } 53 | // 54 | 55 | 56 | private void addAnimate(SmartViewHolder holder, int postion) { 57 | if (mOpenAnimationEnable && mLastPosition < postion) { 58 | holder.itemView.setAlpha(0); 59 | holder.itemView.animate().alpha(1).start(); 60 | mLastPosition = postion; 61 | } 62 | } 63 | 64 | 65 | // 66 | @NonNull 67 | @Override 68 | public SmartViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 69 | return new SmartViewHolder(LayoutInflater.from(parent.getContext()).inflate(mLayoutId, parent, false),mListener); 70 | } 71 | 72 | @Override 73 | public void onBindViewHolder(@NonNull SmartViewHolder holder, int position) { 74 | onBindViewHolder(holder, position < mList.size() ? mList.get(position) : null, position); 75 | } 76 | 77 | protected abstract void onBindViewHolder(SmartViewHolder holder, T model, int position); 78 | 79 | @Override 80 | public int getItemCount() { 81 | return mList.size(); 82 | } 83 | 84 | @Override 85 | public void onViewAttachedToWindow(@NonNull SmartViewHolder holder) { 86 | super.onViewAttachedToWindow(holder); 87 | addAnimate(holder, holder.getLayoutPosition()); 88 | } 89 | 90 | public void setOpenAnimationEnable(boolean enabled) { 91 | this.mOpenAnimationEnable = enabled; 92 | } 93 | 94 | // 95 | 96 | // 97 | 98 | public T get(int index) { 99 | return mList.get(index); 100 | } 101 | 102 | public BaseRecyclerAdapter setOnItemClickListener(AdapterView.OnItemClickListener listener) { 103 | mListener = listener; 104 | return this; 105 | } 106 | 107 | public BaseRecyclerAdapter refresh(Collection collection) { 108 | mList.clear(); 109 | mList.addAll(collection); 110 | notifyDataSetChanged(); 111 | notifyListDataSetChanged(); 112 | mLastPosition = -1; 113 | return this; 114 | } 115 | 116 | public BaseRecyclerAdapter loadMore(Collection collection) { 117 | mList.addAll(collection); 118 | notifyDataSetChanged(); 119 | notifyListDataSetChanged(); 120 | return this; 121 | } 122 | 123 | public BaseRecyclerAdapter insert(Collection collection) { 124 | mList.addAll(0, collection); 125 | notifyDataSetChanged(); 126 | notifyListDataSetChanged(); 127 | return this; 128 | } 129 | 130 | 131 | // 132 | 133 | // 134 | private final DataSetObservable mDataSetObservable = new DataSetObservable(); 135 | 136 | // public boolean hasStableIds() { 137 | // return false; 138 | // } 139 | 140 | public void registerDataSetObserver(DataSetObserver observer) { 141 | mDataSetObservable.registerObserver(observer); 142 | } 143 | 144 | public void unregisterDataSetObserver(DataSetObserver observer) { 145 | mDataSetObservable.unregisterObserver(observer); 146 | } 147 | 148 | /** 149 | * Notifies the attached observers that the underlying data has been changed 150 | * and any View reflecting the data set should refresh itself. 151 | */ 152 | public void notifyListDataSetChanged() { 153 | mDataSetObservable.notifyChanged(); 154 | } 155 | 156 | /** 157 | * Notifies the attached observers that the underlying data is no longer valid 158 | * or available. Once invoked this adapter is no longer valid and should 159 | * not report further data set changes. 160 | */ 161 | public void notifyDataSetInvalidated() { 162 | mDataSetObservable.notifyInvalidated(); 163 | } 164 | 165 | public boolean areAllItemsEnabled() { 166 | return true; 167 | } 168 | 169 | public boolean isEnabled(int position) { 170 | return true; 171 | } 172 | 173 | @Override 174 | public View getView(int position, View convertView, ViewGroup parent) { 175 | SmartViewHolder holder; 176 | if (convertView != null) { 177 | holder = (SmartViewHolder) convertView.getTag(); 178 | } else { 179 | holder = onCreateViewHolder(parent, getItemViewType(position)); 180 | convertView = holder.itemView; 181 | convertView.setTag(holder); 182 | } 183 | holder.setPosition(position); 184 | onBindViewHolder(holder, position); 185 | addAnimate(holder, position); 186 | return convertView; 187 | } 188 | 189 | public int getItemViewType(int position) { 190 | return 0; 191 | } 192 | 193 | public int getViewTypeCount() { 194 | return 1; 195 | } 196 | 197 | public boolean isEmpty() { 198 | return getCount() == 0; 199 | } 200 | 201 | @Override 202 | public Object getItem(int position) { 203 | return mList.get(position); 204 | } 205 | 206 | @Override 207 | public int getCount() { 208 | return mList.size(); 209 | } 210 | 211 | // 212 | } 213 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/adapter/SmartViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.adapter; 2 | 3 | import android.content.res.Resources; 4 | import android.support.annotation.StringRes; 5 | import android.support.v4.content.ContextCompat; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.util.TypedValue; 8 | import android.view.View; 9 | import android.widget.AdapterView; 10 | import android.widget.ImageView; 11 | import android.widget.TextView; 12 | 13 | public class SmartViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 14 | 15 | private final AdapterView.OnItemClickListener mListener; 16 | private int mPosition = -1; 17 | 18 | public SmartViewHolder(View itemView, AdapterView.OnItemClickListener mListener) { 19 | super(itemView); 20 | this.mListener = mListener; 21 | itemView.setOnClickListener(this); 22 | 23 | /* 24 | * 设置水波纹背景 25 | */ 26 | if (itemView.getBackground() == null) { 27 | TypedValue typedValue = new TypedValue(); 28 | Resources.Theme theme = itemView.getContext().getTheme(); 29 | int top = itemView.getPaddingTop(); 30 | int bottom = itemView.getPaddingBottom(); 31 | int left = itemView.getPaddingLeft(); 32 | int right = itemView.getPaddingRight(); 33 | if (theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true)) { 34 | itemView.setBackgroundResource(typedValue.resourceId); 35 | } 36 | itemView.setPadding(left, top, right, bottom); 37 | } 38 | } 39 | 40 | public void setPosition(int position) { 41 | mPosition = position; 42 | } 43 | 44 | @Override 45 | public void onClick(View v) { 46 | if (mListener != null) { 47 | int position = getAdapterPosition(); 48 | if(position >= 0){ 49 | mListener.onItemClick(null, v, position, getItemId()); 50 | } else if (mPosition > -1) { 51 | mListener.onItemClick(null, v, mPosition, getItemId()); 52 | } 53 | } 54 | } 55 | 56 | private View findViewById(int id) { 57 | return id == 0 ? itemView : itemView.findViewById(id); 58 | } 59 | 60 | public SmartViewHolder text(int id, CharSequence sequence) { 61 | View view = findViewById(id); 62 | if (view instanceof TextView) { 63 | ((TextView) view).setText(sequence); 64 | } 65 | return this; 66 | } 67 | 68 | public SmartViewHolder text(int id,@StringRes int stringRes) { 69 | View view = findViewById(id); 70 | if (view instanceof TextView) { 71 | ((TextView) view).setText(stringRes); 72 | } 73 | return this; 74 | } 75 | 76 | public SmartViewHolder textColorId(int id, int colorId) { 77 | View view = findViewById(id); 78 | if (view instanceof TextView) { 79 | ((TextView) view).setTextColor(ContextCompat.getColor(view.getContext(), colorId)); 80 | } 81 | return this; 82 | } 83 | 84 | public SmartViewHolder image(int id, int imageId) { 85 | View view = findViewById(id); 86 | if (view instanceof ImageView) { 87 | ((ImageView) view).setImageResource(imageId); 88 | } 89 | return this; 90 | } 91 | 92 | public SmartViewHolder gone(int id) { 93 | View view = findViewById(id); 94 | if (view != null) { 95 | view.setVisibility(View.GONE); 96 | } 97 | return this; 98 | } 99 | 100 | public SmartViewHolder visible(int id) { 101 | View view = findViewById(id); 102 | if (view != null) { 103 | view.setVisibility(View.VISIBLE); 104 | } 105 | return this; 106 | } 107 | } -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/fragment/ExampleBasicFragment.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.fragment; 2 | 3 | 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.support.v7.widget.Toolbar; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | import com.chad.library.adapter.base.BaseQuickAdapter; 15 | import com.chad.library.adapter.base.BaseViewHolder; 16 | import com.scwang.smart.refresh.header.ClassicsHeader; 17 | import com.scwang.smart.refresh.horizontal.demo.adapter.BaseRecyclerAdapter; 18 | import com.scwang.smart.refresh.horizontal.demo.adapter.SmartViewHolder; 19 | import com.scwang.smart.refresh.layout.api.RefreshLayout; 20 | import com.scwang.smart.refresh.layout.listener.OnRefreshLoadMoreListener; 21 | import com.scwang.smartrefresh.horizontal.demo.R; 22 | 23 | import java.util.Arrays; 24 | import java.util.Collection; 25 | 26 | import static android.R.layout.simple_list_item_2; 27 | 28 | /** 29 | * A simple {@link Fragment} subclass. 30 | */ 31 | public class ExampleBasicFragment extends Fragment { 32 | 33 | private QuickAdapterAdapter mQuickAdapter; 34 | private BaseRecyclerAdapter mAdapter; 35 | 36 | int[] colorIds = { 37 | android.R.color.holo_blue_dark, 38 | android.R.color.holo_green_dark, 39 | android.R.color.holo_red_dark, 40 | android.R.color.holo_orange_dark, 41 | }; 42 | 43 | @Override 44 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 45 | // Inflate the layout for this fragment 46 | return inflater.inflate(R.layout.fragment_example_horizontal, container, false); 47 | } 48 | 49 | @Override 50 | public void onViewCreated(@NonNull View root, @Nullable Bundle savedInstanceState) { 51 | super.onViewCreated(root, savedInstanceState); 52 | 53 | final Toolbar toolbar = root.findViewById(R.id.toolbar); 54 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 55 | @Override 56 | public void onClick(View v) { 57 | getActivity().finish(); 58 | } 59 | }); 60 | 61 | final RecyclerView recyclerView = root.findViewById(R.id.recyclerView); 62 | 63 | recyclerView.setAdapter(mAdapter = new BaseRecyclerAdapter(simple_list_item_2) { 64 | 65 | @Override 66 | protected void onBindViewHolder(SmartViewHolder holder, Void model, int position) { 67 | holder.itemView.getLayoutParams().width = -2;//DensityUtil.dp2px(100); 68 | holder.itemView.getLayoutParams().height = -1; 69 | holder.itemView.setBackgroundResource(colorIds[position%colorIds.length]); 70 | holder.text(android.R.id.text1, getString(R.string.item_example_number_title, position)); 71 | holder.textColorId(android.R.id.text1, android.R.color.white); 72 | 73 | } 74 | }); 75 | recyclerView.setAdapter(mQuickAdapter = new QuickAdapterAdapter()); 76 | 77 | 78 | mAdapter.refresh(initData()); 79 | mQuickAdapter.replaceData(initData()); 80 | mQuickAdapter.openLoadAnimation(QuickAdapterAdapter.ALPHAIN); 81 | 82 | RefreshLayout refreshLayout = root.findViewById(R.id.refreshLayout); 83 | refreshLayout.setRefreshHeader(new ClassicsHeader(root.getContext())); 84 | // refreshLayout.setRefreshFooter(new RefreshFooterWrapper(new MaterialHeader(root.getContext())), -1, -2); 85 | //// refreshLayout.setEnableHeaderTranslationContent(true); 86 | // refreshLayout.setEnableFooterTranslationContent(true); 87 | // refreshLayout.setEnableAutoLoadMore(false); 88 | 89 | refreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() { 90 | @Override 91 | public void onRefresh(@NonNull final RefreshLayout refreshLayout) { 92 | refreshLayout.getLayout().postDelayed(new Runnable() { 93 | @Override 94 | public void run() { 95 | mAdapter.refresh(initData()); 96 | mQuickAdapter.replaceData(initData()); 97 | refreshLayout.finishRefresh(); 98 | } 99 | }, 1500); 100 | } 101 | 102 | @Override 103 | public void onLoadMore(@NonNull final RefreshLayout refreshLayout) { 104 | recyclerView.stopScroll(); 105 | recyclerView.stopNestedScroll(); 106 | refreshLayout.getLayout().postDelayed(new Runnable() { 107 | @Override 108 | public void run() { 109 | mAdapter.loadMore(initData()); 110 | mQuickAdapter.addData(initData()); 111 | refreshLayout.finishLoadMore(); 112 | } 113 | }, 1500); 114 | } 115 | }); 116 | } 117 | 118 | private Collection initData() { 119 | return Arrays.asList(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); 120 | } 121 | 122 | public class QuickAdapterAdapter extends BaseQuickAdapter { 123 | QuickAdapterAdapter() { 124 | super(simple_list_item_2); 125 | } 126 | 127 | @Override 128 | protected void convert(BaseViewHolder holder, Void item) { 129 | int position = holder.getAdapterPosition(); 130 | holder.itemView.getLayoutParams().width = -2;//DensityUtil.dp2px(100); 131 | holder.itemView.getLayoutParams().height = -1; 132 | holder.itemView.setBackgroundResource(colorIds[position%colorIds.length]); 133 | holder.setText(android.R.id.text1, getString(R.string.item_example_number_title, position)); 134 | holder.setTextColor(android.R.id.text1, 0xffffffff); 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/fragment/PracticeGoodsFragment.kt: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.fragment 2 | 3 | 4 | import android.os.Build 5 | import android.os.Bundle 6 | import android.support.v4.app.Fragment 7 | import android.support.v4.graphics.ColorUtils 8 | import android.support.v4.view.ViewPager 9 | import android.support.v4.widget.NestedScrollView 10 | import android.util.Log 11 | import android.view.LayoutInflater 12 | import android.view.View 13 | import android.view.ViewGroup 14 | import com.scwang.smartrefresh.horizontal.demo.R 15 | import com.scwang.smart.refresh.horizontal.demo.util.StatusBarUtil 16 | import kotlinx.android.synthetic.main.fragment_practice_goods.* 17 | import kotlin.math.min 18 | 19 | /** 20 | * A simple [Fragment] subclass. 21 | * 22 | */ 23 | class PracticeGoodsFragment : Fragment() { 24 | 25 | var pageIndex = 0 26 | var darkMode = false 27 | 28 | override fun onCreateView( 29 | inflater: LayoutInflater, container: ViewGroup?, 30 | savedInstanceState: Bundle? 31 | ): View? { 32 | // Inflate the layout for this fragment 33 | return inflater.inflate(R.layout.fragment_practice_goods, container, false) 34 | } 35 | 36 | 37 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 38 | super.onViewCreated(view, savedInstanceState) 39 | onScrollChange(0) 40 | tabLayout.setViewPager(viewPager) 41 | viewPager.addOnPageChangeListener(object : ViewPager.SimpleOnPageChangeListener() { 42 | override fun onPageSelected(position: Int) { 43 | pageIndex = position 44 | onScrollChange(if (position == 0) scrollView.scrollY else banner.height) 45 | } 46 | }) 47 | scrollView.setOnScrollChangeListener { _: NestedScrollView?, _: Int, scrollY: Int, _: Int, oldScrollY: Int -> 48 | Log.d("NestedScrollView", String.format("scrollY=%d oldScrollY=%d ", scrollY, oldScrollY)) 49 | onScrollChange(scrollY) 50 | } 51 | 52 | refreshHorizontal.setEnableOverScrollBounce(false) 53 | refreshHorizontal.setOnLoadMoreListener { 54 | viewPager.currentItem = 1 55 | } 56 | refreshLayout.setOnLoadMoreListener { 57 | viewPager.currentItem = 1 58 | } 59 | 60 | toolbar_btn_go_back.setOnClickListener { 61 | activity?.finish() 62 | } 63 | 64 | StatusBarUtil.immersive(activity) 65 | StatusBarUtil.setHeight(activity, toolbar) 66 | StatusBarUtil.setPaddingSmart(activity, toolbar_content) 67 | StatusBarUtil.setPaddingSmart(activity, pager1) 68 | StatusBarUtil.setPaddingSmart(activity, pager2) 69 | } 70 | 71 | private fun onScrollChange(scrollY: Int) { 72 | val percent = min(1f * scrollY / (banner.height+1), 1f) 73 | tabLayout.alpha = percent 74 | tabBackground.alpha = percent 75 | Log.d("NestedScrollView", String.format("alpha=%f", percent)) 76 | 77 | val dark = percent > 0.4 78 | if (dark != darkMode) { 79 | darkMode = dark 80 | StatusBarUtil.darkMode(activity, dark) 81 | } 82 | 83 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 84 | val colorFront:Int = 0xff666666.toInt() 85 | val colorBackground = 0xffffffff.toInt() 86 | val colorAlpha = ColorUtils.setAlphaComponent(colorFront, (percent * 255).toInt()) 87 | val color = ColorUtils.compositeColors(colorAlpha, colorBackground) 88 | toolbar_btn_more.drawable.setTint(color) 89 | toolbar_btn_go_back.drawable.setTint(color) 90 | toolbar_btn_trolley.drawable.setTint(color) 91 | 92 | toolbar_btn_more.background.alpha = ((1-percent) * 255).toInt() 93 | toolbar_btn_go_back.background.alpha = ((1-percent) * 255).toInt() 94 | toolbar_btn_trolley.background.alpha = ((1-percent) * 255).toInt() 95 | } 96 | } 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/fragment/PracticePagerFragment.kt: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.fragment 2 | 3 | 4 | import android.graphics.drawable.Animatable 5 | import android.os.Bundle 6 | import android.support.v4.app.Fragment 7 | import android.view.LayoutInflater 8 | import android.view.View 9 | import android.view.ViewGroup 10 | import com.scwang.smart.refresh.layout.api.RefreshHeader 11 | import com.scwang.smart.refresh.layout.simple.SimpleMultiListener 12 | 13 | import com.scwang.smartrefresh.horizontal.demo.R 14 | import kotlinx.android.synthetic.main.fragment_practice_pager.* 15 | import kotlinx.android.synthetic.main.fragment_practice_pager.refreshLayout 16 | 17 | /** 18 | * A simple [Fragment] subclass. 19 | * 20 | */ 21 | class PracticePagerFragment : Fragment() { 22 | 23 | override fun onCreateView( 24 | inflater: LayoutInflater, container: ViewGroup?, 25 | savedInstanceState: Bundle? 26 | ): View? { 27 | // Inflate the layout for this fragment 28 | return inflater.inflate(R.layout.fragment_practice_pager, container, false) 29 | } 30 | 31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 32 | super.onViewCreated(view, savedInstanceState) 33 | 34 | toolbar.setNavigationOnClickListener { 35 | activity?.finish() 36 | } 37 | 38 | refreshLayout.setEnableOverScrollBounce(false) 39 | refreshLayout.setOnMultiListener(object : SimpleMultiListener() { 40 | override fun onHeaderStartAnimator(h: RefreshHeader?, footerHeight: Int, maxDragHeight: Int) { 41 | (header.drawable as? Animatable)?.start() 42 | } 43 | override fun onHeaderFinish(h: RefreshHeader?, success: Boolean) { 44 | (header.drawable as? Animatable)?.stop() 45 | } 46 | }); 47 | 48 | refreshLayout.setOnRefreshListener { 49 | refreshLayout.finishRefresh(1500) 50 | } 51 | refreshLayout.setOnLoadMoreListener { 52 | refreshLayout.finishLoadMore(1000) 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/fragment/index/IndexHomeFragment.kt: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.fragment.index 2 | 3 | import android.R.layout.simple_list_item_2 4 | import android.os.Bundle 5 | import android.support.annotation.StringRes 6 | import android.support.v4.app.Fragment 7 | import android.view.LayoutInflater 8 | import android.view.View 9 | import android.view.ViewGroup 10 | import com.scwang.smartrefresh.horizontal.demo.R 11 | import com.scwang.smart.refresh.horizontal.demo.activity.FragmentActivity 12 | import com.scwang.smart.refresh.horizontal.demo.adapter.BaseRecyclerAdapter 13 | import com.scwang.smart.refresh.horizontal.demo.adapter.SmartViewHolder 14 | import com.scwang.smart.refresh.horizontal.demo.fragment.ExampleBasicFragment 15 | import com.scwang.smart.refresh.horizontal.demo.fragment.PracticeGoodsFragment 16 | import com.scwang.smart.refresh.horizontal.demo.fragment.PracticePagerFragment 17 | import kotlinx.android.synthetic.main.fragment_index_home.* 18 | import kotlin.reflect.KClass 19 | 20 | class IndexHomeFragment : Fragment() { 21 | 22 | enum class HomeItem(@StringRes val titleId: Int, @StringRes val descriptionId: Int, val fragment: KClass) { 23 | Goods(R.string.practice_goods_fragment_title, R.string.practice_goods_fragment_description, PracticeGoodsFragment::class), 24 | Pager(R.string.practice_pager_fragment_title,R.string.practice_pager_fragment_description, PracticePagerFragment::class), 25 | More(R.string.example_basic_fragment_title,R.string.example_basic_fragment_description, ExampleBasicFragment::class) 26 | } 27 | 28 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 29 | return inflater.inflate(R.layout.fragment_index_home, container, false) 30 | } 31 | 32 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 33 | super.onViewCreated(view, savedInstanceState) 34 | 35 | val adapter = object : BaseRecyclerAdapter( 36 | HomeItem.values().asList(), simple_list_item_2) { 37 | override fun onBindViewHolder(holder: SmartViewHolder, model: HomeItem, position: Int) { 38 | holder.text(android.R.id.text1, model.titleId) 39 | holder.text(android.R.id.text2, model.descriptionId) 40 | } 41 | } 42 | adapter.setOnItemClickListener { _, _, i, _ -> 43 | adapter.get(i)?.also { item-> 44 | FragmentActivity.start(activity, item.fragment.java) 45 | } 46 | } 47 | recyclerView.adapter = adapter 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/util/StatusBarUtil.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.util; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.res.Resources; 6 | import android.os.Build; 7 | import android.support.annotation.FloatRange; 8 | import android.support.annotation.RequiresApi; 9 | import android.util.Log; 10 | import android.util.TypedValue; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import android.view.Window; 14 | import android.view.WindowManager; 15 | 16 | import java.lang.reflect.Field; 17 | import java.lang.reflect.Method; 18 | import java.util.regex.Pattern; 19 | 20 | /** 21 | * 状态栏透明 22 | * Created by SCWANG on 2016/10/26. 23 | */ 24 | 25 | @SuppressWarnings("unused") 26 | public class StatusBarUtil { 27 | 28 | public static int DEFAULT_COLOR = 0; 29 | public static float DEFAULT_ALPHA = 0;//Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? 0.2f : 0.3f; 30 | public static final int MIN_API = 19; 31 | 32 | // 33 | public static void immersive(Activity activity) { 34 | immersive(activity, DEFAULT_COLOR, DEFAULT_ALPHA); 35 | } 36 | 37 | public static void immersive(Activity activity, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 38 | immersive(activity.getWindow(), color, alpha); 39 | } 40 | 41 | public static void immersive(Activity activity, int color) { 42 | immersive(activity.getWindow(), color, 1f); 43 | } 44 | 45 | public static void immersive(Window window) { 46 | immersive(window, DEFAULT_COLOR, DEFAULT_ALPHA); 47 | } 48 | 49 | public static void immersive(Window window, int color) { 50 | immersive(window, color, 1f); 51 | } 52 | 53 | public static void immersive(Window window, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 54 | if (Build.VERSION.SDK_INT >= 21) { 55 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 56 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 57 | window.setStatusBarColor(mixtureColor(color, alpha)); 58 | 59 | int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); 60 | systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; 61 | systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; 62 | window.getDecorView().setSystemUiVisibility(systemUiVisibility); 63 | } else if (Build.VERSION.SDK_INT >= 19) { 64 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 65 | setTranslucentView((ViewGroup) window.getDecorView(), color, alpha); 66 | } else if (Build.VERSION.SDK_INT >= MIN_API && Build.VERSION.SDK_INT > 16) { 67 | int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); 68 | systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; 69 | systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; 70 | window.getDecorView().setSystemUiVisibility(systemUiVisibility); 71 | } 72 | } 73 | 74 | public static void color(Activity activity, int color) { 75 | if (Build.VERSION.SDK_INT >= 21) { 76 | Window window = activity.getWindow(); 77 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 78 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 79 | window.setStatusBarColor(color); 80 | } 81 | } 82 | // 83 | 84 | // 85 | public static void darkMode(Activity activity, boolean dark) { 86 | if (isFlyme4Later()) { 87 | darkModeForFlyme4(activity.getWindow(), dark); 88 | } else if (isMIUI6Later()) { 89 | darkModeForMIUI6(activity.getWindow(), dark); 90 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 91 | darkModeForM(activity.getWindow(), dark); 92 | } 93 | } 94 | 95 | public static void darkModeCancel(Activity activity) { 96 | Window window = activity.getWindow(); 97 | if (isFlyme4Later()) { 98 | darkModeForFlyme4(window, false); 99 | } else if (isMIUI6Later()) { 100 | darkModeForMIUI6(window, false); 101 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 102 | darkModeForM(window, false); 103 | } 104 | } 105 | 106 | /** 设置状态栏darkMode,字体颜色及icon变黑(目前支持MIUI6以上,Flyme4以上,Android M以上) */ 107 | public static void darkMode(Activity activity) { 108 | darkMode(activity.getWindow(), DEFAULT_COLOR, DEFAULT_ALPHA); 109 | } 110 | 111 | public static void darkMode(Activity activity, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 112 | darkMode(activity.getWindow(), color, alpha); 113 | } 114 | 115 | public static void darkOnly(Activity activity) { 116 | Window window = activity.getWindow(); 117 | if (isFlyme4Later()) { 118 | darkModeForFlyme4(window, true); 119 | } else if (isMIUI6Later()) { 120 | darkModeForMIUI6(window, true); 121 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 122 | darkModeForM(window, true); 123 | } 124 | } 125 | 126 | /** 设置状态栏darkMode,字体颜色及icon变黑(目前支持MIUI6以上,Flyme4以上,Android M以上) */ 127 | public static void darkMode(Window window, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 128 | if (isFlyme4Later()) { 129 | darkModeForFlyme4(window, true); 130 | immersive(window,color,alpha); 131 | } else if (isMIUI6Later()) { 132 | darkModeForMIUI6(window, true); 133 | immersive(window,color,alpha); 134 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 135 | darkModeForM(window, true); 136 | immersive(window, color, alpha); 137 | } else if (Build.VERSION.SDK_INT >= 19) { 138 | window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 139 | setTranslucentView((ViewGroup) window.getDecorView(), color, alpha); 140 | } else { 141 | immersive(window, color, alpha); 142 | } 143 | // if (Build.VERSION.SDK_INT >= 21) { 144 | // window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 145 | // window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 146 | // window.setStatusBarColor(Color.TRANSPARENT); 147 | // } else if (Build.VERSION.SDK_INT >= 19) { 148 | // window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 149 | // } 150 | 151 | // setTranslucentView((ViewGroup) window.getDecorView(), color, alpha); 152 | } 153 | 154 | //-------------------------> 155 | 156 | /** android 6.0设置字体颜色 */ 157 | @RequiresApi(Build.VERSION_CODES.M) 158 | private static void darkModeForM(Window window, boolean dark) { 159 | // window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); 160 | // window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 161 | // window.setStatusBarColor(Color.TRANSPARENT); 162 | 163 | int systemUiVisibility = window.getDecorView().getSystemUiVisibility(); 164 | if (dark) { 165 | systemUiVisibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; 166 | } else { 167 | systemUiVisibility &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; 168 | } 169 | window.getDecorView().setSystemUiVisibility(systemUiVisibility); 170 | } 171 | 172 | /** 173 | * 设置Flyme4+的darkMode,darkMode时候字体颜色及icon变黑 174 | * http://open-wiki.flyme.cn/index.php?title=Flyme%E7%B3%BB%E7%BB%9FAPI 175 | */ 176 | public static boolean darkModeForFlyme4(Window window, boolean dark) { 177 | boolean result = false; 178 | if (window != null) { 179 | try { 180 | WindowManager.LayoutParams e = window.getAttributes(); 181 | Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON"); 182 | Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags"); 183 | darkFlag.setAccessible(true); 184 | meizuFlags.setAccessible(true); 185 | int bit = darkFlag.getInt(null); 186 | int value = meizuFlags.getInt(e); 187 | if (dark) { 188 | value |= bit; 189 | } else { 190 | value &= ~bit; 191 | } 192 | 193 | meizuFlags.setInt(e, value); 194 | window.setAttributes(e); 195 | result = true; 196 | } catch (Exception var8) { 197 | Log.e("StatusBar", "darkIcon: failed"); 198 | } 199 | } 200 | 201 | return result; 202 | } 203 | 204 | /** 205 | * 设置MIUI6+的状态栏是否为darkMode,darkMode时候字体颜色及icon变黑 206 | * http://dev.xiaomi.com/doc/p=4769/ 207 | */ 208 | public static boolean darkModeForMIUI6(Window window, boolean dark) { 209 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 210 | darkModeForM(window, dark); 211 | } 212 | Class clazz = window.getClass(); 213 | try { 214 | int darkModeFlag = 0; 215 | Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams"); 216 | Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE"); 217 | darkModeFlag = field.getInt(layoutParams); 218 | Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class); 219 | extraFlagField.invoke(window, dark ? darkModeFlag : 0, darkModeFlag); 220 | return true; 221 | } catch (Throwable e) { 222 | e.printStackTrace(); 223 | return false; 224 | } 225 | } 226 | 227 | /** 判断是否Flyme4以上 */ 228 | public static boolean isFlyme4Later() { 229 | return Build.FINGERPRINT.contains("Flyme_OS_4") 230 | || Build.VERSION.INCREMENTAL.contains("Flyme_OS_4") 231 | || Pattern.compile("Flyme OS [4|5]", Pattern.CASE_INSENSITIVE).matcher(Build.DISPLAY).find(); 232 | } 233 | 234 | /** 判断是否为MIUI6以上 */ 235 | public static boolean isMIUI6Later() { 236 | try { 237 | Class clz = Class.forName("android.os.SystemProperties"); 238 | Method mtd = clz.getMethod("get", String.class); 239 | String val = (String) mtd.invoke(null, "ro.miui.ui.version.name"); 240 | val = val.replaceAll("[vV]", ""); 241 | int version = Integer.parseInt(val); 242 | return version >= 6; 243 | } catch (Throwable e) { 244 | return false; 245 | } 246 | } 247 | // 248 | 249 | public static void setHeight(Context context, View view) { 250 | if (Build.VERSION.SDK_INT >= MIN_API) { 251 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 252 | if (lp != null && lp.height > 0) { 253 | lp.height += getStatusBarHeight(context);//增高 254 | } 255 | } 256 | } 257 | 258 | /** 增加View的paddingTop,增加的值为状态栏高度 */ 259 | public static void setPadding(Context context, View view) { 260 | if (Build.VERSION.SDK_INT >= MIN_API) { 261 | view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + getStatusBarHeight(context), 262 | view.getPaddingRight(), view.getPaddingBottom()); 263 | } 264 | } 265 | /** 增加View的paddingTop,增加的值为状态栏高度 (智能判断,并设置高度)*/ 266 | public static void setPaddingSmart(Context context, View view) { 267 | if (Build.VERSION.SDK_INT >= MIN_API) { 268 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 269 | if (lp != null && lp.height > 0) { 270 | lp.height += getStatusBarHeight(context);//增高 271 | } 272 | view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + getStatusBarHeight(context), 273 | view.getPaddingRight(), view.getPaddingBottom()); 274 | } 275 | } 276 | 277 | /** 增加View的高度以及paddingTop,增加的值为状态栏高度.一般是在沉浸式全屏给ToolBar用的 */ 278 | public static void setHeightAndPadding(Context context, View view) { 279 | if (Build.VERSION.SDK_INT >= MIN_API) { 280 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 281 | lp.height += getStatusBarHeight(context);//增高 282 | view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + getStatusBarHeight(context), 283 | view.getPaddingRight(), view.getPaddingBottom()); 284 | } 285 | } 286 | /** 增加View上边距(MarginTop)一般是给高度为 WARP_CONTENT 的小控件用的*/ 287 | public static void setMargin(Context context, View view) { 288 | if (Build.VERSION.SDK_INT >= MIN_API) { 289 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 290 | if (lp instanceof ViewGroup.MarginLayoutParams) { 291 | ((ViewGroup.MarginLayoutParams) lp).topMargin += getStatusBarHeight(context);//增高 292 | } 293 | view.setLayoutParams(lp); 294 | } 295 | } 296 | /** 297 | * 创建假的透明栏 298 | */ 299 | public static void setTranslucentView(ViewGroup container, int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 300 | if (Build.VERSION.SDK_INT >= 19) { 301 | int mixtureColor = mixtureColor(color, alpha); 302 | View translucentView = container.findViewById(android.R.id.custom); 303 | if (translucentView == null && mixtureColor != 0) { 304 | translucentView = new View(container.getContext()); 305 | translucentView.setId(android.R.id.custom); 306 | ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams( 307 | ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(container.getContext())); 308 | container.addView(translucentView, lp); 309 | } 310 | if (translucentView != null) { 311 | translucentView.setBackgroundColor(mixtureColor); 312 | } 313 | } 314 | } 315 | 316 | public static int mixtureColor(int color, @FloatRange(from = 0.0, to = 1.0) float alpha) { 317 | int a = (color & 0xff000000) == 0 ? 0xff : color >>> 24; 318 | return (color & 0x00ffffff) | (((int) (a * alpha)) << 24); 319 | } 320 | 321 | /** 获取状态栏高度 */ 322 | public static int getStatusBarHeight(Context context) { 323 | int result = 24; 324 | int resId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); 325 | if (resId > 0) { 326 | result = context.getResources().getDimensionPixelSize(resId); 327 | } else { 328 | result = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 329 | result, Resources.getSystem().getDisplayMetrics()); 330 | } 331 | return result; 332 | } 333 | } 334 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/widget/DetailHorizontalFooter.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.widget; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.NonNull; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | import android.widget.ImageView; 8 | import android.widget.TextView; 9 | 10 | import com.scwang.smart.refresh.horizontal.HorizontalFooter; 11 | import com.scwang.smart.refresh.layout.api.RefreshKernel; 12 | import com.scwang.smart.refresh.layout.api.RefreshLayout; 13 | import com.scwang.smart.refresh.layout.constant.RefreshState; 14 | import com.scwang.smartrefresh.horizontal.demo.R; 15 | 16 | public class DetailHorizontalFooter extends HorizontalFooter { 17 | 18 | private TextView mTvTitle; 19 | private ImageView mIvIcon; 20 | private RefreshKernel mRefreshKernel; 21 | 22 | public DetailHorizontalFooter(Context context) { 23 | this(context, null); 24 | } 25 | 26 | /** 27 | * 构造函数中 加载xml布局,并获取控件 28 | */ 29 | public DetailHorizontalFooter(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | View.inflate(context, R.layout.widget_footer_detail_horizontal, this); 32 | mIvIcon = findViewById(R.id.footer_icon); 33 | mTvTitle = findViewById(R.id.footer_title); 34 | } 35 | 36 | /** 37 | * 初始化中 保存 kernel 核心对象,并关闭自动加载功能 38 | */ 39 | @Override 40 | public void onInitialized(@NonNull RefreshKernel kernel, int height, int maxDragHeight) { 41 | super.onInitialized(kernel, height, maxDragHeight); 42 | mRefreshKernel = kernel; 43 | kernel.getRefreshLayout().setEnableAutoLoadMore(false); 44 | } 45 | 46 | /** 47 | * 重写 onStartAnimator,在开始动画的时候,直接关闭刷新, 48 | * 因为本Footer不需要任何加载,仅仅触发事件之后直接关闭 49 | */ 50 | @Override 51 | public void onStartAnimator(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) { 52 | if (mRefreshKernel != null) { 53 | mRefreshKernel.setState(RefreshState.None); 54 | //onReleased 的时候 调用 setState(RefreshState.None); 并不会立刻改变成 None 55 | //而是先执行一个回弹动画,LoadFinish 是介于 Refreshing 和 None 之间的状态 56 | //LoadFinish 用于在回弹动画结束时候能顺利改变为 None 57 | mRefreshKernel.setState(RefreshState.LoadFinish); 58 | } 59 | } 60 | 61 | /** 62 | * 状态改变时 更新界面 63 | */ 64 | @Override 65 | public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) { 66 | if (newState == RefreshState.ReleaseToLoad) { 67 | mIvIcon.animate().rotation(270); 68 | mTvTitle.setText(R.string.footer_detail_horizontal_release); 69 | } else { 70 | mIvIcon.animate().rotation(90); 71 | mTvTitle.setText(R.string.footer_detail_horizontal_pulling); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/scwang/smart/refresh/horizontal/demo/widget/SmartViewPager.java: -------------------------------------------------------------------------------- 1 | package com.scwang.smart.refresh.horizontal.demo.widget; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.support.annotation.IdRes; 6 | import android.support.annotation.NonNull; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.view.PagerAdapter; 9 | import android.support.v4.view.ViewPager; 10 | import android.util.AttributeSet; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | import com.scwang.smartrefresh.horizontal.demo.R; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * 智能分页器 20 | */ 21 | public class SmartViewPager extends ViewPager { 22 | 23 | 24 | private SmartPagerAdapter mAdapter; 25 | 26 | public SmartViewPager(Context context) { 27 | super(context); 28 | } 29 | 30 | public SmartViewPager(Context context, AttributeSet attrs) { 31 | super(context, attrs); 32 | } 33 | 34 | /** 35 | * @param id the id of the view to be found 36 | * @return the view of the specified id, null if cannot be found 37 | */ 38 | @SuppressWarnings({"unchecked", "unused"}) 39 | protected T findViewTraversal(@IdRes int id) { 40 | if (mAdapter != null && mAdapter.views != null) { 41 | for (View view : mAdapter.views) { 42 | View find = view.findViewById(id); 43 | if (find != null) { 44 | return (T)find; 45 | } 46 | } 47 | } 48 | for (int i = 0, len = getChildCount(); i < len; i++) { 49 | View child = getChildAt(i); 50 | View find = child.findViewById(id); 51 | if (find != null) { 52 | return (T)find; 53 | } 54 | } 55 | if (getId() == id) { 56 | return (T)this; 57 | } 58 | return null; 59 | } 60 | 61 | @Override 62 | protected void onFinishInflate() { 63 | super.onFinishInflate(); 64 | int childCount = getChildCount(); 65 | if (getAdapter() == null) { 66 | if (childCount > 0) { 67 | setAdapter(mAdapter = new SmartPagerAdapter()); 68 | removeAllViews(); 69 | } 70 | } else if (childCount > 0) { 71 | removeAllViews(); 72 | } 73 | } 74 | 75 | @Override 76 | protected void onAttachedToWindow() { 77 | super.onAttachedToWindow(); 78 | int childCount = getChildCount(); 79 | if (getAdapter() == null) { 80 | if (childCount > 0) { 81 | setAdapter(mAdapter = new SmartPagerAdapter()); 82 | removeAllViews(); 83 | } 84 | } else if (childCount > 0) { 85 | removeAllViews(); 86 | } 87 | } 88 | 89 | @Override 90 | protected void onDetachedFromWindow() { 91 | super.onDetachedFromWindow(); 92 | if (mAdapter != null) { 93 | setAdapter(null); 94 | for (View view : mAdapter.views) { 95 | addView(view); 96 | } 97 | mAdapter = null; 98 | } 99 | } 100 | 101 | // 102 | @Override 103 | public LayoutParams generateLayoutParams(AttributeSet attrs) { 104 | final View thisView = this; 105 | return new LayoutParams(thisView.getContext(), attrs); 106 | } 107 | 108 | public static class LayoutParams extends ViewPager.LayoutParams { 109 | 110 | LayoutParams(Context context, AttributeSet attrs) { 111 | super(context, attrs); 112 | TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartViewPager_Layout); 113 | title = ta.getString(R.styleable.SmartViewPager_Layout_layout_svpTitle); 114 | ta.recycle(); 115 | } 116 | 117 | String title; 118 | } 119 | // 120 | 121 | class SmartPagerAdapter extends PagerAdapter { 122 | 123 | List views; 124 | 125 | SmartPagerAdapter() { 126 | int count = getChildCount(); 127 | views = new ArrayList<>(count); 128 | for (int i = 0; i < count; i++) { 129 | views.add(getChildAt(i)); 130 | } 131 | } 132 | 133 | @Nullable 134 | @Override 135 | public CharSequence getPageTitle(int position) { 136 | View view = views.get(position); 137 | ViewGroup.LayoutParams lp = view.getLayoutParams(); 138 | if (lp instanceof LayoutParams) { 139 | if (((LayoutParams) lp).title != null) { 140 | return ((LayoutParams) lp).title; 141 | } 142 | } 143 | return super.getPageTitle(position); 144 | } 145 | 146 | @Override 147 | public int getCount() { 148 | return views.size(); 149 | } 150 | 151 | @Override 152 | public boolean isViewFromObject(@NonNull View view, @NonNull Object o) { 153 | return view == o; 154 | } 155 | 156 | @NonNull 157 | @Override 158 | public Object instantiateItem(@NonNull ViewGroup container, int position) { 159 | container.addView(views.get(position)); 160 | return views.get(position); 161 | } 162 | 163 | @Override 164 | public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { 165 | container.removeView((View)object); 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /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/bg_panel_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_panel_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_panel_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_round_alpha.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_tab_selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_chevron_right_gray.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dashboard_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_footer_detail_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_more_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_navigate_before_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_service_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_star_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_store_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_trolley_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/loading_rabbit.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 21 | 22 | 29 | 30 | 31 | 32 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_example_horizontal.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | 22 | 25 | 33 | 36 | 37 | 38 |