Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 2.46 KB

adaptive.md

File metadata and controls

45 lines (29 loc) · 2.46 KB

Adaptive utilities for Jetpack Compose

Maven Central

A library providing a collection of utilities for adaptive layouts.

calculateDisplayFeatures

calculateDisplayFeatures(activity) returns the current list of DisplayFeatures, as reported by the Jetpack WindowManager library.

These contain the list of folds (if any), and can be used to drive components like TwoPane.

TwoPane

TwoPane is a UI component that positions exactly two slots on the screen.

The default positioning of these two slots is driven by a TwoPaneStrategy, which can decide to orient the two slots side-by-side horizontally or vertically, and also configure the gap between them.

The built-in HorizontalTwoPaneStrategy and VerticalTwoPaneStrategy allow positioning the slots based on a fixed offset, or as some fraction of the space.

TwoPane also requires a list of display features (to be retrieved with calculateDisplayFeatures), and optionally a FoldAwareConfiguration to determine which folds to handle automatically.

When there is a fold that intersects with the TwoPane component that is obscuring or separating, the TwoPane will automatically place the slots to avoid the fold.

When there is no fold, the default supplied strategy will be used instead.

Download

Maven Central

repositories {
    mavenCentral()
}

dependencies {
    implementation "com.google.accompanist:accompanist-adaptive:<version>"
}