SplitPairRule.Builder
class SplitPairRule.Builder
Builder for SplitPairRule.
Summary
Public constructors |
|---|
Builder(filters: Set<SplitPairFilter>) |
Public functions |
|
|---|---|
SplitPairRule |
build()Builds a |
SplitPairRule.Builder |
setClearTop(clearTop: Boolean)Sets whether the existing secondary container on top and all activities in it should be destroyed when a new split is created using this rule. |
SplitPairRule.Builder |
setDefaultSplitAttributes(defaultSplitAttributes: SplitAttributes)Sets the default |
SplitPairRule.Builder |
setFinishPrimaryWithSecondary(Sets the behavior of the primary container when all activities are finished in the associated secondary container. |
SplitPairRule.Builder |
setFinishSecondaryWithPrimary(Sets the behavior of the secondary container when all activities are finished in the associated primary container. |
SplitPairRule.Builder |
setMaxAspectRatioInLandscape(aspectRatio: EmbeddingAspectRatio)Sets the largest value of the aspect ratio, expressed as |
SplitPairRule.Builder |
setMaxAspectRatioInPortrait(aspectRatio: EmbeddingAspectRatio)Sets the largest value of the aspect ratio, expressed as |
SplitPairRule.Builder |
setMinHeightDp(minHeightDp: @IntRange(from = 0) Int)Sets the smallest value of height of the parent task window when the split should be used, in DP. |
SplitPairRule.Builder |
setMinSmallestWidthDp(minSmallestWidthDp: @IntRange(from = 0) Int)Sets the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP. |
SplitPairRule.Builder |
setMinWidthDp(minWidthDp: @IntRange(from = 0) Int)Sets the smallest value of width of the parent window when the split should be used, in DP. |
SplitPairRule.Builder |
Sets a unique string to identify this |
Public constructors
Builder
Builder(filters: Set<SplitPairFilter>)
| Parameters | |
|---|---|
filters: Set<SplitPairFilter> |
Filters used to choose when to apply this rule. The rule may be used if any one of the provided filters matches. |
Public functions
build
fun build(): SplitPairRule
Builds a SplitPairRule instance.
| Returns | |
|---|---|
SplitPairRule |
The new |
setClearTop
fun setClearTop(clearTop: Boolean): SplitPairRule.Builder
Sets whether the existing secondary container on top and all activities in it should be destroyed when a new split is created using this rule. Otherwise the new secondary will appear on top by default.
| Parameters | |
|---|---|
clearTop: Boolean |
whether the existing secondary container on top and all activities in it should be destroyed when a new split is created using this rule. |
setDefaultSplitAttributes
fun setDefaultSplitAttributes(defaultSplitAttributes: SplitAttributes): SplitPairRule.Builder
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 | |
|---|---|
defaultSplitAttributes: SplitAttributes |
the default |
setFinishPrimaryWithSecondary
fun setFinishPrimaryWithSecondary(
finishPrimaryWithSecondary: SplitRule.FinishBehavior
): SplitPairRule.Builder
Sets the behavior of the primary container when all activities are finished in the associated secondary container.
| Parameters | |
|---|---|
finishPrimaryWithSecondary: SplitRule.FinishBehavior |
the |
setFinishSecondaryWithPrimary
fun setFinishSecondaryWithPrimary(
finishSecondaryWithPrimary: SplitRule.FinishBehavior
): SplitPairRule.Builder
Sets the behavior of the secondary container when all activities are finished in the associated primary container.
| Parameters | |
|---|---|
finishSecondaryWithPrimary: SplitRule.FinishBehavior |
the |
setMaxAspectRatioInLandscape
fun setMaxAspectRatioInLandscape(aspectRatio: EmbeddingAspectRatio): SplitPairRule.Builder
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 | |
|---|---|
aspectRatio: EmbeddingAspectRatio |
the largest value of the aspect ratio, expressed as |
| See also | |
|---|---|
ratio |
|
ALWAYS_ALLOW |
|
ALWAYS_DISALLOW |
setMaxAspectRatioInPortrait
fun setMaxAspectRatioInPortrait(aspectRatio: EmbeddingAspectRatio): SplitPairRule.Builder
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 | |
|---|---|
aspectRatio: EmbeddingAspectRatio |
the largest value of the aspect ratio, expressed as |
| See also | |
|---|---|
ratio |
|
ALWAYS_ALLOW |
|
ALWAYS_DISALLOW |
setMinHeightDp
fun setMinHeightDp(minHeightDp: @IntRange(from = 0) Int): SplitPairRule.Builder
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 SplitPairRule.
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 | |
|---|---|
minHeightDp: @IntRange(from = 0) Int |
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
fun setMinSmallestWidthDp(minSmallestWidthDp: @IntRange(from = 0) Int): SplitPairRule.Builder
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.
setMinWidthDp
fun setMinWidthDp(minWidthDp: @IntRange(from = 0) Int): SplitPairRule.Builder
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.
setTag
fun setTag(tag: String?): SplitPairRule.Builder
Sets a unique string to identify this SplitPairRule, 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 | |
|---|---|
tag: String? |
unique string to identify this |