SplitAttributes.Builder


public final class SplitAttributes.Builder


Builder for creating an instance of SplitAttributes.

  • The default split type is an equal split between primary and secondary containers.

  • The default layout direction is based on locale.

  • The default animation background color is to use the current theme window background color.

  • The default divider attributes is not to use divider.

Summary

Public constructors

Public methods

final @NonNull SplitAttributes

Builds a SplitAttributes instance with the attributes specified by setSplitType, setLayoutDirection, and setAnimationBackground.

final @NonNull SplitAttributes.Builder

Sets the animation background to use during animation of the split involving this SplitAttributes object if the animation requires a background.

final @NonNull SplitAttributes.Builder

Sets the DividerAttributes.

final @NonNull SplitAttributes.Builder

Sets the split layout direction attribute.

final @NonNull SplitAttributes.Builder

Sets the split type attribute.

Public constructors

Builder

Added in 1.1.0
public Builder()

Public methods

build

Added in 1.1.0
public final @NonNull SplitAttributes build()

Builds a SplitAttributes instance with the attributes specified by setSplitType, setLayoutDirection, and setAnimationBackground.

Returns
@NonNull SplitAttributes

The new SplitAttributes instance.

setAnimationBackground

Added in 1.4.0-alpha01
@RequiresWindowSdkExtension(version = 5)
public final @NonNull SplitAttributes.Builder setAnimationBackground(@NonNull EmbeddingAnimationBackground background)

Sets the animation background to use during animation of the split involving this SplitAttributes object if the animation requires a background.

The default is EmbeddingAnimationBackground.DEFAULT, which means to use the current theme window background color.

The EmbeddingAnimationBackground can be supported only if the vendor API level of the target device is equals or higher than required API level. Otherwise, it would be no-op when setting the EmbeddingAnimationBackground on a target device that has lower API level.

Parameters
@NonNull EmbeddingAnimationBackground background

The animation background.

Returns
@NonNull SplitAttributes.Builder

This Builder.

setDividerAttributes

Added in 1.4.0-alpha01
@RequiresWindowSdkExtension(version = 6)
public final @NonNull SplitAttributes.Builder setDividerAttributes(@NonNull DividerAttributes dividerAttributes)

Sets the DividerAttributes.

setLayoutDirection

Added in 1.1.0
public final @NonNull SplitAttributes.Builder setLayoutDirection(
    @NonNull SplitAttributes.LayoutDirection layoutDirection
)

Sets the split layout direction attribute.

The default is based on locale.

Parameters
@NonNull SplitAttributes.LayoutDirection layoutDirection

The layout direction attribute.

Returns
@NonNull SplitAttributes.Builder

This Builder.

setSplitType

Added in 1.1.0
public final @NonNull SplitAttributes.Builder setSplitType(@NonNull SplitAttributes.SplitType type)

Sets the split type attribute.

The default is an equal split between primary and secondary containers.

Parameters
@NonNull SplitAttributes.SplitType type

The split type attribute.

Returns
@NonNull SplitAttributes.Builder

This Builder.