WebViewAssetLoader.Builder
class WebViewAssetLoader.Builder
A builder class for constructing WebViewAssetLoader objects.
Summary
Public constructors |
|---|
Builder() |
Public functions |
|
|---|---|
WebViewAssetLoader.Builder |
addPathHandler(path: String, handler: WebViewAssetLoader.PathHandler)Register a |
WebViewAssetLoader |
build()Build and return a |
WebViewAssetLoader.Builder |
Set the domain under which app assets can be accessed. |
WebViewAssetLoader.Builder |
setHttpAllowed(httpAllowed: Boolean)Allow using the HTTP scheme in addition to HTTPS. |
Public constructors
Public functions
addPathHandler
fun addPathHandler(path: String, handler: WebViewAssetLoader.PathHandler): WebViewAssetLoader.Builder
Register a PathHandler for a specific path.
The path should start and end with a "/" and it shouldn't collide with a real web path.
WebViewAssetLoader will try PathHandlers in the order they're registered, and will use whichever is the first to return a non-nullWebResourceResponse.
| Parameters | |
|---|---|
path: String |
the prefix path where this handler should be register. |
handler: WebViewAssetLoader.PathHandler |
|
| Returns | |
|---|---|
WebViewAssetLoader.Builder |
|
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the path is invalid. |
build
fun build(): WebViewAssetLoader
Build and return a WebViewAssetLoader object.
| Returns | |
|---|---|
WebViewAssetLoader |
immutable |
setDomain
fun setDomain(domain: String): WebViewAssetLoader.Builder
Set the domain under which app assets can be accessed. The default domain is "appassets.androidplatform.net"
| Parameters | |
|---|---|
domain: String |
the domain on which app assets should be hosted. |
| Returns | |
|---|---|
WebViewAssetLoader.Builder |
|
setHttpAllowed
fun setHttpAllowed(httpAllowed: Boolean): WebViewAssetLoader.Builder
Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
| Returns | |
|---|---|
WebViewAssetLoader.Builder |
|