androidx.window.core.layout


Classes

WindowHeightSizeClass

This class is deprecated. WindowHeightSizeClass will not be developed further, use WindowSizeClass instead.

Cmn
WindowSizeClass

WindowSizeClass represents breakpoints for a viewport.

Cmn
WindowWidthSizeClass

This class is deprecated. WindowWidthSizeClass will not be developed further, use WindowSizeClass instead.

Cmn

Extension functions summary

WindowSizeClass
Set<WindowSizeClass>.computeWindowSizeClass(
    widthDp: Float,
    heightDp: Float
)

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp).

Cmn
WindowSizeClass

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp).

Cmn
WindowSizeClass
Set<WindowSizeClass>.computeWindowSizeClassPreferHeight(
    widthDp: Int,
    heightDp: Int
)

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp).

Cmn

Extension functions

computeWindowSizeClass

fun Set<WindowSizeClass>.computeWindowSizeClass(
    widthDp: Float,
    heightDp: Float
): WindowSizeClass

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp). This method prefers width and uses max height to break ties. If there is no match a default of WindowSizeClass(0,0) is returned. Examples: Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(300, 600) widthDp: 300.5f heightDp: 800.5f Output: WindowSizeClass(300, 600) Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(300, 600) widthDp: 300 heightDp: 400 Output: WindowSizeClass(300, 300). This is an overload that truncates the floats to integers.

Parameters
widthDp: Float

the width of the window to match a WindowSizeClass to.

heightDp: Float

the height of the window to match a WindowSizeClass to.

computeWindowSizeClass

fun Set<WindowSizeClass>.computeWindowSizeClass(widthDp: Int, heightDp: Int): WindowSizeClass

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp). This method prefers width and uses max height to break ties. If there is no match a default of WindowSizeClass(0,0) is returned. Examples: Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(300, 600) widthDp: 300 heightDp: 800 Output: WindowSizeClass(300, 600) Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(300, 600) widthDp: 300 heightDp: 400 Output: WindowSizeClass(300, 300)

Parameters
widthDp: Int

the width of the window to match a WindowSizeClass to.

heightDp: Int

the height of the window to match a WindowSizeClass to.

computeWindowSizeClassPreferHeight

fun Set<WindowSizeClass>.computeWindowSizeClassPreferHeight(
    widthDp: Int,
    heightDp: Int
): WindowSizeClass

Returns the largest WindowSizeClass that is within the bounds of (widthDp, heightDp). This method prefers height and uses max width to break ties. If there is no match a default of WindowSizeClass(0,0) is returned. Examples: Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(600, 300) widthDp: 800 heightDp: 300 Output: WindowSizeClass(600, 300) Input: Set: setOf(WindowSizeClass(300, 300), WindowSizeClass(600, 300) widthDp: 400 heightDp: 300 Output: WindowSizeClass(300, 300)

Parameters
widthDp: Int

the width of the window to match a WindowSizeClass to.

heightDp: Int

the height of the window to match a WindowSizeClass to.