├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_done.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_discuss.png │ │ │ ├── ic_event.png │ │ │ ├── ic_forum.png │ │ │ ├── ic_headset.png │ │ │ └── ic_dashboard.png │ │ ├── drawable-mdpi │ │ │ ├── ic_done.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_discuss.png │ │ │ ├── ic_event.png │ │ │ ├── ic_forum.png │ │ │ ├── ic_headset.png │ │ │ └── ic_dashboard.png │ │ ├── drawable-nodpi │ │ │ ├── cheese_1.jpg │ │ │ ├── cheese_2.jpg │ │ │ ├── cheese_3.jpg │ │ │ ├── cheese_4.jpg │ │ │ └── cheese_5.jpg │ │ ├── drawable-xhdpi │ │ │ ├── ic_done.png │ │ │ ├── ic_event.png │ │ │ ├── ic_forum.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_discuss.png │ │ │ ├── ic_headset.png │ │ │ └── ic_dashboard.png │ │ ├── drawable-xxhdpi │ │ │ ├── ic_done.png │ │ │ ├── ic_event.png │ │ │ ├── ic_forum.png │ │ │ ├── ic_menu.png │ │ │ ├── ic_discuss.png │ │ │ ├── ic_headset.png │ │ │ └── ic_dashboard.png │ │ ├── drawable-xxxhdpi │ │ │ ├── ic_done.png │ │ │ └── ic_menu.png │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ ├── test_item.xml │ │ │ ├── fragment_cheese_2_list.xml │ │ │ ├── fragment_cheese_grid_with_header.xml │ │ │ ├── test_head_item.xml │ │ │ ├── fragment_cheese_grid.xml │ │ │ ├── fragment_cheese_list.xml │ │ │ ├── sample_header1.xml │ │ │ ├── sample_header2.xml │ │ │ ├── sample_header.xml │ │ │ ├── nav_header.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_grid.xml │ │ │ ├── activity_linear.xml │ │ │ ├── include_main.xml │ │ │ ├── list_item.xml │ │ │ ├── grid_dialog.xml │ │ │ ├── include_list_viewpager.xml │ │ │ └── activity_detail.xml │ │ ├── menu │ │ │ ├── sample_actions.xml │ │ │ └── drawer_view.xml │ │ ├── values-v21 │ │ │ └── styles.xml │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ ├── dimens.xml │ │ │ └── strings.xml │ │ ├── java │ │ └── com │ │ │ └── support │ │ │ └── android │ │ │ └── designlibdemo │ │ │ ├── GridOperation.java │ │ │ ├── SampleHeader.java │ │ │ ├── SampleHeader1.java │ │ │ ├── SampleHeader2.java │ │ │ ├── adapter │ │ │ └── TestAdapter.java │ │ │ ├── CheeseDetailActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── LinearActivity.java │ │ │ ├── CustomizeFragment.java │ │ │ ├── WithHeaderFragment.java │ │ │ ├── CheeseListFragment.java │ │ │ ├── GridWithHeaderFragment.java │ │ │ ├── CheeseGridFragment.java │ │ │ ├── GridActivity.java │ │ │ ├── StickHeadFragment.java │ │ │ └── Cheeses.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── extendablerecyclerview ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ ├── dm_recyclerview_wrapper_layout.xml │ │ │ │ ├── dm_recyclerview_bottom_progressbar.xml │ │ │ │ ├── dm_recyclerview_vertical.xml │ │ │ │ └── dm_recyclerview_horizontal.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── edus │ │ │ │ └── view │ │ │ │ ├── HeadViewHolder.java │ │ │ │ ├── LoadingViewHolder.java │ │ │ │ ├── sticky │ │ │ │ ├── util │ │ │ │ │ ├── OrientationProvider.java │ │ │ │ │ └── LinearLayoutOrientationProvider.java │ │ │ │ ├── caching │ │ │ │ │ ├── HeaderProvider.java │ │ │ │ │ └── HeaderViewCache.java │ │ │ │ ├── StickyRecyclerHeadersAdapter.java │ │ │ │ ├── calculation │ │ │ │ │ └── DimensionCalculator.java │ │ │ │ ├── rendering │ │ │ │ │ └── HeaderRenderer.java │ │ │ │ ├── StickyRecyclerHeadersDecoration.java │ │ │ │ └── HeaderPositionCalculator.java │ │ │ │ ├── DmBaseViewHolder.java │ │ │ │ ├── DmRecyclerView.java │ │ │ │ ├── decoration │ │ │ │ ├── LinearItemDividerDecoration.java │ │ │ │ └── DividerGridItemDecoration.java │ │ │ │ ├── DmBaseAdapter.java │ │ │ │ └── DmRecyclerViewWrapper.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── dewmobile │ │ │ └── dmrecyclerview │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── dewmobile │ │ └── dmrecyclerview │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── gradle.properties ├── .gitignore ├── .idea └── misc.xml ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /extendablerecyclerview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':extendablerecyclerview', ':app' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DmRecyclerView 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cheese_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-nodpi/cheese_1.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cheese_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-nodpi/cheese_2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cheese_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-nodpi/cheese_3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cheese_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-nodpi/cheese_4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/cheese_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-nodpi/cheese_5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-hdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-mdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xhdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yqpan1991/ExtendableRecyclerView/HEAD/app/src/main/res/drawable-xxhdpi/ic_dashboard.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Sep 03 11:50:12 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/support/android/designlibdemo/GridOperation.java: -------------------------------------------------------------------------------- 1 | package com.support.android.designlibdemo; 2 | 3 | /** 4 | * Created by panda on 2018/1/29. 5 | */ 6 | 7 | public interface GridOperation { 8 | public void setOrientation(int orientation); 9 | public void setSpanCount(int spanCount); 10 | } 11 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/HeadViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.edus.view; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by yqpan on 2016/1/17. 7 | */ 8 | public class HeadViewHolder extends DmBaseViewHolder { 9 | 10 | public HeadViewHolder(View itemView) { 11 | super(itemView); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/LoadingViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.edus.view; 2 | 3 | import android.view.View; 4 | 5 | /** 6 | * Created by Administrator on 2016/1/13. 7 | */ 8 | public class LoadingViewHolder extends DmBaseViewHolder { 9 | 10 | public LoadingViewHolder(View itemView) { 11 | super(itemView); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/sticky/util/OrientationProvider.java: -------------------------------------------------------------------------------- 1 | package com.edus.view.sticky.util; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | 5 | /** 6 | * Interface for getting the orientation of a RecyclerView from its LayoutManager 7 | */ 8 | public interface OrientationProvider { 9 | 10 | public int getOrientation(RecyclerView recyclerView); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/test_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_cheese_2_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/test/java/com/dewmobile/dmrecyclerview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.dewmobile.dmrecyclerview; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_cheese_grid_with_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/DmBaseViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.edus.view; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by yqpan on 2016/1/13. 8 | */ 9 | public class DmBaseViewHolder extends RecyclerView.ViewHolder { 10 | 11 | public DmBaseViewHolder(View itemView) { 12 | super(itemView); 13 | } 14 | 15 | public void updateData(T t, int position){ 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/androidTest/java/com/dewmobile/dmrecyclerview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.dewmobile.dmrecyclerview; 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/res/layout/test_head_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #ExtendableRecyclerView 2 | ##1.支持什么 3 | ExtendableRecyclerView支持的功能如下: 4 | 1. 内部支持下拉刷新和加载更多 5 | 6 | 2. 支持是否允许下拉刷新加载更多 7 | 8 | 3. 复写的adapter支持动态的添加headerView(暂不支持添加其他的footer,目前的加载更多为一个footerView) 9 | 10 | 11 | ##2. 实现原理 12 | 13 | 此封装类为个人在其他的开源项目基础上进行了演变 14 | 之前的UltimateRecyclerView个人认为功能过于繁杂,因而只是取其核心部分,通过封装RecyclerView和SwipeRefreshLayout和加载更多的条目的逻辑 15 | 另外,参照其他的开源项目中,发现其headerView的实现逻辑存在问题,条目类型与headerView的position进行绑定,这个实现逻辑是存在问题的,因而个人将其纠正,每个headerView的type是不同的,并且是支持动态的增加和删除 16 | 17 | 注意: 此工程是采用google的support.design的sample为样例,进行的更改. 18 | 19 | 欢迎各位加入安卓源码分析群: 164812238 20 | 21 | 攀岩不止,永强不息~ 22 | -------------------------------------------------------------------------------- /extendablerecyclerview/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:\dev\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/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 /usr/local/google/home/chrisbanes/bin/current-android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/res/layout/dm_recyclerview_wrapper_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/sticky/caching/HeaderProvider.java: -------------------------------------------------------------------------------- 1 | package com.edus.view.sticky.caching; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | /** 7 | * Implemented by objects that provide header views for decoration 8 | */ 9 | public interface HeaderProvider { 10 | 11 | /** 12 | * Will provide a header view for a given position in the RecyclerView 13 | * 14 | * @param recyclerView that will display the header 15 | * @param position that will be headed by the header 16 | * @return a header view for the given position and list 17 | */ 18 | public View getHeader(RecyclerView recyclerView, int position); 19 | 20 | /** 21 | * TODO: describe this functionality and its necessity 22 | */ 23 | void invalidate(); 24 | } 25 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/res/layout/dm_recyclerview_bottom_progressbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 | 20 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/sticky/util/LinearLayoutOrientationProvider.java: -------------------------------------------------------------------------------- 1 | package com.edus.view.sticky.util; 2 | 3 | import android.support.v7.widget.LinearLayoutManager; 4 | import android.support.v7.widget.RecyclerView; 5 | 6 | /** 7 | * OrientationProvider for ReyclerViews who use a LinearLayoutManager 8 | */ 9 | public class LinearLayoutOrientationProvider implements OrientationProvider { 10 | 11 | @Override 12 | public int getOrientation(RecyclerView recyclerView) { 13 | RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); 14 | 15 | if (layoutManager instanceof LinearLayoutManager) { 16 | return ((LinearLayoutManager) layoutManager).getOrientation(); 17 | } else { 18 | throw new IllegalStateException("StickyListHeadersDecoration can only be used with a " + 19 | "LinearLayoutManager."); 20 | } 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /extendablerecyclerview/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() // or jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:1.5.0' 10 | } 11 | } 12 | 13 | android { 14 | compileSdkVersion 23 15 | buildToolsVersion "23.0.1" 16 | 17 | defaultConfig { 18 | minSdkVersion 9 19 | targetSdkVersion 23 20 | versionCode 1 21 | versionName "1.0" 22 | } 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | compile fileTree(dir: 'libs', include: ['*.jar']) 33 | compile 'com.android.support:appcompat-v7:23.1.1' 34 | compile 'com.android.support:recyclerview-v7:23.1.1' 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/support/android/designlibdemo/SampleHeader.java: -------------------------------------------------------------------------------- 1 | package com.support.android.designlibdemo; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.RelativeLayout; 6 | 7 | /** 8 | * Created by cundong on 2015/10/9. 9 | *

10 | * RecyclerView的HeaderView,简单的展示一个TextView 11 | */ 12 | public class SampleHeader extends RelativeLayout { 13 | 14 | public SampleHeader(Context context) { 15 | super(context); 16 | init(context); 17 | } 18 | 19 | public SampleHeader(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | init(context); 22 | } 23 | 24 | public SampleHeader(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | init(context); 27 | } 28 | 29 | public void init(Context context) { 30 | 31 | inflate(context, R.layout.sample_header, this); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/support/android/designlibdemo/SampleHeader1.java: -------------------------------------------------------------------------------- 1 | package com.support.android.designlibdemo; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.RelativeLayout; 6 | 7 | /** 8 | * Created by cundong on 2015/10/9. 9 | *

10 | * RecyclerView的HeaderView,简单的展示一个TextView 11 | */ 12 | public class SampleHeader1 extends RelativeLayout { 13 | 14 | public SampleHeader1(Context context) { 15 | super(context); 16 | init(context); 17 | } 18 | 19 | public SampleHeader1(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | init(context); 22 | } 23 | 24 | public SampleHeader1(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | init(context); 27 | } 28 | 29 | public void init(Context context) { 30 | 31 | inflate(context, R.layout.sample_header1, this); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/java/com/support/android/designlibdemo/SampleHeader2.java: -------------------------------------------------------------------------------- 1 | package com.support.android.designlibdemo; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.RelativeLayout; 6 | 7 | /** 8 | * Created by cundong on 2015/10/9. 9 | *

10 | * RecyclerView的HeaderView,简单的展示一个TextView 11 | */ 12 | public class SampleHeader2 extends RelativeLayout { 13 | 14 | public SampleHeader2(Context context) { 15 | super(context); 16 | init(context); 17 | } 18 | 19 | public SampleHeader2(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | init(context); 22 | } 23 | 24 | public SampleHeader2(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | init(context); 27 | } 28 | 29 | public void init(Context context) { 30 | 31 | inflate(context, R.layout.sample_header2, this); 32 | } 33 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_cheese_grid.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_cheese_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/sample_actions.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 |

19 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #FFF5F5F5 20 | 21 | #3F51B5 22 | #303F9F 23 | #FF4081 24 | 25 | #F0F0F0 26 | #8A000000 27 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/res/layout/dm_recyclerview_vertical.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/res/layout/dm_recyclerview_horizontal.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() // or jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:1.5.0' 10 | } 11 | } 12 | 13 | android { 14 | compileSdkVersion 23 15 | buildToolsVersion "23.0.1" 16 | 17 | defaultConfig { 18 | applicationId "com.support.android.designlibdemo" 19 | minSdkVersion 9 20 | targetSdkVersion 23 21 | versionCode 1 22 | versionName "1.0" 23 | } 24 | buildTypes { 25 | release { 26 | minifyEnabled false 27 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 28 | } 29 | } 30 | } 31 | 32 | repositories { 33 | jcenter() 34 | } 35 | 36 | dependencies { 37 | compile 'com.android.support:design:23.1.1' 38 | compile 'com.android.support:cardview-v7:23.1.1' 39 | compile 'com.github.bumptech.glide:glide:3.6.0' 40 | compile 'de.hdodenhof:circleimageview:1.3.0' 41 | compile project(':extendablerecyclerview') 42 | } 43 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # IntelliJ 36 | *.iml 37 | .idea/ 38 | 39 | # Keystore files 40 | # Uncomment the following line if you do not want to check your keystore files in. 41 | #*.jks 42 | 43 | # External native build folder generated in Android Studio 2.2 and later 44 | .externalNativeBuild 45 | 46 | # Google Services (e.g. APIs or Firebase) 47 | google-services.json 48 | 49 | # Freeline 50 | freeline.py 51 | freeline/ 52 | freeline_project_description.json 53 | 54 | # fastlane 55 | fastlane/report.xml 56 | fastlane/Preview.html 57 | fastlane/screenshots 58 | fastlane/test_output 59 | fastlane/readme.md -------------------------------------------------------------------------------- /app/src/main/res/layout/sample_header1.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/sample_header2.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/sample_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /extendablerecyclerview/src/main/java/com/edus/view/sticky/StickyRecyclerHeadersAdapter.java: -------------------------------------------------------------------------------- 1 | package com.edus.view.sticky; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.ViewGroup; 5 | 6 | public interface StickyRecyclerHeadersAdapter { 7 | /** 8 | * Get the ID of the header associated with this item. For example, if your headers group 9 | * items by their first letter, you could return the character representation of the first letter. 10 | * Return a value < 0 if the view should not have a header (like, a header view or footer view) 11 | * 12 | * @param position 13 | * @return 14 | */ 15 | public long getHeaderId(int position); 16 | 17 | /** 18 | * Creates a new ViewHolder for a header. This works the same way onCreateViewHolder in 19 | * Recycler.Adapter, ViewHolders can be reused for different views. This is usually a good place 20 | * to inflate the layout for the header. 21 | * 22 | * @param parent 23 | * @return 24 | */ 25 | public VH onCreateHeaderViewHolder(ViewGroup parent); 26 | 27 | /** 28 | * Binds an existing ViewHolder to the specified adapter position. 29 | * 30 | * @param holder 31 | * @param position 32 | */ 33 | public void onBindHeaderViewHolder(VH holder, int position); 34 | 35 | public int getItemCount(); 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/nav_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 26 | 27 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 25 | 26 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_grid.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 26 | 27 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_linear.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 26 | 27 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 21 | 22 |