Foldable SDK update with Jetpack Window Manager

Sorin Albu

Hello Android developers, 

Jetpack WindowManager version 1.0.0 was released yesterday. We are thrilled about this announcement and wanted to share with you this exciting news and our latest library updates that are based on Jetpack Window Manager. Thus, these dual-screen libraries for Android developers are more foldable aware than ever!

The changes in the latest release are: 

  • Jetpack Window Manager version 1.0.0 used at the core of all the libraries. 
  • We will stop updating ScreenManager-WindowManager and ScreenManager-DisplayMask. There is no compatibility between them and this update. 
  • All the libraries can also be used with other foldable devices (they also support single screen devices). 
  • Updated documentation and samples

Version information for each library (to use in your gradle files):

  • com.microsoft.device.dualscreen:layouts:1.0.0-beta8
  • com.microsoft.device.dualscreen:tabs:1.0.0-beta4 
  • com.microsoft.device.dualscreen:bottomnavigation:1.0.0-beta4 
  • com.microsoft.device.dualscreen:recyclerview:1.0.0-beta6 
  • com.microsoft.device.dualscreen:fragmentshandler:1.0.0-beta5

This blog post explains how to migrate from the previous versions and describes the other new features of this release. 

Discontinued Libraries

The ScreenManager components, screenmanager-windowmanager and screenmanager-display mask, are discontinued and we no longer provide support for them. We are currently retrieving the screen info through the window layout info from the Jetpack Window Manager API. 

Check the documentation and examples for Jetpack Window Manager to learn more. 

Migrating from older releases 

The behavior for the SDK components remains the same, but we added support for foldable devices and some of the components were renamed in order to highlight this: 

  • SurfaceDuoLayout changed to FoldableLayout
  • SurfaceDuoFrameLayout changed to FoldableFrameLayout
  • SurfaceDuoBottomNavigationView becomes FoldableBottomNavigationView
  • SurfaceDuoTabLayout changed to TabLayout
  • SurfaceDuoLayoutManager to FoldableLayoutManager
  • SurfaceDuoItemDecoration to FoldableItemDecoration

Furthermore, we have added two new classes inside the recycler view library, FoldableStaggeredLayoutManager and FoldableStaggeredItemDecoration, for staggered grid formation. 

Libraries available in Maven Central 

The libraries are available on Maven Central, so to import the latest version of the SDK, you should include the mavenCentral() repository in your top-level build.gradle file like this: 

allprojects { 
   repositories { 
      google() 
      mavenCentral() 
   } 
}

Foldables support example

Now let’s check out our foldable support for FoldableLayout in the Dual View pattern sample. We will see the same application running on the Android 8” Fold Out emulator and the Surface Duo 2 emulator.

Two 8" fold out emulator screenshots showing sample app menu and dualview example screen
Figure 1: Sample application running on the 8” Android Emulator

Surface Duo 2 running SDK sample demo app showing a list and a mapSurface Duo 2 running SDK sample demo app showing the menu screen
Figure 2: Sample application running on the Surface Duo 2 Emulator

On both devices the FoldableLayout library will automatically detect the type of folding feature and will react accordingly.

This behavior is present on all updated libraries.

Feedback and resources

The source code for the SDK is available on GitHub if you’re curious about the implementation or wish to contribute. Visit the documentation for more information.

Thanks to the team – Bianca MironCesar ValienteCristian Verdes, and Andrei Cirja – for their work on this release. 

We’d love to hear from you and how you plan to incorporate dual-screen enhancements into your apps. Please reach to out using the feedback forum or message us @surfaceduodev on Twitter. 

Finally, please join us for our dual screen developer livestream at 11am (Pacific time) each Friday – and this week also at 13:00 Central European Time (12:00 UTC) on Friday, January 28th. Mark it in your calendar and check out the archives on YouTube.

0 comments

Discussion is closed.

Feedback usabilla icon