WidthSizeClass.Companion


object WidthSizeClass.Companion


Summary

Public functions

WidthSizeClass
compute(dpWidth: Int)

Returns a recommended WidthSizeClass for the width of a window given the width in DP.

WidthSizeClass.Companion.WidthSizeClassEnum
getEnum(sizeClass: WidthSizeClass)

Returns a WidthSizeClassEnum given the WidthSizeClass.

Int

Returns a recommended width of a window in DP given the WidthSizeClass.

Public properties

WidthSizeClass

A bucket to represent a compact width window.

WidthSizeClass

A bucket to represent an expanded width window.

WidthSizeClass

A bucket to represent a medium width window.

Public functions

compute

fun compute(dpWidth: Int): WidthSizeClass

Returns a recommended WidthSizeClass for the width of a window given the width in DP.

Parameters
dpWidth: Int

the width of the window in DP

Returns
WidthSizeClass

A recommended size class for the width

Throws
kotlin.IllegalArgumentException

if the width is negative

getEnum

fun getEnum(sizeClass: WidthSizeClass): WidthSizeClass.Companion.WidthSizeClassEnum

Returns a WidthSizeClassEnum given the WidthSizeClass.

Parameters
sizeClass: WidthSizeClass

the size class

Returns
WidthSizeClass.Companion.WidthSizeClassEnum

the relevant WidthSizeClassEnum

getWidthDpInSizeClass

fun getWidthDpInSizeClass(sizeClass: WidthSizeClass): Int

Returns a recommended width of a window in DP given the WidthSizeClass.

Parameters
sizeClass: WidthSizeClass

the size class

Returns
Int

A recommended width in DP in this size class

Public properties

COMPACT

val COMPACTWidthSizeClass

A bucket to represent a compact width window. One use-case is a phone in portrait.

EXPANDED

val EXPANDEDWidthSizeClass

A bucket to represent an expanded width window. One use-case is a desktop app.

MEDIUM

val MEDIUMWidthSizeClass

A bucket to represent a medium width window. Some use-cases are a phone in landscape or a tablet.