TestSplitAttributesCalculatorParams

Added in 1.2.0

public final class TestSplitAttributesCalculatorParams


Summary

Public methods

static final @NonNull SplitAttributesCalculatorParams
createTestSplitAttributesCalculatorParams(
    @NonNull WindowMetrics parentWindowMetrics,
    @NonNull Configuration parentConfiguration,
    @NonNull WindowLayoutInfo parentWindowLayoutInfo,
    @NonNull SplitAttributes defaultSplitAttributes,
    boolean areDefaultConstraintsSatisfied,
    String splitRuleTag
)

Returns an instance of SplitAttributesCalculatorParams for testing.

Public methods

createTestSplitAttributesCalculatorParams

public static final @NonNull SplitAttributesCalculatorParams createTestSplitAttributesCalculatorParams(
    @NonNull WindowMetrics parentWindowMetrics,
    @NonNull Configuration parentConfiguration,
    @NonNull WindowLayoutInfo parentWindowLayoutInfo,
    @NonNull SplitAttributes defaultSplitAttributes,
    boolean areDefaultConstraintsSatisfied,
    String splitRuleTag
)

Returns an instance of SplitAttributesCalculatorParams for testing. It is used to verify the developer implemented callback set by SplitController.setSplitAttributesCalculator by setting the relevant values in SplitAttributesCalculatorParams with this method.

Parameters
@NonNull WindowMetrics parentWindowMetrics

The WindowMetrics of the host task. See SplitAttributesCalculatorParams.parentWindowMetrics.

@NonNull Configuration parentConfiguration

The Configuration of the host task with empty Configuration as the default value. See SplitAttributesCalculatorParams.parentConfiguration

@NonNull WindowLayoutInfo parentWindowLayoutInfo

Used for reporting the androidx.window.layout.FoldingFeature with empty WindowLayoutInfo as the default value. See androidx.window.testing.layout.TestWindowLayoutInfo and androidx.window.testing.layout.FoldingFeature for how to create test WindowLayoutInfo with androidx.window.layout.FoldingFeature.

@NonNull SplitAttributes defaultSplitAttributes

The SplitPairRule.defaultSplitAttributes or the SplitPlaceholderRule.defaultSplitAttributes that the callback is applied a vertical equal SplitAttributes as the default value. See SplitAttributesCalculatorParams.defaultSplitAttributes

boolean areDefaultConstraintsSatisfied

true to indicate that the parentWindowMetrics satisfies the constraints of SplitPairRule or SplitPlaceholderRule which defaults to true. See SplitAttributesCalculatorParams.areDefaultConstraintsSatisfied

String splitRuleTag

The SplitPairRule.tag or the SplitPlaceholderRule.tag that the callback is applied with null as the default value. See SplitAttributesCalculatorParams.splitRuleTag.