class WidthSizeClass


A class to create buckets for the width of a window.

For details on window size classes, see https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes.

Summary

Public companion 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 companion 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

open operator Boolean
equals(other: Any?)
open Int
open String

Public companion 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 companion 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.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String