androidx.compose.material3.adaptive

Classes

HingeInfo

A class that contains the info of a hinge relevant to a Posture.

Cmn
Posture

Posture info that can help make layout adaptation decisions.

Cmn
WindowAdaptiveInfo

This class collects window info that affects adaptation decisions.

Cmn

Annotations

Top-level functions summary

Posture

Calculates the Posture for a given list of FoldingFeatures.

android
State<List<FoldingFeature>>

Collects the current window folding features from WindowInfoTracker in to a State.

android
WindowAdaptiveInfo

Calculates and returns WindowAdaptiveInfo of the provided context.

Cmn
android
DpSize

Returns and automatically update the current window size in DpSize.

android
IntSize

Returns and automatically update the current window size from WindowMetricsCalculator.

android

Extension properties summary

List<Rect>

Returns the list of all horizontal hinge bounds.

Cmn
List<Rect>

Returns the list of all vertical hinge bounds.

Cmn
List<Rect>

Returns the list of horizontal hinge bounds that are occluding.

Cmn
List<Rect>

Returns the list of vertical hinge bounds that are occluding.

Cmn
List<Rect>

Returns the list of horizontal hinge bounds that are separating.

Cmn
List<Rect>

Returns the list of vertical hinge bounds that are separating.

Cmn

Top-level functions

calculatePosture

@ExperimentalMaterial3AdaptiveApi
fun calculatePosture(foldingFeatures: List<FoldingFeature>): Posture

Calculates the Posture for a given list of FoldingFeatures. This methods converts framework folding info into the Material-opinionated posture info.

collectFoldingFeaturesAsState

@Composable
fun collectFoldingFeaturesAsState(): State<List<FoldingFeature>>

Collects the current window folding features from WindowInfoTracker in to a State.

Returns
State<List<FoldingFeature>>

a State of a FoldingFeature list.

currentWindowAdaptiveInfo

@Composable
fun currentWindowAdaptiveInfo(): WindowAdaptiveInfo

Calculates and returns WindowAdaptiveInfo of the provided context. It's a convenient function that uses the default WindowSizeClass constructor and the default Posture calculation functions to retrieve WindowSizeClass and Posture.

Returns
WindowAdaptiveInfo

WindowAdaptiveInfo of the provided context

currentWindowDpSize

@ExperimentalMaterial3AdaptiveApi
@Composable
fun currentWindowDpSize(): DpSize

Returns and automatically update the current window size in DpSize.

Returns
DpSize

an DpSize that represents the current window size.

currentWindowSize

@Composable
fun currentWindowSize(): IntSize

Returns and automatically update the current window size from WindowMetricsCalculator.

Returns
IntSize

an IntSize that represents the current window size.

Extension properties

allHorizontalHingeBounds

val Posture.allHorizontalHingeBoundsList<Rect>

Returns the list of all horizontal hinge bounds.

allVerticalHingeBounds

val Posture.allVerticalHingeBoundsList<Rect>

Returns the list of all vertical hinge bounds.

occludingHorizontalHingeBounds

val Posture.occludingHorizontalHingeBoundsList<Rect>

Returns the list of horizontal hinge bounds that are occluding.

occludingVerticalHingeBounds

val Posture.occludingVerticalHingeBoundsList<Rect>

Returns the list of vertical hinge bounds that are occluding.

separatingHorizontalHingeBounds

val Posture.separatingHorizontalHingeBoundsList<Rect>

Returns the list of horizontal hinge bounds that are separating.

separatingVerticalHingeBounds

val Posture.separatingVerticalHingeBoundsList<Rect>

Returns the list of vertical hinge bounds that are separating.