1# Adaptive utilities for Jetpack Compose 2 3[](https://search.maven.org/search?q=g:com.google.accompanist) 4 5A library providing a collection of utilities for adaptive layouts. 6 7## calculateDisplayFeatures 8 9[`calculateDisplayFeatures(activity)`](../api/adaptive/com.google.accompanist.adaptive/calculate-display-features.html) returns the current list of `DisplayFeature`s, 10as reported by the [Jetpack WindowManager library](https://developer.android.com/jetpack/androidx/releases/window). 11 12These contain the list of folds (if any), and can be used to drive components like [`TwoPane`](#TwoPane). 13 14## TwoPane 15 16[`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) is a UI component that positions exactly two slots on the screen. 17 18The default positioning of these two slots is driven by a [`TwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-two-pane-strategy.html), 19which can decide to orient the two slots side-by-side horizontally or vertically, and also configure the gap between them. 20 21The built-in [`HorizontalTwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-horizontal-two-pane-strategy.html) and 22[`VerticalTwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-vertical-two-pane-strategy.html) allow positioning the 23slots based on a fixed offset, or as some fraction of the space. 24 25[`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) also requires a list of display features (to be retrieved with [`calculateDisplayFeatures`](#calculateDisplayFeatures)), 26and optionally a [`FoldAwareConfiguration`](../api/adaptive/com.google.accompanist.adaptive/-fold-aware-configuration.html) to determine which folds to handle automatically. 27 28When there is a fold that intersects with the [`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) component that is obscuring or separating, 29the [`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) will automatically place the slots to avoid the fold. 30 31When there is no fold, the default supplied strategy will be used instead. 32 33## FoldAwareColumn 34 35[`FoldAwareColumn`](../api/adaptive/com.google.accompanist.adaptive/-fold-aware-column.html) is a simplified version of [Column](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/package-summary#Column(androidx.compose.ui.Modifier,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,kotlin.Function1)) that places children in a fold-aware manner. 36 37[`FoldAwareColumn`](../api/adaptive/com.google.accompanist.adaptive/-fold-aware-column.html) requires a list of display features (to be retrieved with [`calculateDisplayFeatures`](#calculatedisplayfeatures)) to determine which folds to handle automatically. 38 39The built-in `foldPadding` parameter is zero, and the values of the vertical padding are used in the layout determine how much space should be left around a fold when placing children. 40 41When there is a horizontal fold that is obscuring or separating, the layout will begin placing children from the top of the available space. If a child is projected to overlap the fold, then its y-coordinate is increased so it will be placed fully below the fold, as will any other remaining children. 42 43When there is no fold, the children will be placed consecutively with no y-coordinate adjustments. 44 45Optionally, children can be modified with the `ignoreFold()` attribute, which means that they will be placed as if no fold is present even if they overlap a fold. 46 47## Download 48 49[](https://search.maven.org/search?q=g:com.google.accompanist) 50 51```groovy 52repositories { 53 mavenCentral() 54} 55 56dependencies { 57 implementation "com.google.accompanist:accompanist-adaptive:<version>" 58} 59```