SplitPlaceholderRule.Builder


class SplitPlaceholderRule.Builder


Builder for SplitPlaceholderRule.

Summary

Public constructors

Builder(filters: Set<ActivityFilter>, placeholderIntent: Intent)

Public functions

SplitPlaceholderRule

Builds a SplitPlaceholderRule instance.

SplitPlaceholderRule.Builder
setDefaultSplitAttributes(defaultSplitAttributes: SplitAttributes)

Sets the default SplitAttributes to apply on the activity containers pair when the host task bounds satisfy minWidthDp, minHeightDp, minSmallestWidthDp, maxAspectRatioInPortrait and maxAspectRatioInLandscape requirements.

SplitPlaceholderRule.Builder
setFinishPrimaryWithPlaceholder(
    finishPrimaryWithPlaceholder: SplitRule.FinishBehavior
)

Sets the behavior of the primary container when all activities are finished in the associated placeholder container.

SplitPlaceholderRule.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.

SplitPlaceholderRule.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.

SplitPlaceholderRule.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.

SplitPlaceholderRule.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.

SplitPlaceholderRule.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.

SplitPlaceholderRule.Builder
setSticky(isSticky: Boolean)

Sets whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width.

SplitPlaceholderRule.Builder
setTag(tag: String?)

Sets a unique string to identify this SplitPlaceholderRule, which defaults to null.

Public constructors

Builder

Added in 1.1.0
Builder(filters: Set<ActivityFilter>, placeholderIntent: Intent)
Parameters
filters: Set<ActivityFilter>

Filters used to choose when to apply this rule. The rule may be used if any one of the provided filters matches.

placeholderIntent: Intent

Intent to launch the placeholder activity.

Public functions

build

Added in 1.1.0
fun build(): SplitPlaceholderRule

Builds a SplitPlaceholderRule instance.

Returns
SplitPlaceholderRule

The new SplitPlaceholderRule instance.

setDefaultSplitAttributes

Added in 1.1.0
fun setDefaultSplitAttributes(defaultSplitAttributes: SplitAttributes): SplitPlaceholderRule.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 SplitAttributes to apply on the activity containers pair when the host task bounds satisfy all the rule requirements.

setFinishPrimaryWithPlaceholder

Added in 1.1.0
fun setFinishPrimaryWithPlaceholder(
    finishPrimaryWithPlaceholder: SplitRule.FinishBehavior
): SplitPlaceholderRule.Builder

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
finishPrimaryWithPlaceholder: SplitRule.FinishBehavior

the SplitRule.FinishBehavior of the primary container when all activities are finished in the associated placeholder container.

See also
ALWAYS
ADJACENT

setMaxAspectRatioInLandscape

Added in 1.1.0
fun setMaxAspectRatioInLandscape(aspectRatio: EmbeddingAspectRatio): SplitPlaceholderRule.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 width / height in decimal form, of the parent window bounds in landscape when the split should be used.

setMaxAspectRatioInPortrait

Added in 1.1.0
fun setMaxAspectRatioInPortrait(aspectRatio: EmbeddingAspectRatio): SplitPlaceholderRule.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 height / width in decimal form, of the parent window bounds in portrait when the split should be used.

setMinHeightDp

Added in 1.1.0
fun setMinHeightDp(minHeightDp: @IntRange(from = 0) Int): SplitPlaceholderRule.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 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
minHeightDp: @IntRange(from = 0) Int

the smallest value of height of the parent task window when the split should be used, in DP.

setMinSmallestWidthDp

Added in 1.1.0
fun setMinSmallestWidthDp(minSmallestWidthDp: @IntRange(from = 0) Int): SplitPlaceholderRule.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.

Parameters
minSmallestWidthDp: @IntRange(from = 0) Int

the smallest value of the smallest possible width of the parent window in any rotation when the split should be used, in DP.

setMinWidthDp

Added in 1.1.0
fun setMinWidthDp(minWidthDp: @IntRange(from = 0) Int): SplitPlaceholderRule.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.

Parameters
minWidthDp: @IntRange(from = 0) Int

the smallest value of width of the parent window when the split should be used, in DP.

setSticky

Added in 1.1.0
fun setSticky(isSticky: Boolean): SplitPlaceholderRule.Builder

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
isSticky: Boolean

whether the placeholder will show on top in a smaller window size after it first appeared in a split with sufficient minimum width.

setTag

Added in 1.1.0
fun setTag(tag: String?): SplitPlaceholderRule.Builder

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
tag: String?

unique string to identify this SplitPlaceholderRule.