mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-29 11:23:16 -05:00
Add ability to inspect WebView in debug builds
This commit is contained in:
parent
2661700d9a
commit
916c1c9de2
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.webview
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.ApplicationInfo
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
@ -10,6 +11,7 @@ import android.view.MenuItem
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.databinding.WebviewActivityBinding
|
import eu.kanade.tachiyomi.databinding.WebviewActivityBinding
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
|
@ -62,6 +64,12 @@ class WebViewActivity : BaseActivity<WebviewActivityBinding>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
supportActionBar?.subtitle = url
|
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.settings.javaScriptEnabled = true
|
||||||
|
|
||||||
binding.webview.webChromeClient = object : WebChromeClient() {
|
binding.webview.webChromeClient = object : WebChromeClient() {
|
||||||
|
|
Loading…
Reference in a new issue