Skip to content

satoshun/RxWebView

Repository files navigation

Maven Central CircleCI codecov

RxWebView

RxJava2 binding APIs for Android WebView with Kotlin.

install

implementation "com.github.satoshun.RxWebView:rxwebview:${latest-version}"

usage

WebViewClient

If you want a all events from WebViewClient, we can use a RxWebViewClient#events method.

val webview = WebView(context)
webview.events().subscribe() // emits all WebView eventss

If you want a specific event like a onPageFinished, we can use a RxWebViewClient#events + ofType operator.

val webview = WebView(context)
webView.events()
    .ofType(OnPageFinished::class.java) // only OnPageFinished
    .subscribe()

If you want to a hook events from WebViewClient, we can give a custom WebViewClient.

webview.events(delegate = CustomWebViewClient()).subscribe()

All data type defined in this.

WebChromeClient

If you want a all events from WebChromeClient.

val webview = WebView(context)
webview.chromeEvents().subscribe()

If you want to a hook events from WebChromeClient, we can give a custom WebChromeClient.

webview.chromeEvents(delegate = customWebChromeClient).subscribe()

All data type defined in this

more information

etc

This project inspired by RxBinding. It was very helpful. thx!