├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── bg_hot.png │ │ │ │ ├── ic_drag.png │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable │ │ │ │ ├── bg_border.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── fragment_tab3.xml │ │ │ │ ├── fragment_tab1.xml │ │ │ │ ├── item_my.xml │ │ │ │ ├── item_dragger.xml │ │ │ │ ├── activity_example_webview.xml │ │ │ │ ├── activity_recycler.xml │ │ │ │ ├── fragment_tab2.xml │ │ │ │ ├── activity_example_webview_refresh.xml │ │ │ │ ├── activity_example5.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── activity_nested_scroll.xml │ │ │ │ ├── activity_three.xml │ │ │ │ ├── activity_example1.xml │ │ │ │ ├── activity_example2.xml │ │ │ │ ├── activity_example3.xml │ │ │ │ └── activity_example4.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── fc │ │ │ │ └── nestedscrollview │ │ │ │ └── example │ │ │ │ ├── Example3Activity.kt │ │ │ │ ├── NestedScrollNestedScrollActivity.kt │ │ │ │ ├── NestedScrollRecyclerViewActivity.kt │ │ │ │ ├── fragment │ │ │ │ ├── Tab2Fragment.kt │ │ │ │ ├── Tab3Fragment.kt │ │ │ │ └── Tab1Fragment.kt │ │ │ │ ├── ThreeNestedActivity.kt │ │ │ │ ├── WebViewExampleActivity.kt │ │ │ │ ├── WebViewRefreshExampleActivity.kt │ │ │ │ ├── MyDraggerRecyclerAdapter.kt │ │ │ │ ├── MyRecyclerAdapter.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── Example4Activity.kt │ │ │ │ ├── Example1Activity.kt │ │ │ │ ├── Example2Activity.kt │ │ │ │ └── Example5Activity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── fc │ │ │ └── nestedscrollview │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── fc │ │ └── nestedscrollview │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── fc │ │ │ └── nestedscrollview │ │ │ ├── OnScrollStateListener.java │ │ │ ├── FCFlingView.java │ │ │ ├── FcNestedUtil.java │ │ │ ├── FCSwipeRefreshLayout.java │ │ │ ├── FCRecyclerView.java │ │ │ ├── FCWebView.java │ │ │ └── FCNestedScrollView.java │ └── test │ │ └── java │ │ └── com │ │ └── fc │ │ └── nestedscrollview │ │ └── ExampleUnitTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── 123.gif ├── 222.gif ├── 333.gif ├── 444.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | -------------------------------------------------------------------------------- /123.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/123.gif -------------------------------------------------------------------------------- /222.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/222.gif -------------------------------------------------------------------------------- /333.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/333.gif -------------------------------------------------------------------------------- /444.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/444.gif -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | library 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | FCNestedScrollView 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/bg_hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xhdpi/bg_hot.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xhdpi/ic_drag.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/403462630/FCNestedScrollView/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | .idea/ 11 | -------------------------------------------------------------------------------- /library/src/main/java/com/fc/nestedscrollview/OnScrollStateListener.java: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview; 2 | 3 | public interface OnScrollStateListener { 4 | public void onScrollStart(); 5 | public void onScrollEnd(); 6 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Mar 28 15:38:04 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /library/src/main/java/com/fc/nestedscrollview/FCFlingView.java: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview; 2 | 3 | public interface FCFlingView { 4 | 5 | /** 6 | * 判断是否能滚动 7 | * @param direction < 0 向下滚,> 0 向上滚 8 | * @return 9 | */ 10 | public boolean canFling(int direction); 11 | 12 | /** 13 | * 滚动实现 14 | * @param velocityY 加速度 15 | */ 16 | public void fling(int velocityY); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/Example3Activity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | 6 | class Example3Activity : AppCompatActivity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_example3) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/NestedScrollNestedScrollActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | 6 | class NestedScrollNestedScrollActivity : AppCompatActivity() { 7 | 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | setContentView(R.layout.activity_nested_scroll) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/test/java/com/fc/nestedscrollview/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /library/src/test/java/com/fc/nestedscrollview/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview; 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() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_tab3.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_tab1.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_my.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/fc/nestedscrollview/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview 2 | 3 | 4 | import androidx.test.InstrumentationRegistry 5 | import androidx.test.runner.AndroidJUnit4 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.fc.nestedscrollview", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /library/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 | -------------------------------------------------------------------------------- /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 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | android.useAndroidX=true 19 | android.enableJetifier=true 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/NestedScrollRecyclerViewActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import kotlinx.android.synthetic.main.activity_recycler.* 7 | 8 | class NestedScrollRecyclerViewActivity : AppCompatActivity() { 9 | 10 | private var myAdapter : MyRecyclerAdapter? = null 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_recycler) 15 | myAdapter = MyRecyclerAdapter("item") 16 | recycler_view.apply { 17 | layoutManager = LinearLayoutManager(this@NestedScrollRecyclerViewActivity) 18 | adapter = myAdapter 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/fragment/Tab2Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import androidx.fragment.app.Fragment 8 | import com.fc.nestedscrollview.example.R 9 | import kotlinx.android.synthetic.main.fragment_tab2.* 10 | 11 | /** 12 | * Created by fangcan on 2018/4/2. 13 | */ 14 | class Tab2Fragment : Fragment() { 15 | 16 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 17 | return inflater!!.inflate(R.layout.fragment_tab2, container, false) 18 | } 19 | 20 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 21 | super.onViewCreated(view, savedInstanceState) 22 | recycler_view.logId = "child" 23 | recycler_view.enableLog = true 24 | } 25 | } -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/ThreeNestedActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import kotlinx.android.synthetic.main.activity_three.* 7 | 8 | class ThreeNestedActivity : AppCompatActivity() { 9 | 10 | private var myAdapter : MyRecyclerAdapter? = null 11 | 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_three) 15 | myAdapter = MyRecyclerAdapter("item") 16 | recycler_view.apply { 17 | layoutManager = LinearLayoutManager(this@ThreeNestedActivity) 18 | adapter = myAdapter 19 | } 20 | nested_scroll_view.setLinkChildView(nested_scroll_view_child) 21 | nested_scroll_view_child.setLinkChildView(recycler_view) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/WebViewExampleActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.annotation.SuppressLint 4 | import android.os.Bundle 5 | import android.webkit.WebChromeClient 6 | import android.webkit.WebViewClient 7 | import androidx.appcompat.app.AppCompatActivity 8 | import kotlinx.android.synthetic.main.activity_example_webview.* 9 | 10 | class WebViewExampleActivity : AppCompatActivity() { 11 | 12 | @SuppressLint("SetJavaScriptEnabled") 13 | override fun onCreate(savedInstanceState: Bundle?) { 14 | super.onCreate(savedInstanceState) 15 | setContentView(R.layout.activity_example_webview) 16 | web_view.webChromeClient = WebChromeClient() 17 | web_view.webViewClient = WebViewClient() 18 | web_view.settings.builtInZoomControls = true 19 | web_view.settings.javaScriptEnabled = true 20 | web_view.settings.domStorageEnabled = true 21 | web_view.loadUrl("http://www.baidu.com/") 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | -keep class android.support.v7.widget.RecyclerView{*;} 23 | -keep class android.support.v4.widget.NestedScrollView{*;} 24 | 25 | -keep class androidx.recyclerview.widget.RecyclerView{*;} 26 | -keep class androidx.core.widget.NestedScrollView{*;} 27 | 28 | #-keep class android.widget.OverScroller{*;} -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/WebViewRefreshExampleActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.annotation.SuppressLint 4 | import android.os.Bundle 5 | import android.webkit.WebChromeClient 6 | import android.webkit.WebViewClient 7 | import androidx.appcompat.app.AppCompatActivity 8 | import kotlinx.android.synthetic.main.activity_example_webview_refresh.* 9 | 10 | class WebViewRefreshExampleActivity : AppCompatActivity() { 11 | 12 | @SuppressLint("SetJavaScriptEnabled") 13 | override fun onCreate(savedInstanceState: Bundle?) { 14 | super.onCreate(savedInstanceState) 15 | setContentView(R.layout.activity_example_webview_refresh) 16 | web_view.webChromeClient = WebChromeClient() 17 | web_view.webViewClient = WebViewClient() 18 | web_view.settings.builtInZoomControls = true 19 | web_view.settings.javaScriptEnabled = true 20 | web_view.settings.domStorageEnabled = true 21 | web_view.loadUrl("http://www.baidu.com/") 22 | 23 | swipe_refresh.setOnRefreshListener { 24 | swipe_refresh.postDelayed({ 25 | swipe_refresh.isRefreshing = false 26 | }, 5_000) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/MyDraggerRecyclerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.view.View 4 | import com.chad.library.adapter.base.BaseItemDraggableAdapter 5 | import com.chad.library.adapter.base.BaseViewHolder 6 | import kotlinx.android.extensions.ContainerOptions 7 | import kotlinx.android.extensions.LayoutContainer 8 | import kotlinx.android.synthetic.main.item_dragger.* 9 | 10 | /** 11 | * Created by fangcan on 2018/3/28. 12 | */ 13 | class MyDraggerRecyclerAdapter(data: List) : BaseItemDraggableAdapter(R.layout.item_dragger, data) { 14 | 15 | override fun convert(helper: MyViewHolder, item: String?) { 16 | helper!!.setText(R.id.tv_content, item) 17 | } 18 | 19 | override fun onBindViewHolder(holder: MyViewHolder, position: Int) { 20 | super.onBindViewHolder(holder, position) 21 | (holder as MyViewHolder).bindData(position, getItem(position)!!) 22 | } 23 | 24 | 25 | @ContainerOptions 26 | class MyViewHolder(override val containerView: View?) : BaseViewHolder(containerView), LayoutContainer { 27 | 28 | fun bindData(position: Int, text: String) { 29 | tv_content.text = text 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /library/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/MyRecyclerAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.view.LayoutInflater 4 | import android.view.View 5 | import android.view.ViewGroup 6 | import androidx.recyclerview.widget.RecyclerView 7 | import kotlinx.android.extensions.ContainerOptions 8 | import kotlinx.android.extensions.LayoutContainer 9 | import kotlinx.android.synthetic.main.item_my.* 10 | 11 | /** 12 | * Created by fangcan on 2018/3/28. 13 | */ 14 | class MyRecyclerAdapter(var text: String) : RecyclerView.Adapter() { 15 | 16 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { 17 | return MyViewHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.item_my, parent, false)) 18 | } 19 | 20 | override fun getItemCount(): Int { 21 | return 20 22 | } 23 | 24 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { 25 | (holder as MyViewHolder).bindData(position, text) 26 | } 27 | 28 | 29 | @ContainerOptions 30 | class MyViewHolder(override val containerView: View) : RecyclerView.ViewHolder(containerView), LayoutContainer { 31 | 32 | fun bindData(position: Int, text: String) { 33 | tv_text.text = text + "_" + position 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/fragment/Tab3Fragment.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example.fragment 2 | 3 | import android.os.Bundle 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.webkit.WebChromeClient 8 | import android.webkit.WebViewClient 9 | import androidx.fragment.app.Fragment 10 | import com.fc.nestedscrollview.example.R 11 | import kotlinx.android.synthetic.main.fragment_tab3.* 12 | 13 | /** 14 | * Created by fangcan on 2018/4/2. 15 | */ 16 | class Tab3Fragment : Fragment() { 17 | 18 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { 19 | return inflater!!.inflate(R.layout.fragment_tab3, container, false) 20 | } 21 | 22 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { 23 | super.onViewCreated(view, savedInstanceState) 24 | 25 | web_view.webChromeClient = WebChromeClient() 26 | web_view.webViewClient = WebViewClient() 27 | web_view.settings.builtInZoomControls = true 28 | web_view.settings.javaScriptEnabled = true 29 | web_view.settings.domStorageEnabled = true 30 | web_view.settings.setSupportZoom(false) 31 | web_view.setOnLongClickListener { true } 32 | web_view.loadUrl("http://news.baidu.com/") 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.view.View 6 | import androidx.appcompat.app.AppCompatActivity 7 | 8 | class MainActivity : AppCompatActivity() { 9 | 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContentView(R.layout.activity_main) 13 | } 14 | 15 | fun gotoExample1(view: View) { 16 | startActivity(Intent(this, Example1Activity::class.java)) 17 | } 18 | 19 | fun gotoExample2(view: View) { 20 | startActivity(Intent(this, Example2Activity::class.java)) 21 | } 22 | 23 | fun gotoExample3(view: View) { 24 | startActivity(Intent(this, Example3Activity::class.java)) 25 | } 26 | 27 | fun gotoExample4(view: View) { 28 | startActivity(Intent(this, Example4Activity::class.java)) 29 | } 30 | 31 | fun gotoExample5(view: View) { 32 | startActivity(Intent(this, Example5Activity::class.java)) 33 | } 34 | 35 | fun gotoWebviewExample(view: View) { 36 | startActivity(Intent(this, WebViewExampleActivity::class.java)) 37 | } 38 | 39 | fun gotoWebviewRefreshExample(view: View) { 40 | startActivity(Intent(this, WebViewRefreshExampleActivity::class.java)) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/Example4Activity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import kotlinx.android.synthetic.main.activity_example4.* 6 | 7 | class Example4Activity : AppCompatActivity() { 8 | 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | setContentView(R.layout.activity_example4) 12 | 13 | swipe_refresh.setOnRefreshListener { 14 | swipe_refresh.postDelayed({ 15 | swipe_refresh.isRefreshing = false 16 | }, 5_000) 17 | } 18 | 19 | swipe_refresh1.setOnRefreshListener { 20 | swipe_refresh1.postDelayed({ 21 | swipe_refresh1.isRefreshing = false 22 | }, 5_000) 23 | } 24 | 25 | swipe_refresh2.setOnRefreshListener { 26 | swipe_refresh2.postDelayed({ 27 | swipe_refresh2.isRefreshing = false 28 | }, 5_000) 29 | } 30 | 31 | swipe_refresh3.setOnRefreshListener { 32 | swipe_refresh3.postDelayed({ 33 | swipe_refresh3.isRefreshing = false 34 | }, 5_000) 35 | } 36 | 37 | swipe_refresh4.setOnRefreshListener { 38 | swipe_refresh4.postDelayed({ 39 | swipe_refresh4.isRefreshing = false 40 | }, 5_000) 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_dragger.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 18 | 19 | 30 | 31 | 40 | -------------------------------------------------------------------------------- /library/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'com.github.dcendents.android-maven' 3 | 4 | group="com.github.403462630" 5 | 6 | android { 7 | compileSdkVersion 28 8 | 9 | defaultConfig { 10 | minSdkVersion 16 11 | targetSdkVersion 26 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | 24 | compileOptions { 25 | sourceCompatibility JavaVersion.VERSION_1_8 26 | targetCompatibility JavaVersion.VERSION_1_8 27 | } 28 | } 29 | 30 | //task sourcesJar(type: Jar) { 31 | // from android.sourceSets.main.java.srcDirs 32 | // classifier = 'sources' 33 | //} 34 | // 35 | //task javadoc(type: Javadoc) { 36 | // options.encoding = "utf-8" 37 | // source = android.sourceSets.main.java.srcDirs 38 | // classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 39 | //} 40 | // 41 | //task javadocJar(type: Jar, dependsOn: javadoc) { 42 | // classifier = 'javadoc' 43 | // from javadoc.destinationDir 44 | //} 45 | // 46 | //artifacts { 47 | //// archives javadocJar 48 | // archives sourcesJar 49 | //} 50 | 51 | dependencies { 52 | implementation fileTree(dir: 'libs', include: ['*.jar']) 53 | testImplementation 'junit:junit:4.13.2' 54 | 55 | compileOnly 'androidx.appcompat:appcompat:1.2.0' 56 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 57 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | 21 | 25 | 26 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_recycler.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | 21 | 25 | 26 | 32 | 33 | 34 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_tab2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/fc/nestedscrollview/example/Example1Activity.kt: -------------------------------------------------------------------------------- 1 | package com.fc.nestedscrollview.example 2 | 3 | import android.os.Bundle 4 | import androidx.appcompat.app.AppCompatActivity 5 | import androidx.recyclerview.widget.LinearLayoutManager 6 | import kotlinx.android.synthetic.main.activity_example1.* 7 | 8 | class Example1Activity : AppCompatActivity() { 9 | 10 | private var myAdapter1 : MyRecyclerAdapter? = null 11 | private var myAdapter2 : MyRecyclerAdapter? = null 12 | private var myAdapter3 : MyRecyclerAdapter? = null 13 | private var myAdapter4 : MyRecyclerAdapter? = null 14 | 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | setContentView(R.layout.activity_example1) 18 | myAdapter1 = MyRecyclerAdapter("我先滚动") 19 | myAdapter2 = MyRecyclerAdapter("我最后滚动") 20 | myAdapter3 = MyRecyclerAdapter("我先向下滚") 21 | myAdapter4 = MyRecyclerAdapter("我先向上滚") 22 | 23 | recycler_view1.apply { 24 | layoutManager = LinearLayoutManager(this@Example1Activity) 25 | adapter = myAdapter1 26 | } 27 | 28 | recycler_view2.apply { 29 | layoutManager = LinearLayoutManager(this@Example1Activity) 30 | adapter = myAdapter2 31 | } 32 | 33 | // recycler_view3.isDraggingItem = true 34 | recycler_view3.apply { 35 | layoutManager = LinearLayoutManager(this@Example1Activity) 36 | adapter = myAdapter3 37 | } 38 | 39 | recycler_view4.apply { 40 | layoutManager = LinearLayoutManager(this@Example1Activity) 41 | adapter = myAdapter4 42 | } 43 | 44 | tv_scroll_by.setOnClickListener { 45 | recycler_view3.nestedScrollBy(100) 46 | // recycler_view3.scrollBy(0, 100) 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_example_webview_refresh.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 19 | 20 | 21 | 25 | 26 | 32 | 33 | s 34 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 28 9 | defaultConfig { 10 | applicationId "com.fc.nestedscrollview.example" 11 | minSdkVersion 16 12 | targetSdkVersion 26 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled true 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | debug { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | 28 | androidExtensions { 29 | experimental = true //注意:此功能还在实验阶段 30 | } 31 | lintOptions { 32 | abortOnError false 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation fileTree(dir: 'libs', include: ['*.jar']) 38 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 39 | implementation 'androidx.appcompat:appcompat:1.2.0' 40 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 41 | implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' 42 | implementation 'com.google.android.material:material:1.3.0-alpha04' 43 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 44 | testImplementation 'junit:junit:4.13.2' 45 | androidTestImplementation 'androidx.test:runner:1.3.0' 46 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 47 | implementation project(":library") 48 | // implementation 'fc.nestedscrollview.androidx:library:1.0.0' 49 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.49-androidx' 50 | // implementation 'com.github.403462630:FCNestedScrollView:1.0.0' 51 | } 52 | -------------------------------------------------------------------------------- /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/layout/activity_example5.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 18 | 19 | 24 | 25 | 26 | 32 | 33 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 |