pull/1352/head
gedoor 3 years ago
parent 5db9d95b92
commit 1681c8891a
  1. 14
      app/src/main/java/io/legado/app/help/http/BackstageWebView.kt

@ -58,19 +58,23 @@ class BackstageWebView(
} }
private fun load() { private fun load() {
mWebView = createWebView().apply { val webView = createWebView()
mWebView = webView
try {
when { when {
!html.isNullOrEmpty() -> if (url.isNullOrEmpty()) { !html.isNullOrEmpty() -> if (url.isNullOrEmpty()) {
loadData(html, "text/html", getEncoding()) webView.loadData(html, "text/html", getEncoding())
} else { } else {
loadDataWithBaseURL(url, html, "text/html", getEncoding(), url) webView.loadDataWithBaseURL(url, html, "text/html", getEncoding(), url)
} }
else -> if (headerMap == null) { else -> if (headerMap == null) {
loadUrl(url!!) webView.loadUrl(url!!)
} else { } else {
loadUrl(url!!, headerMap) webView.loadUrl(url!!, headerMap)
} }
} }
} catch (e: Exception) {
callback?.onError(e)
} }
} }

Loading…
Cancel
Save