EmbeddingConfiguration.Builder
public final class EmbeddingConfiguration.Builder
Builder for creating an instance of EmbeddingConfiguration.
Summary
Public constructors |
|---|
Builder() |
Public methods |
|
|---|---|
final @NonNull EmbeddingConfiguration |
build()Builds a |
final @NonNull EmbeddingConfiguration.Builder |
@RequiresWindowSdkExtension(version = 8)Sets whether to auto save the embedding state to the system, which can be used to restore the app embedding state once the app process is restarted (if applicable). |
final @NonNull EmbeddingConfiguration.Builder |
@RequiresWindowSdkExtension(version = 5)Sets the dim area behavior. |
Public methods
build
public final @NonNull EmbeddingConfiguration build()
Builds aEmbeddingConfiguration instance.
| Returns | |
|---|---|
@NonNull EmbeddingConfiguration |
The new |
setAutoSaveEmbeddingState
@RequiresWindowSdkExtension(version = 8)
public final @NonNull EmbeddingConfiguration.Builder setAutoSaveEmbeddingState(boolean saveState)
Sets whether to auto save the embedding state to the system, which can be used to restore the app embedding state once the app process is restarted (if applicable).
The embedding state is not saved by default, in which case the embedding state and the embedded activities are removed once the app process is killed.
Note that the applications should set the EmbeddingRules using RuleController.setRules when the application is initializing, such as configured in androidx.startup.Initializer or in android.app.Application.onCreate, in order to allow the library to restore the state properly. Otherwise, the state may not be restored and the activities may not be started and layout as expected.
This can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op on a target device that has lower API level.
| Parameters | |
|---|---|
boolean saveState |
whether to save the embedding state |
setDimAreaBehavior
@RequiresWindowSdkExtension(version = 5)
public final @NonNull EmbeddingConfiguration.Builder setDimAreaBehavior(@NonNull EmbeddingConfiguration.DimAreaBehavior area)
Sets the dim area behavior. By default, the DimAreaBehavior.UNDEFINED is used if not set.
This can be supported only if the Window Extensions version of the target device is equals or higher than required API level. Otherwise, it would be no-op on a target device that has lower API level.
| Parameters | |
|---|---|
@NonNull EmbeddingConfiguration.DimAreaBehavior area |
The dim area. |
| Returns | |
|---|---|
@NonNull EmbeddingConfiguration.Builder |
This |