Skip to content

Commit

Permalink
[webview] do not open url if overrided
Browse files Browse the repository at this point in the history
  • Loading branch information
ekibun committed Aug 19, 2019
1 parent 72fc05c commit 50478ac
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/main/java/soko/ekibun/bangumi/ui/view/NestedWebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ class NestedWebView @JvmOverloads constructor(context: Context, attrs: Attribute
newView.parentWebView = webview
webview.childWebView = newView
newView.shouldOverrideUrlLoading = { v: WebView, request: WebResourceRequest ->
newView.loadUrl(request.url.toString())
newView.shouldOverrideUrlLoading = webview.shouldOverrideUrlLoading
newView.shouldOverrideUrlLoading(v, request)
val ret = newView.shouldOverrideUrlLoading(v, request)
if (ret) {
newView.close()
} else {
newView.loadUrl(request.url.toString())
newView.shouldOverrideUrlLoading = webview.shouldOverrideUrlLoading
}
ret
}
val layoutParams = webview.layoutParams
parent.removeView(webview)
Expand Down

0 comments on commit 50478ac

Please sign in to comment.