From ba2194f43547325242051827cdcbc737e5a9b3c3 Mon Sep 17 00:00:00 2001 From: inorichi Date: Fri, 12 Apr 2019 17:29:02 +0200 Subject: [PATCH] Load urls inside webview --- .../tachiyomi/ui/manga/info/MangaWebViewController.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt index 36126a9b22..8d7d9687a0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaWebViewController.kt @@ -5,11 +5,11 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.webkit.WebView -import android.webkit.WebViewClient import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.BaseController +import eu.kanade.tachiyomi.util.WebViewClientCompat import uy.kohesive.injekt.injectLazy class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) { @@ -32,7 +32,12 @@ class MangaWebViewController(bundle: Bundle? = null) : BaseController(bundle) { val headers = source.headers.toMultimap().mapValues { it.value.getOrNull(0) ?: "" } val web = view as WebView - web.webViewClient = WebViewClient() + web.webViewClient = object : WebViewClientCompat() { + override fun shouldOverrideUrlCompat(view: WebView, url: String): Boolean { + view.loadUrl(url) + return true + } + } web.settings.javaScriptEnabled = true web.settings.userAgentString = source.headers["User-Agent"] web.loadUrl(url, headers)