Guest User

Untitled

a guest
Jan 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. webView.webViewClient = object : WebViewClient() {
  2.  
  3. override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
  4.  
  5.  
  6.  
  7.  
  8. view!!.loadUrl(request!!.url.toString())
  9. return true
  10.  
  11.  
  12. }
  13.  
  14. override fun shouldInterceptRequest(view: WebView?, request: WebResourceRequest?): WebResourceResponse {
  15. return if (
  16.  
  17. AdBlocker.isAd(request!!.url.toString()))
  18. AdBlocker.createEmptyResource()
  19. else
  20. super.shouldInterceptRequest(view, request)
  21. }
  22.  
  23.  
  24.  
  25. override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
  26. eTadres.setText(url)
  27.  
  28.  
  29. suankiurl= url!!
  30. super.onPageStarted(view, url, favicon)
  31. }
  32.  
  33.  
  34.  
  35. override fun onLoadResource(view: WebView?, url: String?) {
  36. if (webView.visibility==View.GONE){webView.visibility=View.VISIBLE}
  37. super.onLoadResource(view, url)
  38. }
  39.  
  40.  
  41. }
  42.  
  43. W/System.err: java.lang.IllegalStateException: super.shouldInterceptRequest(view, request) must not be null
  44. 10-19 17:46:53.185 306-349/com.bulamac.tarayicibulamac W/System.err: at com.bulamac.tarayicibulamac.WebviewFragment$onCreateView$5.shouldInterceptRequest(WebviewFragment.kt:182)
  45. 10-19 17:46:53.185 306-349/com.bulamac.tarayicibulamac W/System.err: at com.android.webview.chromium.WebViewContentsClientAdapter.shouldInterceptRequest(WebViewContentsClientAdapter.java:52)
  46. 10-19 17:46:53.185 306-349/com.bulamac.tarayicibulamac W/System.err: at org.chromium.android_webview.AwContents$BackgroundThreadClientImpl.shouldInterceptRequest(AwContents.java:9)
  47. 10-19 17:46:53.185 306-349/com.bulamac.tarayicibulamac W/System.err: at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(AwContentsBackgroundThreadClient.java:11)
  48. 10-19 17:46:53.186 306-349/com.bulamac.tarayicibulamac A/chromium: [FATAL:jni_android.cc(243)] Please include Java exception stack in crash report
  49.  
  50. override fun shouldInterceptRequest(view: WebView?, request: WebResourceRequest?): WebResourceResponse? {
  51. return super.shouldInterceptRequest(view, request)
  52. }
Add Comment
Please, Sign In to add comment