WindowSizeClassSelectorsKt


public final class WindowSizeClassSelectorsKt


Summary

Public methods

static final WindowSizeClass
widestOrEqualWidthDp(
    @NonNull Set<@NonNull WindowSizeClass> receiver,
    int windowWidthDp,
    int windowHeightDp
)

Calculates which WindowSizeClass has the closest matching windowWidthDp within the given value.

Public methods

widestOrEqualWidthDp

public static final WindowSizeClass widestOrEqualWidthDp(
    @NonNull Set<@NonNull WindowSizeClass> receiver,
    int windowWidthDp,
    int windowHeightDp
)

Calculates which WindowSizeClass has the closest matching windowWidthDp within the given value. If there are multiple matches then the tallest WindowSizeClass is selected within the given value.

Parameters
int windowWidthDp

the width of the current window in DP to choose a WindowSizeClass.

int windowHeightDp

the height of the current window in DP to chose a WindowSizeClass.

Returns
WindowSizeClass

a WindowSizeClass that has WindowSizeClass.widthDp less than or equal to the windowWidthDp and is the closest to windowWidthDp if possible null otherwise.