Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unfolding the mystery

Unfolding the mystery

Foldable devices made quite a buzz from the start. In the beginning, because they were not very robust. Now, because they ARE robust enough for daily usage. And they make large screens pocketable. This talk shows you how to make beautiful user interfaces that work well on smartphones, tablets, and foldables using Jetpack Compose and Jetpack WindowManager. We'll look at relevant APIs, cover important interaction patterns, and learn how to glue all together.

Thomas Künneth

August 17, 2022
Tweet

More Decks by Thomas Künneth

Other Decks in Programming

Transcript

  1. • Very compact • Must be opened for full usage

    • Screen essentially is Smartphone-sized • Book-like experience • Typically, 360-degree hinge • Various postures depending on intended use • Feels like a smartphone when closed • Essentially becomes a tablet when opened
  2. • Foldables may have one, two, or possibly more 😎

    display areas • Biggest area may be provided by more than one physical screen • If so, they are connected by a hinge
  3. • Even with one screen there may be a hinge

    (or fold) • It may block or obstruct parts of the display
  4. • A blocking hinge may cause no problems at all

    • May make the UX a little less pleasing • May require changes to the user interface
  5. 🤔So what? • Ignore devices with obstructing hinges • Make

    our apps first class citizens on as many devices as possible • Either way we need to deal with the large screen real estate
  6. 🤔Listen, I‘ve been thinking • Creating two column layouts is

    easy using classic Views • And it certainly is easy using Jetpack Compose • But … • what about the fold / hinge… • and how do we get information about the screen(s)?
  7. • Window metrics for an activity • Features of a

    foldable device • Position and size of the hinge • Orientation (vertical, horizontal) • Occlusion type (none, full) • State (flat, half opened)
  8. Hinge width: 66 pixel Hinge height: 1892 pixel 1344 –

    0 = 1344 pixel 2754 – 1410 = 1344 pixel 1892 pixel 2754 pixel
  9. NavigationRail / NavigationRailItem • NavigationRail() is used to move between

    primary app destinations • Displays three to seven destinations; optionally: • FloatingActionButton() • logo inside a header • NavigationRailItem() represents primary destinations
  10. • Two columns work great for tablets and foldables •

    Jetpack WindowManager helps determining size and location
  11. • Sometimes the hinge obstructs top-level UI elements • Material

    Design interaction patterns help minimizing the impact