WebViewAssetLoader.Builder
public final class WebViewAssetLoader.Builder
A builder class for constructing WebViewAssetLoader objects.
Summary
Public constructors |
|---|
Builder() |
Public methods |
|
|---|---|
@NonNull WebViewAssetLoader.Builder |
addPathHandler(Register a |
@NonNull WebViewAssetLoader |
build()Build and return a |
@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
Public methods
addPathHandler
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-nullWebResourceResponse.
| Parameters | |
|---|---|
@NonNull String path |
the prefix path where this handler should be register. |
@NonNull WebViewAssetLoader.PathHandler handler |
|
| Returns | |
|---|---|
@NonNull WebViewAssetLoader.Builder |
|
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the path is invalid. |
build
public @NonNull WebViewAssetLoader build()
Build and return a WebViewAssetLoader object.
| Returns | |
|---|---|
@NonNull WebViewAssetLoader |
immutable |
setDomain
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"
| Returns | |
|---|---|
@NonNull WebViewAssetLoader.Builder |
|
setHttpAllowed
public @NonNull WebViewAssetLoader.Builder setHttpAllowed(boolean httpAllowed)
Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
| Returns | |
|---|---|
@NonNull WebViewAssetLoader.Builder |
|