public final class HeightSizeClass


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

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

Summary

Nested types

public static class HeightSizeClass.Companion

Public fields

static final @NonNull HeightSizeClass

A bucket to represent a compact height.

static final @NonNull HeightSizeClass

A bucket to represent an expanded height window.

static final @NonNull HeightSizeClass

A bucket to represent a medium height.

Public methods

static final @NonNull HeightSizeClass
compute(int dpHeight)

Returns a recommended HeightSizeClass for the height of a window given the height in DP.

boolean
equals(Object other)
static final @NonNull HeightSizeClass.Companion.HeightSizeClassEnum

Returns a HeightSizeClassEnum given the HeightSizeClass.

static final int

Returns a recommended height of a window in DP given the HeightSizeClass.

int
@NonNull String

Public fields

COMPACT

public static final @NonNull HeightSizeClass COMPACT

A bucket to represent a compact height. One use-case is a phone that is in landscape.

EXPANDED

public static final @NonNull HeightSizeClass EXPANDED

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

MEDIUM

public static final @NonNull HeightSizeClass MEDIUM

A bucket to represent a medium height. One use-case is a phone in portrait or a tablet.

Public methods

compute

public static final @NonNull HeightSizeClass compute(int dpHeight)

Returns a recommended HeightSizeClass for the height of a window given the height in DP.

Parameters
int dpHeight

the height of the window in DP

Returns
@NonNull HeightSizeClass

A recommended size class for the height

Throws
kotlin.IllegalArgumentException

if the height is negative

equals

public boolean equals(Object other)

getEnum

public static final @NonNull HeightSizeClass.Companion.HeightSizeClassEnum getEnum(@NonNull HeightSizeClass sizeClass)

Returns a HeightSizeClassEnum given the HeightSizeClass.

Parameters
@NonNull HeightSizeClass sizeClass

the size class

Returns
@NonNull HeightSizeClass.Companion.HeightSizeClassEnum

the relevant HeightSizeClassEnum

getHeightDpInSizeClass

public static final int getHeightDpInSizeClass(@NonNull HeightSizeClass sizeClass)

Returns a recommended height of a window in DP given the HeightSizeClass.

Parameters
@NonNull HeightSizeClass sizeClass

the size class

Returns
int

A recommended height in DP in this size class

hashCode

public int hashCode()

toString

public @NonNull String toString()