├── .gradle ├── 4.10.1 │ ├── fileChanges │ │ └── last-build.bin │ ├── fileContent │ │ └── fileContent.lock │ ├── fileHashes │ │ ├── fileHashes.bin │ │ ├── fileHashes.lock │ │ └── resourceHashesCache.bin │ ├── gc.properties │ ├── javaCompile │ │ ├── javaCompile.lock │ │ └── taskHistory.bin │ └── taskHistory │ │ ├── taskHistory.bin │ │ └── taskHistory.lock ├── buildOutputCleanup │ ├── buildOutputCleanup.lock │ ├── cache.properties │ └── outputFiles.bin └── vcs-1 │ └── gc.properties ├── .idea ├── caches │ ├── build_file_checksums.ser │ └── gradle_models.ser ├── codeStyles │ └── Project.xml ├── compiler.xml ├── gradle.xml ├── libraries │ ├── Gradle__androidx_annotation_annotation_1_0_0_jar.xml │ ├── Gradle__androidx_appcompat_appcompat_1_0_0_aar.xml │ ├── Gradle__androidx_arch_core_core_common_2_0_0_jar.xml │ ├── Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml │ ├── Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml │ ├── Gradle__androidx_cardview_cardview_1_0_0_rc01_aar.xml │ ├── Gradle__androidx_collection_collection_1_0_0_jar.xml │ ├── Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml │ ├── Gradle__androidx_core_core_1_0_0_aar.xml │ ├── Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml │ ├── Gradle__androidx_customview_customview_1_0_0_aar.xml │ ├── Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml │ ├── Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml │ ├── Gradle__androidx_fragment_fragment_1_0_0_aar.xml │ ├── Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml │ ├── Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml │ ├── Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_common_2_0_0_jar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_extensions_2_0_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_process_2_0_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_runtime_2_0_0_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_service_2_0_0_rc01_aar.xml │ ├── Gradle__androidx_lifecycle_lifecycle_viewmodel_2_0_0_aar.xml │ ├── Gradle__androidx_loader_loader_1_0_0_aar.xml │ ├── Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml │ ├── Gradle__androidx_print_print_1_0_0_aar.xml │ ├── Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml │ ├── Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml │ ├── Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml │ ├── Gradle__androidx_transition_transition_1_0_0_rc01_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_1_0_0_aar.xml │ ├── Gradle__androidx_vectordrawable_vectordrawable_animated_1_0_0_aar.xml │ ├── Gradle__androidx_versionedparcelable_versionedparcelable_1_0_0_aar.xml │ ├── Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml │ ├── Gradle__com_android_support_support_annotations_27_1_1_jar.xml │ ├── Gradle__com_android_support_test_espresso_espresso_core_3_0_2_aar.xml │ ├── Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2_aar.xml │ ├── Gradle__com_android_support_test_monitor_1_0_2_aar.xml │ ├── Gradle__com_android_support_test_runner_1_0_2_aar.xml │ ├── Gradle__com_google_android_material_material_1_0_0_rc01_aar.xml │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml │ ├── Gradle__com_squareup_javawriter_2_1_1_jar.xml │ ├── Gradle__javax_inject_javax_inject_1_jar.xml │ ├── Gradle__junit_junit_4_12_jar.xml │ ├── Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml │ └── Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── vcs.xml └── workspace.xml ├── NestedScrollingDemo.iml ├── README.md ├── ViewPagerDemo.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── xue │ │ └── viewpagerdemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── xue │ │ │ └── viewpagerdemo │ │ │ ├── MainActivity.java │ │ │ ├── NestedScrollLayout.java │ │ │ ├── NestedScrollLayout2.java │ │ │ ├── SubFragment.java │ │ │ ├── SubPagerAdapter.java │ │ │ ├── ViewType.java │ │ │ ├── common │ │ │ ├── AdapterItem.java │ │ │ ├── BaseAdapter.java │ │ │ ├── BaseViewHolder.java │ │ │ └── HolderAnnotation.java │ │ │ ├── items │ │ │ ├── PageItem.java │ │ │ ├── ParentItem.java │ │ │ └── TextItem.java │ │ │ ├── model │ │ │ ├── NestedViewModel.java │ │ │ ├── PageVO.java │ │ │ └── PagerModel.java │ │ │ └── viewholder │ │ │ ├── ImageViewHolder.java │ │ │ ├── PagerViewHolder.java │ │ │ └── TextViewHolder.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_first_generation.xml │ │ ├── activity_main.xml │ │ ├── child_holder.xml │ │ ├── goods_list.xml │ │ ├── item_pager.xml │ │ ├── item_parent_holder.xml │ │ ├── item_text.xml │ │ └── pager_holder.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 │ │ ├── pic1.jpeg │ │ ├── pic2.jpg │ │ ├── pic3.jpg │ │ ├── pic4.jpg │ │ └── pic5.jpeg │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── xue │ └── viewpagerdemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle /.gradle/4.10.1/fileChanges/last-build.bin: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gradle/4.10.1/fileContent/fileContent.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/fileContent/fileContent.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/fileHashes/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/fileHashes.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/fileHashes/fileHashes.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/fileHashes/resourceHashesCache.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/fileHashes/resourceHashesCache.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/gc.properties -------------------------------------------------------------------------------- /.gradle/4.10.1/javaCompile/javaCompile.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/javaCompile/javaCompile.lock -------------------------------------------------------------------------------- /.gradle/4.10.1/javaCompile/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/javaCompile/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/taskHistory/taskHistory.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/taskHistory/taskHistory.bin -------------------------------------------------------------------------------- /.gradle/4.10.1/taskHistory/taskHistory.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/4.10.1/taskHistory/taskHistory.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/buildOutputCleanup.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/buildOutputCleanup/buildOutputCleanup.lock -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/cache.properties: -------------------------------------------------------------------------------- 1 | #Fri Feb 22 14:28:28 CST 2019 2 | gradle.version=4.10.1 3 | -------------------------------------------------------------------------------- /.gradle/buildOutputCleanup/outputFiles.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/buildOutputCleanup/outputFiles.bin -------------------------------------------------------------------------------- /.gradle/vcs-1/gc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.gradle/vcs-1/gc.properties -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/caches/gradle_models.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/.idea/caches/gradle_models.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_annotation_annotation_1_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_appcompat_appcompat_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_common_2_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_collection_collection_1_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_core_core_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_fragment_fragment_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_extensions_2_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_process_2_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_service_2_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_transition_transition_1_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_annotations_27_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_3_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_monitor_1_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_runner_1_0_2_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_android_material_material_1_0_0_rc01_aar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_12_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 28 | 29 | 30 | 31 | 45 | 46 | 47 | 48 | 49 | 50 | 52 | 53 | 58 | 59 | 60 | 109 | 110 | 115 | 116 | 123 | 124 | -------------------------------------------------------------------------------- /NestedScrollingDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NestedScrollingDemo 2 | 嵌套滑动实战Demo 3 | 4 | 实现类似淘宝首页的效果 5 | 6 | ![淘宝](https://upload-images.jianshu.io/upload_images/1600158-31a646192d330ea8.gif?imageMogr2/auto-orient/strip) 7 | 8 | ![Touch嵌套](https://upload-images.jianshu.io/upload_images/1600158-c25228cf4f895949.gif?imageMogr2/auto-orient/strip) 9 | 10 | 11 | ![fling嵌套](https://upload-images.jianshu.io/upload_images/1600158-c0ecbd282408a725.gif?imageMogr2/auto-orient/strip) 12 | -------------------------------------------------------------------------------- /ViewPagerDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.xue.viewpagerdemo" 7 | minSdkVersion 21 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'androidx.lifecycle:lifecycle-livedata:2.0.0-rc01' 24 | implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-rc01' 25 | implementation 'androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01' 26 | implementation 'androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01' 27 | implementation 'androidx.appcompat:appcompat:1.0.0' 28 | implementation 'com.google.android.material:material:1.0.0-rc01' 29 | implementation 'androidx.recyclerview:recyclerview:1.0.0' 30 | implementation 'androidx.viewpager:viewpager:1.0.0' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 33 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 34 | } 35 | -------------------------------------------------------------------------------- /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/xue/viewpagerdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.xue.viewpagerdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapFactory; 5 | import android.graphics.Color; 6 | import android.os.Bundle; 7 | import android.util.SparseArray; 8 | import android.view.ViewTreeObserver; 9 | 10 | 11 | import com.xue.viewpagerdemo.NestedScrollLayout; 12 | import com.xue.viewpagerdemo.NestedScrollLayout2; 13 | import com.xue.viewpagerdemo.R; 14 | import com.xue.viewpagerdemo.common.AdapterItem; 15 | import com.xue.viewpagerdemo.common.BaseAdapter; 16 | import com.xue.viewpagerdemo.common.BaseViewHolder; 17 | import com.xue.viewpagerdemo.items.PageItem; 18 | import com.xue.viewpagerdemo.items.ParentItem; 19 | import com.xue.viewpagerdemo.model.NestedViewModel; 20 | import com.xue.viewpagerdemo.model.PageVO; 21 | import com.xue.viewpagerdemo.viewholder.PagerViewHolder; 22 | import com.xue.viewpagerdemo.viewholder.ImageViewHolder; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | 27 | import androidx.annotation.Nullable; 28 | import androidx.appcompat.app.AppCompatActivity; 29 | import androidx.lifecycle.ViewModelProviders; 30 | import androidx.recyclerview.widget.LinearLayoutManager; 31 | import androidx.recyclerview.widget.RecyclerView; 32 | 33 | import static com.xue.viewpagerdemo.ViewType.TYPE_PAGER; 34 | import static com.xue.viewpagerdemo.ViewType.TYPE_PARENT; 35 | 36 | /** 37 | * Created by 薛贤俊 on 2019/2/21. 38 | */ 39 | public class MainActivity extends AppCompatActivity { 40 | 41 | private RecyclerView recyclerView; 42 | 43 | private RecyclerView.Adapter adapter; 44 | 45 | private NestedViewModel viewModel; 46 | 47 | private NestedScrollLayout2 container; 48 | 49 | @Override 50 | protected void onCreate(@Nullable Bundle savedInstanceState) { 51 | super.onCreate(savedInstanceState); 52 | setContentView(R.layout.activity_first_generation); 53 | container = findViewById(R.id.rootview); 54 | recyclerView = findViewById(R.id.recyclerview); 55 | recyclerView.setNestedScrollingEnabled(true); 56 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 57 | container.setRootList(recyclerView); 58 | container.setTarget(this); 59 | initAdapter(); 60 | viewModel = ViewModelProviders.of(this).get(NestedViewModel.class); 61 | container.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { 62 | @Override 63 | public void onGlobalLayout() { 64 | int height = container.getMeasuredHeight(); 65 | viewModel.getPagerHeight().setValue(height); 66 | } 67 | }); 68 | } 69 | 70 | private void initAdapter() { 71 | SparseArray> viewHolders = new SparseArray<>(); 72 | viewHolders.put(TYPE_PARENT, ImageViewHolder.class); 73 | viewHolders.put(TYPE_PAGER, PagerViewHolder.class); 74 | int[] ids = new int[]{R.mipmap.pic1, R.mipmap.pic2, R.mipmap.pic3, R.mipmap.pic4, R.mipmap.pic5}; 75 | List itemList = new ArrayList<>(); 76 | for (int id : ids) { 77 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(), id); 78 | itemList.add(new ParentItem(bitmap)); 79 | } 80 | List pageList = new ArrayList<>(); 81 | for (int i = 0; i < 10; i++) { 82 | pageList.add(new PageVO(Color.WHITE, "tab" + i)); 83 | } 84 | itemList.add(new PageItem(pageList)); 85 | adapter = new BaseAdapter(itemList, this, viewHolders); 86 | recyclerView.setAdapter(adapter); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/NestedScrollLayout.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.Log; 6 | import android.view.View; 7 | import android.widget.FrameLayout; 8 | import android.widget.OverScroller; 9 | 10 | import com.xue.viewpagerdemo.model.NestedViewModel; 11 | 12 | import androidx.annotation.NonNull; 13 | import androidx.annotation.Nullable; 14 | import androidx.core.view.NestedScrollingChild; 15 | import androidx.core.view.NestedScrollingChild2; 16 | import androidx.core.view.NestedScrollingParent2; 17 | import androidx.core.view.ViewCompat; 18 | import androidx.fragment.app.Fragment; 19 | import androidx.fragment.app.FragmentActivity; 20 | import androidx.lifecycle.LifecycleOwner; 21 | import androidx.lifecycle.Observer; 22 | import androidx.lifecycle.ViewModelProviders; 23 | import androidx.recyclerview.widget.RecyclerView; 24 | 25 | /** 26 | * Created by 薛贤俊 on 2019/2/15. 27 | */ 28 | public class NestedScrollLayout extends FrameLayout { 29 | private View mChildView; 30 | /** 31 | * 最外层的RecyclerView 32 | */ 33 | private RecyclerView mRootList; 34 | /** 35 | * 子RecyclerView 36 | */ 37 | private RecyclerView mChildList; 38 | /** 39 | * 用来处理Fling 40 | */ 41 | private OverScroller mScroller; 42 | 43 | private NestedViewModel mScrollViewModel; 44 | 45 | private int mLastY; 46 | 47 | public NestedScrollLayout(@NonNull Context context) { 48 | super(context); 49 | init(); 50 | } 51 | 52 | public NestedScrollLayout(@NonNull Context context, @Nullable AttributeSet attrs) { 53 | super(context, attrs); 54 | init(); 55 | } 56 | 57 | public void setTarget(LifecycleOwner target) { 58 | if (target instanceof FragmentActivity) { 59 | mScrollViewModel = ViewModelProviders.of((FragmentActivity) target).get(NestedViewModel.class); 60 | } else if (target instanceof Fragment) { 61 | mScrollViewModel = ViewModelProviders.of((Fragment) target).get(NestedViewModel.class); 62 | } else { 63 | throw new IllegalArgumentException("target must be FragmentActivity or Fragment"); 64 | } 65 | mScrollViewModel.getChildView().observe(target, new Observer() { 66 | @Override 67 | public void onChanged(@Nullable View view) { 68 | mChildView = view; 69 | } 70 | }); 71 | mScrollViewModel.getChildList().observe(target, new Observer() { 72 | @Override 73 | public void onChanged(@Nullable View view) { 74 | Log.d("xuetest","onChanged"); 75 | mChildList = (RecyclerView) view; 76 | } 77 | }); 78 | } 79 | 80 | public void setRootList(RecyclerView recyclerView) { 81 | mRootList = recyclerView; 82 | } 83 | 84 | 85 | private void init() { 86 | mScroller = new OverScroller(getContext()); 87 | } 88 | 89 | @Override 90 | public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int nestedScrollAxes) { 91 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL; 92 | } 93 | 94 | @Override 95 | public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed) { 96 | stopScroller(); 97 | if (mChildView == null) { 98 | return; 99 | } 100 | if (target == mRootList) { 101 | onParentScrolling(mChildView.getTop(), dy, consumed); 102 | } else { 103 | onChildScrolling(mChildView.getTop(), dy, consumed); 104 | } 105 | } 106 | 107 | /** 108 | * 父列表在滑动 109 | * 110 | * @param childTop 111 | * @param dy 112 | * @param consumed 113 | */ 114 | private void onParentScrolling(int childTop, int dy, int[] consumed) { 115 | //列表已经置顶 116 | if (childTop == 0) { 117 | if (dy > 0 && mChildList != null) { 118 | //还在向下滑动,此时滑动子列表 119 | mChildList.scrollBy(0, dy); 120 | consumed[1] = dy; 121 | } else { 122 | if (mChildList != null && mChildList.canScrollVertically(dy)) { 123 | consumed[1] = dy; 124 | mChildList.scrollBy(0, dy); 125 | } 126 | } 127 | } else { 128 | if (childTop < dy) { 129 | consumed[1] = dy - childTop; 130 | } 131 | } 132 | } 133 | 134 | private void onChildScrolling(int childTop, int dy, int[] consumed) { 135 | if (childTop == 0) { 136 | if (dy < 0) { 137 | //向上滑动 138 | if (!mChildList.canScrollVertically(dy)) { 139 | consumed[1] = dy; 140 | mRootList.scrollBy(0, dy); 141 | } 142 | } 143 | } else { 144 | if (dy < 0 || childTop > dy) { 145 | consumed[1] = dy; 146 | mRootList.scrollBy(0, dy); 147 | } else { 148 | //dy大于0 149 | consumed[1] = dy; 150 | mRootList.scrollBy(0, childTop); 151 | } 152 | } 153 | } 154 | 155 | private void stopScroller() { 156 | mScroller.forceFinished(true); 157 | } 158 | 159 | private void onFling(int dy) { 160 | if (mChildView != null) { 161 | //子列表有显示 162 | int top = mChildView.getTop(); 163 | if (top == 0) { 164 | if (dy > 0) { 165 | if (mChildList != null && mChildList.canScrollVertically(dy)) { 166 | mChildList.scrollBy(0, dy); 167 | } else { 168 | stopScroller(); 169 | } 170 | } else { 171 | if (mChildList != null && mChildList.canScrollVertically(dy)) { 172 | mChildList.scrollBy(0, dy); 173 | } else { 174 | mRootList.scrollBy(0, dy); 175 | } 176 | } 177 | } else { 178 | if (dy > 0) { 179 | if (top > dy) { 180 | mRootList.scrollBy(0, dy); 181 | } else { 182 | mRootList.scrollBy(0, top); 183 | } 184 | } else { 185 | if (mRootList.canScrollVertically(dy)) { 186 | mRootList.scrollBy(0, dy); 187 | } else { 188 | stopScroller(); 189 | } 190 | } 191 | } 192 | } else { 193 | if (!mRootList.canScrollVertically(dy)) { 194 | stopScroller(); 195 | } else { 196 | mRootList.scrollBy(0, dy); 197 | } 198 | } 199 | } 200 | 201 | @Override 202 | public boolean onNestedFling(@NonNull View target, float velocityX, float velocityY, boolean consumed) { 203 | return false; 204 | } 205 | 206 | @Override 207 | public boolean onNestedPreFling(@NonNull View target, float velocityX, float velocityY) { 208 | mLastY = 0; 209 | this.mScroller.fling(0, 0, (int) velocityX, (int) velocityY, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE); 210 | invalidate(); 211 | return true; 212 | } 213 | 214 | @Override 215 | public void computeScroll() { 216 | if (mScroller.computeScrollOffset()) { 217 | int currY = mScroller.getCurrY(); 218 | int dy = currY - mLastY; 219 | mLastY = currY; 220 | if (dy != 0) { 221 | onFling(dy); 222 | } 223 | invalidate(); 224 | } 225 | super.computeScroll(); 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/NestedScrollLayout2.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.FrameLayout; 7 | 8 | import com.xue.viewpagerdemo.model.NestedViewModel; 9 | 10 | import androidx.annotation.NonNull; 11 | import androidx.annotation.Nullable; 12 | import androidx.core.view.NestedScrollingParent2; 13 | import androidx.core.view.ViewCompat; 14 | import androidx.fragment.app.Fragment; 15 | import androidx.fragment.app.FragmentActivity; 16 | import androidx.lifecycle.LifecycleOwner; 17 | import androidx.lifecycle.Observer; 18 | import androidx.lifecycle.ViewModelProviders; 19 | import androidx.recyclerview.widget.RecyclerView; 20 | 21 | /** 22 | * Created by 薛贤俊 on 2019/2/22. 23 | */ 24 | public class NestedScrollLayout2 extends FrameLayout implements NestedScrollingParent2 { 25 | 26 | private View mChildView; 27 | /** 28 | * 最外层的RecyclerView 29 | */ 30 | private RecyclerView mRootList; 31 | /** 32 | * 子RecyclerView 33 | */ 34 | private RecyclerView mChildList; 35 | 36 | private NestedViewModel mScrollViewModel; 37 | 38 | private int mAxes; 39 | 40 | public NestedScrollLayout2(@NonNull Context context) { 41 | super(context); 42 | } 43 | 44 | public NestedScrollLayout2(@NonNull Context context, @Nullable AttributeSet attrs) { 45 | super(context, attrs); 46 | } 47 | 48 | public void setTarget(LifecycleOwner target) { 49 | if (target instanceof FragmentActivity) { 50 | mScrollViewModel = ViewModelProviders.of((FragmentActivity) target).get(NestedViewModel.class); 51 | } else if (target instanceof Fragment) { 52 | mScrollViewModel = ViewModelProviders.of((Fragment) target).get(NestedViewModel.class); 53 | } else { 54 | throw new IllegalArgumentException("target must be FragmentActivity or Fragment"); 55 | } 56 | mScrollViewModel.getChildView().observe(target, new Observer() { 57 | @Override 58 | public void onChanged(@Nullable View view) { 59 | mChildView = view; 60 | } 61 | }); 62 | mScrollViewModel.getChildList().observe(target, new Observer() { 63 | @Override 64 | public void onChanged(@Nullable View view) { 65 | mChildList = (RecyclerView) view; 66 | } 67 | }); 68 | } 69 | 70 | public void setRootList(RecyclerView recyclerView) { 71 | mRootList = recyclerView; 72 | } 73 | 74 | @Override 75 | public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int axes, int type) { 76 | return axes == ViewCompat.SCROLL_AXIS_VERTICAL; 77 | } 78 | 79 | @Override 80 | public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int axes, int type) { 81 | mAxes = axes; 82 | } 83 | 84 | @Override 85 | public void onStopNestedScroll(@NonNull View target, int type) { 86 | mAxes = SCROLL_AXIS_NONE; 87 | } 88 | 89 | @Override 90 | public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) { 91 | 92 | } 93 | 94 | @Override 95 | public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed, int type) { 96 | if (mChildView == null) { 97 | return; 98 | } 99 | if (target == mRootList) { 100 | onParentScrolling(mChildView.getTop(), dy, consumed); 101 | } else { 102 | onChildScrolling(mChildView.getTop(), dy, consumed); 103 | } 104 | } 105 | 106 | /** 107 | * 父列表在滑动 108 | * 109 | * @param childTop 110 | * @param dy 111 | * @param consumed 112 | */ 113 | private void onParentScrolling(int childTop, int dy, int[] consumed) { 114 | //列表已经置顶 115 | if (childTop == 0) { 116 | if (dy > 0 && mChildList != null) { 117 | //还在向下滑动,此时滑动子列表 118 | mChildList.scrollBy(0, dy); 119 | consumed[1] = dy; 120 | } else { 121 | if (mChildList != null && mChildList.canScrollVertically(dy)) { 122 | consumed[1] = dy; 123 | mChildList.scrollBy(0, dy); 124 | } 125 | } 126 | } else { 127 | if (childTop < dy) { 128 | consumed[1] = dy - childTop; 129 | } 130 | } 131 | } 132 | 133 | private void onChildScrolling(int childTop, int dy, int[] consumed) { 134 | if (childTop == 0) { 135 | if (dy < 0) { 136 | //向上滑动 137 | if (!mChildList.canScrollVertically(dy)) { 138 | consumed[1] = dy; 139 | mRootList.scrollBy(0, dy); 140 | } 141 | } 142 | } else { 143 | if (dy < 0 || childTop > dy) { 144 | consumed[1] = dy; 145 | mRootList.scrollBy(0, dy); 146 | } else { 147 | //dy大于0 148 | consumed[1] = dy; 149 | mRootList.scrollBy(0, childTop); 150 | } 151 | } 152 | } 153 | 154 | @Override 155 | public int getNestedScrollAxes() { 156 | return mAxes; 157 | } 158 | 159 | } 160 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/SubFragment.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.util.Log; 6 | import android.util.SparseArray; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.xue.viewpagerdemo.common.AdapterItem; 12 | import com.xue.viewpagerdemo.common.BaseAdapter; 13 | import com.xue.viewpagerdemo.common.BaseViewHolder; 14 | import com.xue.viewpagerdemo.items.TextItem; 15 | import com.xue.viewpagerdemo.model.NestedViewModel; 16 | import com.xue.viewpagerdemo.viewholder.TextViewHolder; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.fragment.app.Fragment; 24 | import androidx.fragment.app.FragmentStatePagerAdapter; 25 | import androidx.lifecycle.ViewModelProviders; 26 | import androidx.recyclerview.widget.LinearLayoutManager; 27 | import androidx.recyclerview.widget.RecyclerView; 28 | import androidx.viewpager.widget.ViewPager; 29 | 30 | /** 31 | * Created by 薛贤俊 on 2019/2/13. 32 | */ 33 | public class SubFragment extends Fragment { 34 | 35 | private RecyclerView recyclerView; 36 | 37 | private RecyclerView.Adapter adapter; 38 | 39 | private NestedViewModel viewModel; 40 | 41 | @Nullable 42 | @Override 43 | public View onCreateView(@NonNull LayoutInflater inflater, 44 | @Nullable ViewGroup container, 45 | @Nullable Bundle savedInstanceState) { 46 | View view = inflater.inflate(R.layout.goods_list, container, false); 47 | init(view); 48 | return view; 49 | } 50 | 51 | private void init(View view) { 52 | int color = getArguments().getInt("color"); 53 | recyclerView = view.findViewById(R.id.recyclerview); 54 | recyclerView.setLayoutManager(new LinearLayoutManager(view.getContext())); 55 | recyclerView.setNestedScrollingEnabled(true); 56 | recyclerView.setBackgroundColor(color); 57 | 58 | SparseArray> viewHolders = new SparseArray<>(); 59 | viewHolders.put(ViewType.TYPE_TEXT, TextViewHolder.class); 60 | List itemList = new ArrayList<>(); 61 | for (int i = 0; i < 20; i++) { 62 | itemList.add(new TextItem("text" + i)); 63 | } 64 | adapter = new BaseAdapter(itemList, view.getContext(), viewHolders); 65 | recyclerView.setAdapter(adapter); 66 | 67 | 68 | } 69 | 70 | 71 | @Override 72 | public void setUserVisibleHint(boolean isVisibleToUser) { 73 | super.setUserVisibleHint(isVisibleToUser); 74 | initViewModel(); 75 | if (isVisibleToUser && trackFragment() && viewModel != null) { 76 | viewModel.getChildList().setValue(recyclerView); 77 | } 78 | } 79 | 80 | @Override 81 | public void onResume() { 82 | super.onResume(); 83 | initViewModel(); 84 | if (trackFragment() && viewModel != null) { 85 | viewModel.getChildList().setValue(recyclerView); 86 | } 87 | } 88 | 89 | @Override 90 | public void onHiddenChanged(boolean hidden) { 91 | super.onHiddenChanged(hidden); 92 | initViewModel(); 93 | if (!hidden && trackFragment() && viewModel != null) { 94 | viewModel.getChildList().setValue(recyclerView); 95 | } 96 | } 97 | 98 | private void initViewModel() { 99 | if (viewModel == null && getActivity() != null) { 100 | viewModel = ViewModelProviders.of(getActivity()).get(NestedViewModel.class); 101 | } 102 | } 103 | 104 | private boolean trackFragment() { 105 | if (getView() == null || !(getView().getParent() instanceof View)) { 106 | return false; 107 | } 108 | View parent = (View) getView().getParent(); 109 | if (parent instanceof ViewPager) { 110 | ViewPager viewPager = (ViewPager) parent; 111 | int currentItem = viewPager.getCurrentItem(); 112 | //这里需要注意,SubPagerAdapter中,需要把每个Fragment的position传入Arguments 113 | int position = getArguments() != null ? getArguments().getInt("position", -1) : -1; 114 | return currentItem == position; 115 | } 116 | return false; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/SubPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import android.os.Bundle; 4 | import android.util.SparseArray; 5 | 6 | import com.xue.viewpagerdemo.model.PageVO; 7 | 8 | import java.lang.ref.SoftReference; 9 | import java.util.List; 10 | 11 | import androidx.annotation.Nullable; 12 | import androidx.fragment.app.Fragment; 13 | import androidx.fragment.app.FragmentManager; 14 | import androidx.fragment.app.FragmentStatePagerAdapter; 15 | 16 | /** 17 | * Created by 薛贤俊 on 2019/2/21. 18 | */ 19 | public class SubPagerAdapter extends FragmentStatePagerAdapter { 20 | 21 | private List itemList; 22 | 23 | public SubPagerAdapter(FragmentManager fm, List itemList) { 24 | super(fm); 25 | this.itemList = itemList; 26 | } 27 | 28 | @Override 29 | public Fragment getItem(int position) { 30 | Fragment fragment = new SubFragment(); 31 | Bundle bundle = new Bundle(); 32 | bundle.putInt("color", itemList.get(position).getColor()); 33 | bundle.putInt("position",position); 34 | fragment.setArguments(bundle); 35 | return fragment; 36 | } 37 | 38 | @Override 39 | public int getCount() { 40 | return itemList == null ? 0 : itemList.size(); 41 | } 42 | 43 | @Nullable 44 | @Override 45 | public CharSequence getPageTitle(int position) { 46 | return itemList.get(position).getTitle(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/ViewType.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | /** 4 | * Created by 薛贤俊 on 2019/2/21. 5 | */ 6 | public class ViewType { 7 | public static final int TYPE_PARENT = 1; 8 | 9 | public static final int TYPE_PAGER = 2; 10 | 11 | public static final int TYPE_TEXT = 3; 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/common/AdapterItem.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.common; 2 | 3 | /** 4 | * Created by 薛贤俊 on 2019/2/21. 5 | */ 6 | public interface AdapterItem { 7 | 8 | T getDataModel(); 9 | 10 | int getViewType(); 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/common/BaseAdapter.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.common; 2 | 3 | import android.content.Context; 4 | 5 | import android.util.SparseArray; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import java.lang.reflect.Constructor; 11 | import java.util.List; 12 | 13 | import androidx.annotation.NonNull; 14 | import androidx.recyclerview.widget.RecyclerView; 15 | 16 | /** 17 | * Created by 薛贤俊 on 2019/2/21. 18 | */ 19 | public class BaseAdapter extends RecyclerView.Adapter { 20 | 21 | private List itemList; 22 | 23 | private Context context; 24 | 25 | private SparseArray> viewHolders; 26 | 27 | private LayoutInflater inflater; 28 | 29 | public BaseAdapter(List itemList, Context context, SparseArray> viewHolders) { 30 | this.itemList = itemList; 31 | this.context = context; 32 | this.viewHolders = viewHolders; 33 | this.inflater = LayoutInflater.from(context); 34 | } 35 | 36 | 37 | @NonNull 38 | @Override 39 | public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) { 40 | try { 41 | Class clazz = viewHolders.get(viewType); 42 | HolderAnnotation annotation = (HolderAnnotation) clazz.getAnnotation(HolderAnnotation.class); 43 | int layoutId = annotation.layoutId(); 44 | View itemView = inflater.inflate(layoutId, viewGroup, false); 45 | Constructor constructor = clazz.getConstructor(View.class); 46 | BaseViewHolder viewHolder = (BaseViewHolder) constructor.newInstance(itemView); 47 | viewHolder.initViews(); 48 | return viewHolder; 49 | } catch (Throwable e) { 50 | 51 | } 52 | return null; 53 | } 54 | 55 | @Override 56 | public void onBindViewHolder(@NonNull BaseViewHolder baseViewHolder, int position) { 57 | AdapterItem item = itemList.get(position); 58 | baseViewHolder.bindView(item.getDataModel()); 59 | } 60 | 61 | @Override 62 | public int getItemViewType(int position) { 63 | return itemList.get(position).getViewType(); 64 | } 65 | 66 | @Override 67 | public int getItemCount() { 68 | return itemList == null ? 0 : itemList.size(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/common/BaseViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.common; 2 | 3 | 4 | import android.view.View; 5 | 6 | import androidx.annotation.NonNull; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | /** 10 | * Created by 薛贤俊 on 2019/2/21. 11 | */ 12 | public abstract class BaseViewHolder extends RecyclerView.ViewHolder { 13 | 14 | public BaseViewHolder(@NonNull View itemView) { 15 | super(itemView); 16 | } 17 | 18 | public abstract void initViews(); 19 | 20 | public abstract void bindView(T data); 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/common/HolderAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.common; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | /** 7 | * Created by 薛贤俊 on 2019/2/21. 8 | */ 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface HolderAnnotation { 11 | int layoutId(); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/items/PageItem.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.items; 2 | 3 | import com.xue.viewpagerdemo.ViewType; 4 | import com.xue.viewpagerdemo.common.AdapterItem; 5 | import com.xue.viewpagerdemo.model.PageVO; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by 薛贤俊 on 2019/2/21. 11 | */ 12 | public class PageItem implements AdapterItem> { 13 | 14 | private List model; 15 | 16 | public PageItem(List model) { 17 | this.model = model; 18 | } 19 | 20 | @Override 21 | public List getDataModel() { 22 | return model; 23 | } 24 | 25 | @Override 26 | public int getViewType() { 27 | return ViewType.TYPE_PAGER; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/items/ParentItem.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.items; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | import com.xue.viewpagerdemo.ViewType; 6 | import com.xue.viewpagerdemo.common.AdapterItem; 7 | 8 | /** 9 | * Created by 薛贤俊 on 2019/2/21. 10 | */ 11 | public class ParentItem implements AdapterItem { 12 | private Bitmap bitmap; 13 | 14 | public ParentItem(Bitmap bitmap) { 15 | this.bitmap = bitmap; 16 | } 17 | 18 | @Override 19 | public Bitmap getDataModel() { 20 | return bitmap; 21 | } 22 | 23 | @Override 24 | public int getViewType() { 25 | return ViewType.TYPE_PARENT; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/items/TextItem.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.items; 2 | 3 | import com.xue.viewpagerdemo.ViewType; 4 | import com.xue.viewpagerdemo.common.AdapterItem; 5 | 6 | /** 7 | * Created by 薛贤俊 on 2019/2/22. 8 | */ 9 | public class TextItem implements AdapterItem { 10 | 11 | private String text; 12 | 13 | public TextItem(String text) { 14 | this.text = text; 15 | } 16 | 17 | @Override 18 | public String getDataModel() { 19 | return text; 20 | } 21 | 22 | @Override 23 | public int getViewType() { 24 | return ViewType.TYPE_TEXT; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/model/NestedViewModel.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.model; 2 | 3 | import android.view.View; 4 | 5 | import androidx.lifecycle.MutableLiveData; 6 | import androidx.lifecycle.ViewModel; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | 9 | /** 10 | * Created by 薛贤俊 on 2019/2/21. 11 | */ 12 | public class NestedViewModel extends ViewModel { 13 | 14 | private MutableLiveData pagerHeight; 15 | 16 | private MutableLiveData childView; 17 | 18 | private MutableLiveData childList; 19 | 20 | public MutableLiveData getPagerHeight() { 21 | if (pagerHeight == null) { 22 | pagerHeight = new MutableLiveData<>(); 23 | } 24 | return pagerHeight; 25 | } 26 | 27 | public MutableLiveData getChildView() { 28 | if (childView == null) { 29 | childView = new MutableLiveData<>(); 30 | } 31 | return childView; 32 | } 33 | 34 | public MutableLiveData getChildList() { 35 | if (childList == null) { 36 | childList = new MutableLiveData<>(); 37 | } 38 | return childList; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/model/PageVO.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.model; 2 | 3 | /** 4 | * Created by 薛贤俊 on 2019/2/21. 5 | */ 6 | public class PageVO { 7 | private int color; 8 | private String title; 9 | 10 | public PageVO(int color, String title) { 11 | this.color = color; 12 | this.title = title; 13 | } 14 | 15 | public int getColor() { 16 | return color; 17 | } 18 | 19 | public String getTitle() { 20 | return title; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/model/PagerModel.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.model; 2 | 3 | /** 4 | * Created by 薛贤俊 on 2019/2/21. 5 | */ 6 | public class PagerModel { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/viewholder/ImageViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.viewholder; 2 | 3 | import android.graphics.Bitmap; 4 | import android.view.View; 5 | import android.widget.ImageView; 6 | 7 | import com.xue.viewpagerdemo.R; 8 | import com.xue.viewpagerdemo.common.BaseViewHolder; 9 | import com.xue.viewpagerdemo.common.HolderAnnotation; 10 | 11 | import androidx.annotation.NonNull; 12 | 13 | /** 14 | * Created by 薛贤俊 on 2019/2/21. 15 | */ 16 | @HolderAnnotation(layoutId = R.layout.item_parent_holder) 17 | public class ImageViewHolder extends BaseViewHolder { 18 | 19 | private ImageView imageView; 20 | 21 | private Bitmap bitmap; 22 | 23 | public ImageViewHolder(@NonNull View itemView) { 24 | super(itemView); 25 | } 26 | 27 | @Override 28 | public void initViews() { 29 | imageView = itemView.findViewById(R.id.imageview); 30 | } 31 | 32 | @Override 33 | public void bindView(Bitmap data) { 34 | if (bitmap == data) { 35 | return; 36 | } 37 | bitmap = data; 38 | imageView.setImageBitmap(bitmap); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/viewholder/PagerViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.viewholder; 2 | 3 | import android.content.Context; 4 | import android.view.View; 5 | 6 | import com.google.android.material.tabs.TabLayout; 7 | import com.xue.viewpagerdemo.R; 8 | import com.xue.viewpagerdemo.SubPagerAdapter; 9 | import com.xue.viewpagerdemo.common.BaseViewHolder; 10 | import com.xue.viewpagerdemo.common.HolderAnnotation; 11 | import com.xue.viewpagerdemo.model.NestedViewModel; 12 | import com.xue.viewpagerdemo.model.PageVO; 13 | 14 | import java.util.List; 15 | 16 | import androidx.annotation.NonNull; 17 | import androidx.fragment.app.FragmentActivity; 18 | import androidx.lifecycle.Observer; 19 | import androidx.lifecycle.ViewModelProviders; 20 | import androidx.viewpager.widget.PagerAdapter; 21 | import androidx.viewpager.widget.ViewPager; 22 | 23 | /** 24 | * Created by 薛贤俊 on 2019/2/21. 25 | */ 26 | @HolderAnnotation(layoutId = R.layout.item_pager) 27 | public class PagerViewHolder extends BaseViewHolder> { 28 | 29 | private ViewPager viewPager; 30 | 31 | private TabLayout tabLayout; 32 | 33 | private PagerAdapter pagerAdapter; 34 | 35 | private List model; 36 | 37 | private NestedViewModel viewModel; 38 | 39 | private Observer observer = new Observer() { 40 | @Override 41 | public void onChanged(Integer height) { 42 | if (height != null) { 43 | itemView.getLayoutParams().height = height; 44 | itemView.requestLayout(); 45 | } 46 | } 47 | }; 48 | 49 | public PagerViewHolder(@NonNull View itemView) { 50 | super(itemView); 51 | } 52 | 53 | @Override 54 | public void initViews() { 55 | viewPager = itemView.findViewById(R.id.viewpager); 56 | tabLayout = itemView.findViewById(R.id.tablayout); 57 | tabLayout.setupWithViewPager(viewPager, true); 58 | viewPager.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { 59 | @Override 60 | public void onViewAttachedToWindow(View v) { 61 | viewPager.requestLayout(); 62 | } 63 | 64 | @Override 65 | public void onViewDetachedFromWindow(View v) { 66 | 67 | } 68 | }); 69 | 70 | itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { 71 | @Override 72 | public void onViewAttachedToWindow(View view) { 73 | if (viewModel != null) { 74 | viewModel.getChildView().setValue(itemView); 75 | } 76 | } 77 | 78 | @Override 79 | public void onViewDetachedFromWindow(View view) { 80 | if (viewModel != null) { 81 | viewModel.getChildView().setValue(null); 82 | } 83 | } 84 | }); 85 | } 86 | 87 | @Override 88 | public void bindView(List data) { 89 | if (model == data) { 90 | return; 91 | } 92 | model = data; 93 | Context context = itemView.getContext(); 94 | if (context instanceof FragmentActivity) { 95 | FragmentActivity fragmentActivity = (FragmentActivity) context; 96 | pagerAdapter = new SubPagerAdapter(fragmentActivity.getSupportFragmentManager(), model); 97 | viewPager.setAdapter(pagerAdapter); 98 | pagerAdapter.notifyDataSetChanged(); 99 | viewModel = ViewModelProviders.of(fragmentActivity).get(NestedViewModel.class); 100 | viewModel.getPagerHeight().removeObserver(observer); 101 | viewModel.getPagerHeight().observe(fragmentActivity, observer); 102 | if (viewModel.getPagerHeight().getValue() != null) 103 | itemView.getLayoutParams().height = viewModel.getPagerHeight().getValue(); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /app/src/main/java/com/xue/viewpagerdemo/viewholder/TextViewHolder.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo.viewholder; 2 | 3 | import android.view.View; 4 | import android.widget.TextView; 5 | 6 | import com.xue.viewpagerdemo.R; 7 | import com.xue.viewpagerdemo.common.BaseViewHolder; 8 | import com.xue.viewpagerdemo.common.HolderAnnotation; 9 | 10 | import androidx.annotation.NonNull; 11 | 12 | /** 13 | * Created by 薛贤俊 on 2019/2/22. 14 | */ 15 | @HolderAnnotation(layoutId = R.layout.item_text) 16 | public class TextViewHolder extends BaseViewHolder { 17 | 18 | private TextView textView; 19 | 20 | public TextViewHolder(@NonNull View itemView) { 21 | super(itemView); 22 | } 23 | 24 | @Override 25 | public void initViews() { 26 | textView = itemView.findViewById(R.id.textview); 27 | } 28 | 29 | @Override 30 | public void bindView(String data) { 31 | textView.setText(data); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_first_generation.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/child_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/goods_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_pager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_parent_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/pager_holder.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/pic1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/pic1.jpeg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/pic2.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/pic3.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/pic4.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/pic5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xhdpi/pic5.jpeg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 400dp 4 | 5 | 40dp 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | NestedScrollingDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/xue/viewpagerdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xue.viewpagerdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | jcenter() 7 | 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.3.0' 11 | 12 | // NOTE: Do not place your application dependencies here; they belong 13 | // in the individual module build.gradle files 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | 15 | 16 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xue5455/NestedScrollingDemo/804565e7f642775cabc7bacd7caf267d53a01928/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 13 16:21:46 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Wed Feb 13 16:21:47 CST 2019 8 | ndk.dir=/Users/jake/Library/Android/sdk/ndk-bundle 9 | sdk.dir=/Users/jake/Library/Android/sdk 10 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------