├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── BeautifulRefreshLayout.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cjj │ │ └── beautifulrefreshlayout │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── cjj │ │ └── beautifulrefreshlayout │ │ ├── MainActivity.java │ │ ├── MainApplication.java │ │ └── SampleListFragment.java │ └── res │ ├── drawable-hdpi │ ├── bb.jpg │ ├── cc.jpg │ ├── ic_dashboard.png │ ├── ic_discuss.png │ ├── ic_done.png │ ├── ic_event.png │ ├── ic_forum.png │ ├── ic_headset.png │ └── ic_menu.png │ ├── layout │ ├── activity_main.xml │ ├── fragment_list.xml │ ├── fragment_test.xml │ ├── include_list_viewpager.xml │ ├── list_item.xml │ └── nav_header.xml │ ├── menu │ ├── drawer_view.xml │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v19 │ └── theme.xml │ ├── values-v21 │ └── theme.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ └── theme.xml ├── beautifulrefreshlibrary ├── .gitignore ├── beautifulrefreshlibrary.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cjj │ │ └── refresh │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── cjj │ │ └── refresh │ │ ├── BeautifulRefreshLayout.java │ │ ├── DensityUtil.java │ │ ├── PullToRefreshListener.java │ │ ├── PullWaveListener.java │ │ ├── Rain.java │ │ ├── RainView.java │ │ ├── RefreshLayout.java │ │ ├── RippleView.java │ │ ├── RoundDotView.java │ │ ├── RoundProgressView.java │ │ └── WaveView.java │ └── res │ ├── drawable │ └── gg.jpg │ ├── layout │ └── view_head.xml │ └── values │ ├── colors.xml │ └── strings.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | BeautifulRefreshLayout -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.7 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BeautifulRefreshLayout.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BeautifulRefreshLayout 2 | ========================================= 3 | 4 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-BeautifulRefreshLayout-brightgreen.svg?style=flat)](http://www.android-arsenal.com/details/1/2488) 5 | GitHub小伙伴交流群'' 477826523,很难进的哦! 6 | 7 | 众多优秀的下拉刷新(除了我写的之外T_T) 8 | ----------------------------------------------------------------------------------------------------------------------------- 9 | 说起下拉刷新,好像经历一段历史的洗礼。。。 10 | 11 | (1)在我刚学android的时候,用的是XListView,在github上搜索有[MarkMjw/PullToRefresh](https://github.com/MarkMjw/PullToRefresh),根据Maxwin的XListView改造而来,完善下拉刷新上拉加载更多的功能并实现自动刷新以及自动加载等功能, 并增加对ScrollView的支持。 原XListView参考链接:https://github.com/Maxwin-z/XListView-Android(听说原作者停止维护了) 12 | ![](https://camo.githubusercontent.com/d5987bf40a04dc9894fb0ea814515088b8afd7d6/68747470733a2f2f7261772e6769746875622e636f6d2f4d61726b4d6a772f50756c6c546f526566726573682f6d61737465722f53637265656e73686f74732f312e706e67) 13 | 14 | (2)然后又学了[chrisbanes/Android-PullToRefresh](https://github.com/chrisbanes/Android-PullToRefresh)的那个库,这个库牛逼到要死,支持ListView、ExpandableListView、GridView、WebView、ScrollView、HorizontalScrollView、ViewPager、ListFragment、、、 15 | 16 | ![](https://github.com/chrisbanes/Android-PullToRefresh/raw/master/header_graphic.png) 17 | 18 | 自己也侮辱了这个库,改的乱七八糟[https://github.com/android-cjj/ComicReader/tree/master/YinHunPulltoRefreshLibrary](https://github.com/android-cjj/ComicReader/tree/master/YinHunPulltoRefreshLibrary),增加了支持瀑布流刷新的功能和下拉动画效果的。。。。 19 | 20 | ![](https://camo.githubusercontent.com/1b016544f28f6abe5775f9b8fdde4ece8c874263/687474703a2f2f7777772e61706b6275732e636f6d2f646174612f6174746163686d656e742f666f72756d2f3230313530342f31342f3039313630366570766f63636e6e38376f67387a38742e706e67) 21 | 22 | (3)那时候看了知乎的客户端,下拉刷新很炫,查了下是用什么实现的,最终知道是用[chrisbanes/ActionBar-PullToRefresh](https://github.com/chrisbanes/ActionBar-PullToRefresh)的库可以实现那种效果,又去学了,啊哈哈,然而过些日子也没见人用了,啊哈哈哈 23 | 24 | ![](https://github.com/chrisbanes/ActionBar-PullToRefresh/raw/master/header.png) 25 | 26 | (4)这时候google也有自己的下拉控件SwipeRefreshLayout,刚出来的效果,一条加载直线,个人觉得,一般到要死。[stormzhang/SwipeRefreshLayoutDemo](https://github.com/stormzhang/SwipeRefreshLayoutDemo)写了demo。 27 | 28 | ![](https://camo.githubusercontent.com/9c0181efd67b9b7f080a1526311eba64485539c2/687474703a2f2f73746f726d7a68616e672e6769746875622e696f2f696d6167652f5377697065526566726573684c61796f75742e676966) 29 | 30 | android 5.0之后效果是个加载圆圈,还可以接受了,现在很多应用都用这个 31 | 32 | ![](https://camo.githubusercontent.com/736dc88d160cc23793bc8193bbbe7b9009d5501e/687474703a2f2f7777332e73696e61696d672e636e2f626d6964646c652f3564343330393737677731656c6b357237736b73756732306234306a726232392e676966) 33 | 34 | (5)这时又看到了[baoyongzhang/android-PullRefreshLayout](https://github.com/baoyongzhang/android-PullRefreshLayout),This component like SwipeRefreshLayout, it is more beautiful than SwipeRefreshLayout.就是比google的跟漂亮。呵呵! 35 | 36 | ![](https://raw.githubusercontent.com/baoyongzhang/android-PullRefreshLayout/master/demo.gif) 37 | 38 | (6)同时,这里也要提下[liaohuqiu/android-Ultra-Pull-To-Refresh](https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh),已经强大到什么控件都能适用刷新了,相信你也听过了 39 | 40 | ![](https://camo.githubusercontent.com/88cdf877aa0a1fb19506ecf3404447eba59e68cc/687474703a2f2f737261696e2d6769746875622e71696e6975646e2e636f6d2f756c7472612d7074722f6175746f2d726566726573682e676966) 41 | 42 | (7)看过最有创意的下拉刷新[FlyRefresh](https://github.com/race604/FlyRefresh),一只飞机飞啊飞,然而并没有什么卵用..... 43 | 44 | ![](https://github.com/race604/FlyRefresh/blob/master/images/flyrefresh.gif) 45 | 46 | (8)material设计已经深入到开发者的心里,然后 我看到了A pull-down-to-refresh layout inspired by Lollipop overscrolled effects 47 | [allan1st/JellyRefreshLayout](https://github.com/allan1st/JellyRefreshLayout),我这个也是看人家的代码实现的,十分感谢,啊哈哈 48 | 49 | ![](https://github.com/allan1st/JellyRefreshLayout/blob/master/images/preview.gif) 50 | 51 | (9)最近看的下拉刷新也是挺奇怪的,就比如[recruit-lifestyle/BeerSwipeRefresh](https://github.com/recruit-lifestyle/BeerSwipeRefresh)啤酒下拉刷新和[recruit-lifestyle/WaveSwipeRefreshLayout](https://github.com/recruit-lifestyle/WaveSwipeRefreshLayout)水滴下拉刷新... 52 | 53 | ![](https://github.com/recruit-lifestyle/BeerSwipeRefresh/blob/master/sc/animation_beer.gif) 54 | ![](https://github.com/recruit-lifestyle/WaveSwipeRefreshLayout/blob/master/sc/animation.gif) 55 | 56 | (10)这个是网友推荐的[SuperSwipeRefreshLayout](https://github.com/nuptboyzhb/SuperSwipeRefreshLayout),顾名思义,是扩展自SwipeRefreshLayout。 57 | ![](https://github.com/nuptboyzhb/SuperSwipeRefreshLayout/raw/master/demo.gif) 58 | 59 | (11)这个是Yalantis公司开发的下拉刷新,其中它的很多东西动画这块,做的非常漂亮[Yalantis/Phoenix](https://github.com/Yalantis/Phoenix) 60 | ![](https://camo.githubusercontent.com/d406ac5a03a2b1fa5cf41fadc8d2408cb8709bdc/68747470733a2f2f6431337961637572716a676172612e636c6f756466726f6e742e6e65742f75736572732f3132353035362f73637265656e73686f74732f313635303331372f7265616c6573746174652d70756c6c5f312d322d332e676966) 61 | 62 | [Taurus](https://github.com/Yalantis/Taurus)又是飞机飞啊飞... 63 | ![](https://camo.githubusercontent.com/3a24e22eb3f8338573dba0701c089c12f6b70f11/68747470733a2f2f6431337961637572716a676172612e636c6f756466726f6e742e6e65742f75736572732f3132353035362f73637265656e73686f74732f313632333133312f746f7572732d70756c6c2d616972706c616e655f322d322d332e676966) 64 | 65 | (12)[tuesda/CircleRefreshLayout](https://github.com/tuesda/CircleRefreshLayout)的下拉刷新,动画做的很不错,设计图来源[https://dribbble.com/shots/1797373-Pull-Down-To-Refresh](https://dribbble.com/shots/1797373-Pull-Down-To-Refresh) 66 | 67 | ![](https://github.com/tuesda/CircleRefreshLayout/blob/master/gif/circlerefresh.gif) 68 | 69 | (13)[BeautifulRefreshLayoutForFood](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForFood) 70 | 71 | 看到一个很漂亮的美食下拉刷新[(来源地址)](https://dribbble.com/shots/2096383-Pull-To-Refresh-V2?list=users&offset=1) ,可惜技术水平菜菜的,只能模仿一下下,啊哈哈。。。[源码下载地址download](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForFood) 72 | 73 | ![](http://www.apkbus.com/data/attachment/forum/201508/06/101826dztai4gnnfmgmuql.gif) 74 | 75 | (14)[BeautifulRefreshLayoutForNaruto](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForNaruto) 76 | 77 | 闲着蛋疼,写了个血轮眼下拉刷新的,虽然火影漫画完结了,但是动画还在继续,真的是挂漫天飞。。。。[(源码下载地址download)](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForNaruto) 78 | 79 | ![](http://www.apkbus.com/data/attachment/forum/201508/21/155921wqhrrbufrj6ghhet.gif) 80 | 81 | (15)[bingoogolapple/BGARefreshLayout-Android](https://github.com/bingoogolapple/BGARefreshLayout-Android)多种下拉刷新效果、上拉加载更多、可配置自定义头部广告位... 82 | 83 | ![](https://camo.githubusercontent.com/f609f7944250a6607e5fdec8b12b3156df569cd7/687474703a2f2f37786b39646a2e636f6d312e7a302e676c622e636c6f7564646e2e636f6d2f726566726573686c61796f75742f73637265656e73686f74732f726566726573686c61796f7574312e676966) 84 | 85 | 86 | (16)[BeautifulRefreshLayoutForGirl](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForGirl) 87 | 88 | 这是一个小清新的下拉刷新,纯代码绘制,无需任何图片,Recyclerview中item展示的妹子图来自[http://gank.io/](http://gank.io/) 89 | 90 | 设计图来源,当然我实现的效果做了一些修改,希望你喜欢,呵呵。。。[源码下载地址download](https://github.com/android-cjj/BeautifulRefreshLayout/tree/BeautifulRefreshForGirl) 91 | [pull to refresh by Michael Lanning](https://dribbble.com/shots/1936194-Pull-To-Refresh) 92 | 截图 93 | ------------------------------------------------------------------------------------------------------- 94 | ![](http://ww3.sinaimg.cn/mw690/7ef01fcagw1f2dmpn54zjg20be0i2u0x.gif) 95 | 96 | (17)[BeautifulRefreshLayoutForRain](https://github.com/android-cjj/BeautifulRefreshLayout) 97 | 98 | 这是一个下雨刷新,你没听错,确实一刷新就下雨,为什么会出现,只是我的好奇心而做的东西,见怪不怪了,呵呵。。。 99 | 100 | ![](http://www.apkbus.com/data/attachment/forum/201509/01/140049ia4d2w588wkvnkkl.gif) 101 | 102 | (18)[Android-MaterialRefreshLayout](https://github.com/android-cjj/Android-MaterialRefreshLayout)是我最近写的, it is more beautiful and powerful than SwipeRefreshLayout , 下拉刷新拥有侵入式,非侵入式,覆盖式,非覆盖式,自动刷新,上拉加载更多,自动加载等功能...... 103 | 104 | ![](https://raw.githubusercontent.com/android-cjj/Android-MaterialRefreshLayout/master/gif/cjj1.gif) 105 | 106 | (19)[WaveRefreshForAndroid](https://github.com/alienjun/WaveRefreshForAndroid)这个是基于[Android-PullToRefresh](https://github.com/chrisbanes/Android-PullToRefresh)修改的而成的水波纹下拉刷新...可能作者主攻ios,所以ios的效果看起来好看点[WaveRefresh](https://github.com/alienjun/WaveRefresh)... 107 | 108 | ![](https://github.com/alienjun/WaveRefreshForAndroid/raw/master/Sceenshots/screenshot2.gif) 109 | 110 | (20)[WaterDropListView](https://github.com/THEONE10211024/WaterDropListView)如果你用过ios的qq,那应该很熟悉这种刷新了,效果还是蛮不错的,就是不知道为什么android版本的qq不用,呵呵。。。 111 | 112 | ![](https://github.com/THEONE10211024/WaterDropListView/blob/master/demo/demo.gif) 113 | 114 | (21)[SwipeRefreshRecyclerView](https://github.com/liangzhitao/SwipeRefreshRecyclerView) 115 | 一个展示 RecyclerView 下拉刷新和上拉加载更多的 Demo 116 | 完全使用原生控件实现非侵入式的下拉刷新和加载更多。 117 | 同时也是 Ailurus 练习 RxJava 的小例子。 118 | 使用HeaderViewRecyclerAdapter完成了加载更多的进度展示 119 | 120 | ![](https://github.com/liangzhitao/SwipeRefreshRecyclerView/raw/master/RefreshRecyclerView.gif) 121 | 122 | (22)阿拉灯神灯写的两个下拉库[AutoHomeRefreshListView](https://github.com/nugongshou110/AutoHomeRefreshListView)仿汽车之家下拉刷新和[MeiTuanRefreshListView](https://github.com/nugongshou110/MeiTuanRefreshListView)仿美团下拉刷新。。。 123 | 124 | ![](https://camo.githubusercontent.com/21127410f6f8231ed424ebaf76ea3d20c6a4f7d9/687474703a2f2f696d672e626c6f672e6373646e2e6e65742f3230313531313031313435373033323730) 125 | ![](https://camo.githubusercontent.com/568acac94970a1b71140832d377a3dd4912ebf9c/687474703a2f2f696d672e626c6f672e6373646e2e6e65742f3230313531303330323234313334353736) 126 | 127 | (23)[XRecyclerView](https://github.com/jianghejie/XRecyclerView)a RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView 128 | 129 | ![](http://ww1.sinaimg.cn/bmiddle/a19d4f8dgw1eygq566u33g20ak0irhdu.gif) 130 | 131 | (24)[ChromeLikeSwipeLayout](https://github.com/ashqal/ChromeLikeSwipeLayout)这个效果蛮赞的,细节做的很好。。。。Pull down, and execute more action! 132 | 133 | ![](https://raw.githubusercontent.com/ashqal/ChromeLikeSwipeLayout/master/screenshot/DemoPreview.gif) 134 | 135 | (25)下拉玩消格子游戏[HitBlockRefresh](https://github.com/Hitomis/HitBlockRefresh), 一边下拉刷新,一边打砖块. 136 | 137 | ![](https://raw.githubusercontent.com/Hitomis/HitBlockRefresh/master/preview/HitBlock.gif) 138 | 139 | * 温馨提示:如需RecyclerView加载更多,请参考:[https://github.com/android-cjj/Android-RecyclerViewWithFooter](https://github.com/android-cjj/Android-RecyclerViewWithFooter) 140 | 141 | 142 | 143 | 144 | 145 | 写在最后 146 | ================================================================================= 147 | 这个仓库我会一直维护,有时间也会写一些比较有意思的下拉刷新,只是技术有限,不要吐槽给建议就好,呵呵。。。同时,也希望你们能介绍一些比较好的下拉刷新的库给我,让更多人知道有这个东西,大家一起交流学习,一起进步。欢迎随时关注,记得star哦,呵呵! 148 | If you want to support me,you can follow me on Github: 149 | [https://github.com/android-cjj](https://github.com/android-cjj). 150 | 151 | 随意说说 152 | ----------------------------- 153 | 刚建了个[github小伙伴交流群](http://t.cn/RyiVjnv)(477826523),有兴趣的朋友可以加进来的...小小要求:github有至少7个关注者或者开源库有7颗星星的... 154 | 155 | ****************************转载请注明出处,不然我咬你哦!************************ 156 | 157 | [about me](http://android-cjj.github.io/) 158 | ------------------------------------ 159 | 160 | License 161 | ======= 162 | 163 | The MIT License (MIT) 164 | 165 | Copyright (c) 2015 android-cjj 166 | 167 | Permission is hereby granted, free of charge, to any person obtaining a copy 168 | of this software and associated documentation files (the "Software"), to deal 169 | in the Software without restriction, including without limitation the rights 170 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 171 | copies of the Software, and to permit persons to whom the Software is 172 | furnished to do so, subject to the following conditions: 173 | 174 | The above copyright notice and this permission notice shall be included in all 175 | copies or substantial portions of the Software. 176 | 177 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 178 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 179 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 180 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 181 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 182 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 183 | SOFTWARE. 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 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 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.cjj.beautifulrefreshlayout" 9 | minSdkVersion 14 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.2.0' 25 | compile 'com.android.support:design:22.2.0' 26 | compile project(':beautifulrefreshlibrary') 27 | compile 'com.android.support:recyclerview-v7:22.2.0' 28 | compile 'com.android.support:cardview-v7:22.2.0' 29 | } 30 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\as\sdk-install/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/cjj/beautifulrefreshlayout/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.cjj.beautifulrefreshlayout; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/cjj/beautifulrefreshlayout/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.cjj.beautifulrefreshlayout; 2 | 3 | import android.net.Uri; 4 | import android.os.Bundle; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.design.widget.NavigationView; 7 | import android.support.design.widget.Snackbar; 8 | import android.support.design.widget.TabLayout; 9 | import android.support.v4.app.Fragment; 10 | import android.support.v4.app.FragmentManager; 11 | import android.support.v4.app.FragmentPagerAdapter; 12 | import android.support.v4.view.ViewPager; 13 | import android.support.v4.widget.DrawerLayout; 14 | import android.support.v7.app.ActionBar; 15 | import android.support.v7.app.AppCompatActivity; 16 | import android.support.v7.widget.Toolbar; 17 | import android.view.Menu; 18 | import android.view.MenuItem; 19 | import android.view.View; 20 | 21 | import com.facebook.drawee.backends.pipeline.Fresco; 22 | import com.facebook.drawee.interfaces.DraweeController; 23 | import com.facebook.drawee.view.SimpleDraweeView; 24 | import com.facebook.imagepipeline.request.ImageRequest; 25 | import com.facebook.imagepipeline.request.ImageRequestBuilder; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | public class MainActivity extends AppCompatActivity { 31 | private DrawerLayout mDrawerLayout; 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | setContentView(R.layout.activity_main); 37 | 38 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 39 | setSupportActionBar(toolbar); 40 | 41 | final ActionBar ab = getSupportActionBar(); 42 | ab.setHomeAsUpIndicator(R.drawable.ic_menu); 43 | ab.setDisplayHomeAsUpEnabled(true); 44 | ab.setTitle(null); 45 | 46 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 47 | 48 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 49 | if (navigationView != null) { 50 | setupDrawerContent(navigationView); 51 | } 52 | 53 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); 54 | if (viewPager != null) { 55 | setupViewPager(viewPager); 56 | } 57 | 58 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 59 | fab.setOnClickListener(new View.OnClickListener() { 60 | @Override 61 | public void onClick(View view) { 62 | Snackbar.make(view, "I'm CJJ", Snackbar.LENGTH_LONG) 63 | .setAction("Action", null).show(); 64 | } 65 | }); 66 | 67 | TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); 68 | tabLayout.setupWithViewPager(viewPager); 69 | 70 | } 71 | 72 | @Override 73 | public boolean onCreateOptionsMenu(Menu menu) { 74 | // Inflate the menu; this adds items to the action bar if it is present. 75 | getMenuInflater().inflate(R.menu.menu_main, menu); 76 | return true; 77 | } 78 | 79 | @Override 80 | public boolean onOptionsItemSelected(MenuItem item) { 81 | // Handle action bar item clicks here. The action bar will 82 | // automatically handle clicks on the Home/Up button, so long 83 | // as you specify a parent activity in AndroidManifest.xml. 84 | int id = item.getItemId(); 85 | 86 | //noinspection SimplifiableIfStatement 87 | if (id == R.id.action_settings) { 88 | return true; 89 | } 90 | 91 | return super.onOptionsItemSelected(item); 92 | } 93 | 94 | private void setupViewPager(ViewPager viewPager) { 95 | Adapter adapter = new Adapter(getSupportFragmentManager()); 96 | adapter.addFragment(new SampleListFragment(), "鸣人"); 97 | adapter.addFragment(new SampleListFragment(), "佐助"); 98 | adapter.addFragment(new SampleListFragment(), "小樱"); 99 | viewPager.setAdapter(adapter); 100 | } 101 | 102 | private void setupDrawerContent(NavigationView navigationView) { 103 | navigationView.setNavigationItemSelectedListener( 104 | new NavigationView.OnNavigationItemSelectedListener() { 105 | @Override 106 | public boolean onNavigationItemSelected(MenuItem menuItem) { 107 | menuItem.setChecked(true); 108 | mDrawerLayout.closeDrawers(); 109 | return true; 110 | } 111 | }); 112 | } 113 | 114 | static class Adapter extends FragmentPagerAdapter { 115 | private final List mFragments = new ArrayList<>(); 116 | private final List mFragmentTitles = new ArrayList<>(); 117 | 118 | public Adapter(FragmentManager fm) { 119 | super(fm); 120 | } 121 | 122 | public void addFragment(Fragment fragment, String title) { 123 | mFragments.add(fragment); 124 | mFragmentTitles.add(title); 125 | } 126 | 127 | @Override 128 | public Fragment getItem(int position) { 129 | return mFragments.get(position); 130 | } 131 | 132 | @Override 133 | public int getCount() { 134 | return mFragments.size(); 135 | } 136 | 137 | @Override 138 | public CharSequence getPageTitle(int position) { 139 | return mFragmentTitles.get(position); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /app/src/main/java/com/cjj/beautifulrefreshlayout/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.cjj.beautifulrefreshlayout; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.drawee.backends.pipeline.Fresco; 6 | 7 | /** 8 | * Created by Administrator on 2015/8/6. 9 | */ 10 | public class MainApplication extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | 16 | Fresco.initialize(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cjj/beautifulrefreshlayout/SampleListFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.cjj.beautifulrefreshlayout; 18 | 19 | import android.content.Context; 20 | import android.os.Bundle; 21 | import android.support.annotation.Nullable; 22 | import android.support.v4.app.Fragment; 23 | import android.support.v7.widget.DefaultItemAnimator; 24 | import android.support.v7.widget.LinearLayoutManager; 25 | import android.support.v7.widget.RecyclerView; 26 | import android.view.LayoutInflater; 27 | import android.view.View; 28 | import android.view.ViewGroup; 29 | import android.widget.ImageView; 30 | 31 | 32 | import com.cjj.refresh.BeautifulRefreshLayout; 33 | 34 | import java.util.ArrayList; 35 | import java.util.List; 36 | import java.util.Random; 37 | 38 | public class SampleListFragment extends Fragment { 39 | 40 | @Nullable 41 | @Override 42 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 43 | View v = inflater.inflate( 44 | R.layout.fragment_list, container, false); 45 | BeautifulRefreshLayout beautifulRefreshLayout = (BeautifulRefreshLayout) v.findViewById(R.id.refresh); 46 | beautifulRefreshLayout.setBuautifulRefreshListener(new BeautifulRefreshLayout.BuautifulRefreshListener() { 47 | @Override 48 | public void onRefresh(final BeautifulRefreshLayout refreshLayout) { 49 | // refreshLayout.postDelayed(new Runnable() { 50 | // @Override 51 | // public void run() { 52 | // refreshLayout.finishRefreshing(); 53 | // } 54 | // }, 3000); 55 | // 56 | refreshLayout.post(new Runnable() { 57 | @Override 58 | public void run() { 59 | refreshLayout.finishRefreshing(); 60 | } 61 | }); 62 | 63 | } 64 | }); 65 | 66 | 67 | RecyclerView rv = (RecyclerView) v.findViewById(R.id.recyclerview); 68 | setupRecyclerView(rv); 69 | return v; 70 | } 71 | 72 | private void setupRecyclerView(RecyclerView recyclerView) { 73 | recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext())); 74 | recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(getActivity())); 75 | recyclerView.setItemAnimator(new DefaultItemAnimator()); 76 | } 77 | 78 | private List getRandomSublist(String[] array, int amount) { 79 | ArrayList list = new ArrayList<>(amount); 80 | Random random = new Random(); 81 | while (list.size() < amount) { 82 | list.add(array[random.nextInt(array.length)]); 83 | } 84 | return list; 85 | } 86 | 87 | public static class SimpleStringRecyclerViewAdapter 88 | extends RecyclerView.Adapter { 89 | 90 | 91 | public static class ViewHolder extends RecyclerView.ViewHolder { 92 | 93 | public final ImageView mImageView; 94 | 95 | public ViewHolder(View view) { 96 | super(view); 97 | mImageView = (ImageView) view.findViewById(R.id.avatar); 98 | } 99 | 100 | 101 | } 102 | 103 | public SimpleStringRecyclerViewAdapter(Context context) { 104 | super(); 105 | } 106 | 107 | @Override 108 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 109 | View view = LayoutInflater.from(parent.getContext()) 110 | .inflate(R.layout.list_item, parent, false); 111 | return new ViewHolder(view); 112 | } 113 | 114 | @Override 115 | public void onBindViewHolder(final ViewHolder holder, int position) { 116 | if(position==0) 117 | { 118 | holder.mImageView.setImageResource(R.drawable.bb); 119 | }else if(position == 1) 120 | { 121 | holder.mImageView.setImageResource(R.drawable.cc); 122 | } 123 | 124 | } 125 | 126 | @Override 127 | public int getItemCount() { 128 | return 4; 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/bb.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/cc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/cc.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 25 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_list.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 22 | 23 | 24 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_list_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 29 | 30 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 55 | 56 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | 24 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 26 | 27 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 24 | 28 | 32 | 36 | 37 | 38 | 39 | 40 | 43 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/android-cjj/BeautifulRefreshLayout/2c089a3cdde5bc94df80406c2a4b61d0fec9a1a1/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v19/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #e1e1e1 4 | #673AB7 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BeautifulRefresh 3 | 4 | Hello world! 5 | Settings 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 9 | 10 | 16 | 17 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values/theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 |