//스크롤이 설정 - 스크롤이 bar가 보이지 않도록 해준다.
webview.isVerticalScrollBarEnabled = false
webview.isHorizontalScrollBarEnabled = false
webSettings = ManiaWebView.settings
// 웹뷰 멀티 터치 가능하게 (줌기능)
//webSettings.setBuiltInZoomControls(true); // 줌 아이콘 사용
webSettings?.setSupportZoom(true)
webSettings?.displayZoomControls = true
webSettings?.setJavaScriptEnabled(true) // 자바스크립트 사용이 가능해야 함
webSettings?.domStorageEnabled = true // localStorage 사용을 위해
webSettings?.setSupportMultipleWindows(true);
webSettings?.javaScriptCanOpenWindowsAutomatically = true;
webview.webChromeClient = object : WebChromeClient() {
override fun onCreateWindow(view: WebView?, isDialog: Boolean, isUserGesture: Boolean, resultMsg: Message?): Boolean {
val newWebView = WebView(this@MainActivity).apply {
webViewClient = WebViewClient()
settings.javaScriptEnabled = true
settings.userAgentString = "Mozilla/5.0 AppleWebKit/535.19 Chrome/56.0.0 Mobile Safari/535.19";
}
val dialog = Dialog(this@MainActivity).apply {
setContentView(newWebView)
window!!.attributes.width = ViewGroup.LayoutParams.MATCH_PARENT
window!!.attributes.height = ViewGroup.LayoutParams.MATCH_PARENT
show()
}
newWebView.webChromeClient = object : WebChromeClient() {
override fun onCloseWindow(window: WebView?) {
dialog.dismiss()
}
}
(resultMsg?.obj as WebView.WebViewTransport).webView = newWebView
resultMsg.sendToTarget()
return true
}
}