Commit 0b394320 authored by 周文华's avatar 周文华

【修复】修复webvie嵌套refresh导致的滑动冲突.

parent dc7afb7e
...@@ -27,7 +27,8 @@ import kotlinx.coroutines.launch ...@@ -27,7 +27,8 @@ import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>(ActivityWebBrowserBinding::inflate) { class WebBrowserActivity :
BaseActivity<ActivityWebBrowserBinding>(ActivityWebBrowserBinding::inflate) {
override fun initView() { override fun initView() {
super.initView() super.initView()
...@@ -172,7 +173,7 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>(ActivityWebBr ...@@ -172,7 +173,7 @@ class WebBrowserActivity : BaseActivity<ActivityWebBrowserBinding>(ActivityWebBr
val instance = CookieManager.getInstance() val instance = CookieManager.getInstance()
instance.setAcceptThirdPartyCookies(binding.webView, true) instance.setAcceptThirdPartyCookies(binding.webView, true)
binding.webView.addJavascriptInterface(this, "android") binding.webView.addJavascriptInterface(this, "android")
binding.webView.swipeRefreshLayout = binding.refreshLayout
} }
} }
\ No newline at end of file
package com.base.scanqrclear.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.webkit.WebView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
/**
*Create by SleepDog on 2025-01-21
*/
class WebRefreshView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : WebView(context, attrs) {
var swipeRefreshLayout: SwipeRefreshLayout? = null
override fun onScrollChanged(l: Int, t: Int, oldl: Int, oldt: Int) {
super.onScrollChanged(l, t, oldl, oldt)
swipeRefreshLayout?.isEnabled = scrollY == 0
}
}
\ No newline at end of file
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<WebView <com.base.scanqrclear.ui.widget.WebRefreshView
android:id="@+id/webView" android:id="@+id/webView"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment