SplitPlaceholderRule.Builder
public final class SplitPlaceholderRule.Builder
Builder for SplitPlaceholderRule
.
Summary
Public constructors |
---|
Public methods |
|
---|---|
final @NonNull SplitPlaceholderRule |
build() Builds a |
final @NonNull SplitPlaceholderRule.Builder |
setDefaultSplitAttributes( Sets the default |
final @NonNull SplitPlaceholderRule.Builder |
setFinishPrimaryWithPlaceholder( Sets the behavior of the primary container when all activities are finished in the associated placeholder container. |
final @NonNull SplitPlaceholderRule.Builder |
setMaxAspectRatioInLandscape(@NonNull EmbeddingAspectRatio aspectRatio) Sets the largest value of the aspect ratio, expressed as |
final @NonNull SplitPlaceholderRule.Builder |
setMaxAspectRatioInPortrait(@NonNull EmbeddingAspectRatio aspectRatio) Sets the largest value of the aspect ratio, expressed as |
final @NonNull SplitPlaceholderRule.Builder |
setMinHeightDp(@IntRange(from = 0) int minHeightDp) Sets the smallest value of height of the parent task window when the split should be used, in DP. |
final @NonNull SplitPlaceholderRule.Builder |
setMinSmallestWidthDp(@IntRange(from = 0) int minSmallestWidthDp) Sets the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. |
final @NonNull SplitPlaceholderRule.Builder |
setMinWidthDp(@IntRange(from = 0) int minWidthDp) Sets the smallest value of width of the parent window when the split should be used, in DP. |
final @NonNull SplitPlaceholderRule.Builder |
setSticky(boolean isSticky) Sets whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width. |
final @NonNull SplitPlaceholderRule.Builder |
Sets a unique string to identify this |
Public constructors
Public methods
build
public final @NonNull SplitPlaceholderRule build()
Builds a SplitPlaceholderRule
instance.
Returns | |
---|---|
@NonNull SplitPlaceholderRule |
The new |
setDefaultSplitAttributes
public final @NonNull SplitPlaceholderRule.Builder setDefaultSplitAttributes(
@NonNull SplitAttributes defaultSplitAttributes
)
Sets the default SplitAttributes
to apply on the activity containers pair when the host task bounds satisfy minWidthDp
, minHeightDp
, minSmallestWidthDp
, maxAspectRatioInPortrait
and maxAspectRatioInLandscape
requirements.
Parameters | |
---|---|
@NonNull SplitAttributes defaultSplitAttributes |
the default |
setFinishPrimaryWithPlaceholder
public final @NonNull SplitPlaceholderRule.Builder setFinishPrimaryWithPlaceholder(
@NonNull SplitRule.FinishBehavior finishPrimaryWithPlaceholder
)
Sets the behavior of the primary container when all activities are finished in the associated placeholder container.
Note that it is not valid to set SplitRule.FinishBehavior.NEVER
Parameters | |
---|---|
@NonNull SplitRule.FinishBehavior finishPrimaryWithPlaceholder |
the |
setMaxAspectRatioInLandscape
public final @NonNull SplitPlaceholderRule.Builder setMaxAspectRatioInLandscape(@NonNull EmbeddingAspectRatio aspectRatio)
Sets the largest value of the aspect ratio, expressed as width / height
in decimal form, of the parent window bounds in landscape when the split should be used. When the window aspect ratio is greater than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.
This value is only used when the parent window is in landscape (width height).
The default is SPLIT_MAX_ASPECT_RATIO_LANDSCAPE_DEFAULT
if the app doesn't set, which is the recommend value to always allow split when the parent window is in landscape.
Parameters | |
---|---|
@NonNull EmbeddingAspectRatio aspectRatio |
the largest value of the aspect ratio, expressed as |
See also | |
---|---|
ratio |
|
ALWAYS_ALLOW |
|
ALWAYS_DISALLOW |
setMaxAspectRatioInPortrait
public final @NonNull SplitPlaceholderRule.Builder setMaxAspectRatioInPortrait(@NonNull EmbeddingAspectRatio aspectRatio)
Sets the largest value of the aspect ratio, expressed as height / width
in decimal form, of the parent window bounds in portrait when the split should be used. When the window aspect ratio is greater than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.
This value is only used when the parent window is in portrait (height >= width).
The default is SPLIT_MAX_ASPECT_RATIO_PORTRAIT_DEFAULT
if the app doesn't set, which is the recommend value to only allow split when the parent window is not too stretched in portrait.
Parameters | |
---|---|
@NonNull EmbeddingAspectRatio aspectRatio |
the largest value of the aspect ratio, expressed as |
See also | |
---|---|
ratio |
|
ALWAYS_ALLOW |
|
ALWAYS_DISALLOW |
setMinHeightDp
public final @NonNull SplitPlaceholderRule.Builder setMinHeightDp(@IntRange(from = 0) int minHeightDp)
Sets the smallest value of height of the parent task window when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.
It is useful if it's necessary to split the parent window horizontally for this SplitPlaceholderRule
.
The default is SPLIT_MIN_DIMENSION_DP_DEFAULT
if the app doesn't set. SPLIT_MIN_DIMENSION_ALWAYS_ALLOW
means to always allow split.
Parameters | |
---|---|
@IntRange(from = 0) int minHeightDp |
the smallest value of height of the parent task window when the split should be used, in DP. |
See also | |
---|---|
TOP_TO_BOTTOM |
|
BOTTOM_TO_TOP |
setMinSmallestWidthDp
public final @NonNull SplitPlaceholderRule.Builder setMinSmallestWidthDp(@IntRange(from = 0) int minSmallestWidthDp)
Sets the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.
The default is SPLIT_MIN_DIMENSION_DP_DEFAULT
if the app doesn't set. SPLIT_MIN_DIMENSION_ALWAYS_ALLOW
means to always allow split.
Parameters | |
---|---|
@IntRange(from = 0) int minSmallestWidthDp |
the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. |
setMinWidthDp
public final @NonNull SplitPlaceholderRule.Builder setMinWidthDp(@IntRange(from = 0) int minWidthDp)
Sets the smallest value of width of the parent window when the split should be used, in DP. When the window size is smaller than requested here, activities in the secondary container will be stacked on top of the activities in the primary one, completely overlapping them.
The default is SPLIT_MIN_DIMENSION_DP_DEFAULT
if the app doesn't set. SPLIT_MIN_DIMENSION_ALWAYS_ALLOW
means to always allow split.
Parameters | |
---|---|
@IntRange(from = 0) int minWidthDp |
the smallest value of width of the parent window when the split should be used, in DP. |
setSticky
public final @NonNull SplitPlaceholderRule.Builder setSticky(boolean isSticky)
Sets whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width.
Parameters | |
---|---|
boolean isSticky |
whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width. |
setTag
public final @NonNull SplitPlaceholderRule.Builder setTag(String tag)
Sets a unique string to identify this SplitPlaceholderRule
, which defaults to null
. The suggested usage is to set the tag to be able to differentiate between different rules in the SplitAttributesCalculatorParams.splitRuleTag
.
Parameters | |
---|---|
String tag |
unique string to identify this |