diff --git a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt index 8f2340d79..ad0265c60 100644 --- a/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt +++ b/app/src/main/java/io/legado/app/ui/browser/WebViewActivity.kt @@ -21,6 +21,7 @@ import io.legado.app.help.SourceVerificationHelp import io.legado.app.help.config.AppConfig import io.legado.app.help.http.CookieStore import io.legado.app.lib.dialogs.SelectItem +import io.legado.app.lib.theme.accentColor import io.legado.app.model.Download import io.legado.app.ui.association.OnLineImportActivity import io.legado.app.ui.document.HandleFileContract @@ -81,6 +82,7 @@ class WebViewActivity : VMBaseActivity() { @SuppressLint("JavascriptInterface", "SetJavaScriptEnabled") private fun initWebView(url: String, headerMap: HashMap) { + binding.progressBar.fontColor = accentColor binding.webView.webChromeClient = CustomWebChromeClient() binding.webView.webViewClient = CustomWebViewClient() binding.webView.settings.apply { @@ -191,6 +193,12 @@ class WebViewActivity : VMBaseActivity() { inner class CustomWebChromeClient : WebChromeClient() { + override fun onProgressChanged(view: WebView?, newProgress: Int) { + super.onProgressChanged(view, newProgress) + binding.progressBar.setDurProgress(newProgress) + binding.progressBar.gone(newProgress == 100) + } + override fun onShowCustomView(view: View?, callback: CustomViewCallback?) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR binding.llView.invisible() diff --git a/app/src/main/res/layout/activity_web_view.xml b/app/src/main/res/layout/activity_web_view.xml index 6eb28b4f8..a946c6d40 100644 --- a/app/src/main/res/layout/activity_web_view.xml +++ b/app/src/main/res/layout/activity_web_view.xml @@ -5,7 +5,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"> - + app:fitStatusBar="false" + app:layout_constraintTop_toTopOf="parent" /> + android:layout_height="0dp" + app:layout_constraintTop_toBottomOf="@+id/title_bar" + app:layout_constraintBottom_toBottomOf="parent" /> - + + +