Foldables

Foldable Postures and the Hinge

A foldable adds two facts that width alone misses: the posture (half-opened and lying flat is tabletop; held upright like a book is book posture) and the hinge, a fold or a gap between two screens that content should not straddle. Jetpack 234 WindowManager reports both as FoldingFeatures, and the windowPosture of currentWindowAdaptiveInfoV2() condenses them for Compose 234 . BookNest turns it into a layout mode with a plain function, which a unit test can feed any Posture:

ui/AdaptiveCatalog.kt: choosing a layout mode from the postureKotlin
fun postureMode(posture: Posture): String = when {
  posture.isTabletop -> "tabletop: content above the fold, controls below"
  posture.hingeList.any { it.isSeparating } -> "book: one pane on each side of the hinge"
  else -> "flat: no separating hinge"
}

LogWindowInfo logs the mode, and on this book's Pixel 8 emulator the log in Window Size Classes shows an empty posture, Posture(isTabletop=false, hinges=[]), and the mode "flat: no separating hinge".

ListDetailPaneScaffold (List-Detail Layouts) already keeps its two panes off a separating hinge. The emulator here has no fold, so real postures were not tested; avdmanager list device offers pixel_9_pro_fold, pixel_10_pro_fold and a resizable profile, whose extended controls change the fold angle at run time, and the posture then flows through the same State and recomposes the layout.