1*fa44fe6aSInna Palant# Adaptive utilities for Jetpack Compose 2*fa44fe6aSInna Palant 3*fa44fe6aSInna Palant[](https://search.maven.org/search?q=g:com.google.accompanist) 4*fa44fe6aSInna Palant 5*fa44fe6aSInna PalantA library providing a collection of utilities for adaptive layouts. 6*fa44fe6aSInna Palant 7*fa44fe6aSInna Palant## calculateDisplayFeatures 8*fa44fe6aSInna Palant 9*fa44fe6aSInna Palant[`calculateDisplayFeatures(activity)`](../api/adaptive/com.google.accompanist.adaptive/calculate-display-features.html) returns the current list of `DisplayFeature`s, 10*fa44fe6aSInna Palantas reported by the [Jetpack WindowManager library](https://developer.android.com/jetpack/androidx/releases/window). 11*fa44fe6aSInna Palant 12*fa44fe6aSInna PalantThese contain the list of folds (if any), and can be used to drive components like [`TwoPane`](#TwoPane). 13*fa44fe6aSInna Palant 14*fa44fe6aSInna Palant## TwoPane 15*fa44fe6aSInna Palant 16*fa44fe6aSInna Palant[`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) is a UI component that positions exactly two slots on the screen. 17*fa44fe6aSInna Palant 18*fa44fe6aSInna PalantThe default positioning of these two slots is driven by a [`TwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-two-pane-strategy.html), 19*fa44fe6aSInna Palantwhich can decide to orient the two slots side-by-side horizontally or vertically, and also configure the gap between them. 20*fa44fe6aSInna Palant 21*fa44fe6aSInna PalantThe built-in [`HorizontalTwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-horizontal-two-pane-strategy.html) and 22*fa44fe6aSInna Palant[`VerticalTwoPaneStrategy`](../api/adaptive/com.google.accompanist.adaptive/-vertical-two-pane-strategy.html) allow positioning the 23*fa44fe6aSInna Palantslots based on a fixed offset, or as some fraction of the space. 24*fa44fe6aSInna Palant 25*fa44fe6aSInna Palant[`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) also requires a list of display features (to be retrieved with [`calculateDisplayFeatures`](#calculateDisplayFeatures)), 26*fa44fe6aSInna Palantand optionally a [`FoldAwareConfiguration`](../api/adaptive/com.google.accompanist.adaptive/-fold-aware-configuration.html) to determine which folds to handle automatically. 27*fa44fe6aSInna Palant 28*fa44fe6aSInna PalantWhen there is a fold that intersects with the [`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) component that is obscuring or separating, 29*fa44fe6aSInna Palantthe [`TwoPane`](../api/adaptive/com.google.accompanist.adaptive/-two-pane.html) will automatically place the slots to avoid the fold. 30*fa44fe6aSInna Palant 31*fa44fe6aSInna PalantWhen there is no fold, the default supplied strategy will be used instead. 32*fa44fe6aSInna Palant 33*fa44fe6aSInna Palant## FoldAwareColumn 34*fa44fe6aSInna Palant 35*fa44fe6aSInna Palant[`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*fa44fe6aSInna Palant 37*fa44fe6aSInna Palant[`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*fa44fe6aSInna Palant 39*fa44fe6aSInna PalantThe 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*fa44fe6aSInna Palant 41*fa44fe6aSInna PalantWhen 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*fa44fe6aSInna Palant 43*fa44fe6aSInna PalantWhen there is no fold, the children will be placed consecutively with no y-coordinate adjustments. 44*fa44fe6aSInna Palant 45*fa44fe6aSInna PalantOptionally, 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*fa44fe6aSInna Palant 47*fa44fe6aSInna Palant## Download 48*fa44fe6aSInna Palant 49*fa44fe6aSInna Palant[](https://search.maven.org/search?q=g:com.google.accompanist) 50*fa44fe6aSInna Palant 51*fa44fe6aSInna Palant```groovy 52*fa44fe6aSInna Palantrepositories { 53*fa44fe6aSInna Palant mavenCentral() 54*fa44fe6aSInna Palant} 55*fa44fe6aSInna Palant 56*fa44fe6aSInna Palantdependencies { 57*fa44fe6aSInna Palant implementation "com.google.accompanist:accompanist-adaptive:<version>" 58*fa44fe6aSInna Palant} 59*fa44fe6aSInna Palant```