WebViewAssetLoader.Builder


class WebViewAssetLoader.Builder


A builder class for constructing WebViewAssetLoader objects.

Summary

Public constructors

Public functions

WebViewAssetLoader.Builder

Register a PathHandler for a specific path.

WebViewAssetLoader

Build and return a WebViewAssetLoader object.

WebViewAssetLoader.Builder
setDomain(domain: String)

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

Builder

Added in 1.1.0
Builder()

Public functions

addPathHandler

Added in 1.1.0
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-null.

Parameters
path: String

the prefix path where this handler should be register.

handler: WebViewAssetLoader.PathHandler

PathHandler that handles requests for this path.

Throws
java.lang.IllegalArgumentException

if the path is invalid.

build

Added in 1.1.0
fun build(): WebViewAssetLoader

Build and return a WebViewAssetLoader object.

Returns
WebViewAssetLoader

immutable WebViewAssetLoader object.

setDomain

Added in 1.1.0
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.

setHttpAllowed

Added in 1.1.0
fun setHttpAllowed(httpAllowed: Boolean): WebViewAssetLoader.Builder

Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.