mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Show message if WebView version is too low
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package eu.kanade.tachiyomi.ui.webview
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
@@ -14,10 +15,7 @@ import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import eu.kanade.tachiyomi.util.system.WebViewClientCompat
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.system.*
|
||||
import eu.kanade.tachiyomi.util.view.invisible
|
||||
import eu.kanade.tachiyomi.util.view.visible
|
||||
import kotlinx.android.synthetic.main.webview_activity.*
|
||||
@@ -29,6 +27,7 @@ class WebViewActivity : BaseActivity() {
|
||||
|
||||
private var bundle: Bundle? = null
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.webview_activity)
|
||||
@@ -54,6 +53,11 @@ class WebViewActivity : BaseActivity() {
|
||||
val url = intent.extras!!.getString(URL_KEY) ?: return
|
||||
val headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" }
|
||||
|
||||
webview.checkVersion()
|
||||
|
||||
webview.settings.javaScriptEnabled = true
|
||||
webview.settings.userAgentString = source.headers["User-Agent"]
|
||||
|
||||
webview.webChromeClient = object : WebChromeClient() {
|
||||
override fun onProgressChanged(view: WebView?, newProgress: Int) {
|
||||
progress_bar.visible()
|
||||
@@ -91,8 +95,7 @@ class WebViewActivity : BaseActivity() {
|
||||
nested_view.scrollTo(0, 0)
|
||||
}
|
||||
}
|
||||
webview.settings.javaScriptEnabled = true
|
||||
webview.settings.userAgentString = source.headers["User-Agent"]
|
||||
|
||||
webview.loadUrl(url, headers)
|
||||
} else {
|
||||
webview.restoreState(bundle)
|
||||
|
||||
Reference in New Issue
Block a user