From 916c1c9de2ceb5c605bf5241fdcfb045d12c2dd2 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 29 Apr 2020 22:46:11 -0400 Subject: [PATCH] Add ability to inspect WebView in debug builds --- .../eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt index 335dd3b878..b47f031c30 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.webview import android.annotation.SuppressLint import android.content.Context import android.content.Intent +import android.content.pm.ApplicationInfo import android.graphics.Bitmap import android.os.Bundle import android.view.Menu @@ -10,6 +11,7 @@ import android.view.MenuItem import android.webkit.WebChromeClient import android.webkit.WebView import androidx.core.graphics.ColorUtils +import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.WebviewActivityBinding import eu.kanade.tachiyomi.source.SourceManager @@ -62,6 +64,12 @@ class WebViewActivity : BaseActivity() { } supportActionBar?.subtitle = url + + // Debug mode (chrome://inspect/#devices) + if (BuildConfig.DEBUG && 0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) { + WebView.setWebContentsDebuggingEnabled(true) + } + binding.webview.settings.javaScriptEnabled = true binding.webview.webChromeClient = object : WebChromeClient() {