Hovhannes
11/11/2021, 9:36 AMprivate fun webViewSettings(url: String) {
activityWebBinding.webView.settings.apply {
javaScriptEnabled = true
domStorageEnabled = true
builtInZoomControls = true
displayZoomControls = false
javaScriptCanOpenWindowsAutomatically = true
cacheMode = WebSettings.LOAD_DEFAULT
setAppCachePath(applicationContext.cacheDir.absolutePath)
defaultZoom = WebSettings.ZoomDensity.FAR
loadWithOverviewMode = true
useWideViewPort = true
allowFileAccess = true
allowContentAccess = true
setSupportZoom(true)
layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN
setRenderPriority(WebSettings.RenderPriority.HIGH)
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
setSupportMultipleWindows(true)
}
activityWebBinding.webView.apply {
if (Build.VERSION.SDK_INT >= 22) {
setLayerType(View.LAYER_TYPE_HARDWARE, null)
} else {
setLayerType(View.LAYER_TYPE_SOFTWARE, null)
}
scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY
isScrollbarFadingEnabled = true
setBackgroundColor(Color.TRANSPARENT)
loadUrl(url)
}
}
Sergio C.
11/11/2021, 3:19 PM