WindowSizeClassGridCreator

Added in 1.6.0-alpha01

public final class WindowSizeClassGridCreator


Summary

Public methods

static final @NonNull Set<@NonNull WindowSizeClass>
addHeightDpBreakpoints(
    @NonNull Set<@NonNull WindowSizeClass> receiver,
    @NonNull Set<@NonNull Integer> minHeightDpBreakPoints
)

Creates a new Set that contains the original WindowSizeClass values in addition to new elements where the width is from the original set and the height is from minHeightDpBreakPoints.

static final @NonNull Set<@NonNull WindowSizeClass>
createGridWindowSizeClassSet(
    @NonNull Set<@NonNull Integer> minWidthDpBreakPoints,
    @NonNull Set<@NonNull Integer> minHeightDpBreakPoints
)

Creates a new set of breakpoints by taking the cross product of minWidthDpBreakPoints and minHeightDpBreakPoints.

Public methods

addHeightDpBreakpoints

public static final @NonNull Set<@NonNull WindowSizeClassaddHeightDpBreakpoints(
    @NonNull Set<@NonNull WindowSizeClass> receiver,
    @NonNull Set<@NonNull Integer> minHeightDpBreakPoints
)

Creates a new Set that contains the original WindowSizeClass values in addition to new elements where the width is from the original set and the height is from minHeightDpBreakPoints. Note this method does not fill in any gaps in the original set. For example if the original set was { (10, 10), (20, 20) } and the height set is { 30 } the new set will be { (10, 10), (20, 20), (10, 30), (20, 30) }. To maintain a grid set the source set must also be a grid set.

Parameters
@NonNull Set<@NonNull Integer> minHeightDpBreakPoints

the height breakpoints in DP to construct the WindowSizeClass.

Returns
@NonNull Set<@NonNull WindowSizeClass>

a new Set that contains (minWidthDp, minHeightDp) for each pair possible taking the * height breakpoint from minHeightDpBreakPoints and the width breakpoint from this.

createGridWindowSizeClassSet

public static final @NonNull Set<@NonNull WindowSizeClasscreateGridWindowSizeClassSet(
    @NonNull Set<@NonNull Integer> minWidthDpBreakPoints,
    @NonNull Set<@NonNull Integer> minHeightDpBreakPoints
)

Creates a new set of breakpoints by taking the cross product of minWidthDpBreakPoints and minHeightDpBreakPoints. For example, if the width set is {10, 20} and the height set is { 100, 200 } then the resulting set will be { (10, 100), (10, 200), (20, 100), (20, 200) }.

Parameters
@NonNull Set<@NonNull Integer> minWidthDpBreakPoints

the width breakpoints in DP to construct the WindowSizeClass

@NonNull Set<@NonNull Integer> minHeightDpBreakPoints

the height breakpoints in DP to construct the WindowSizeClass.

Returns
@NonNull Set<@NonNull WindowSizeClass>

a Set containing the breakpoints using a grid style