WebViewAssetLoader.Builder


public final class WebViewAssetLoader.Builder


A builder class for constructing WebViewAssetLoader objects.

Summary

Public constructors

Public methods

@NonNull WebViewAssetLoader.Builder

Register a PathHandler for a specific path.

@NonNull WebViewAssetLoader

Build and return a WebViewAssetLoader object.

@NonNull WebViewAssetLoader.Builder

Set the domain under which app assets can be accessed.

@NonNull WebViewAssetLoader.Builder
setHttpAllowed(boolean httpAllowed)

Allow using the HTTP scheme in addition to HTTPS.

Public constructors

Builder

Added in 1.1.0
public Builder()

Public methods

addPathHandler

Added in 1.1.0
public @NonNull WebViewAssetLoader.Builder addPathHandler(
    @NonNull String path,
    @NonNull WebViewAssetLoader.PathHandler handler
)

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
@NonNull String path

the prefix path where this handler should be register.

@NonNull WebViewAssetLoader.PathHandler handler

PathHandler that handles requests for this path.

Throws
java.lang.IllegalArgumentException

if the path is invalid.

build

Added in 1.1.0
public @NonNull WebViewAssetLoader build()

Build and return a WebViewAssetLoader object.

Returns
@NonNull WebViewAssetLoader

immutable WebViewAssetLoader object.

setDomain

Added in 1.1.0
public @NonNull WebViewAssetLoader.Builder setDomain(@NonNull String domain)

Set the domain under which app assets can be accessed. The default domain is "appassets.androidplatform.net"

Parameters
@NonNull String domain

the domain on which app assets should be hosted.

setHttpAllowed

Added in 1.1.0
public @NonNull WebViewAssetLoader.Builder setHttpAllowed(boolean httpAllowed)

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