{"id":2160,"date":"2022-01-27T11:48:34","date_gmt":"2022-01-27T19:48:34","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/surface-duo\/?p=2160"},"modified":"2022-01-27T11:48:34","modified_gmt":"2022-01-27T19:48:34","slug":"jetpack-window-manager-foldable-sdk","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/surface-duo\/jetpack-window-manager-foldable-sdk\/","title":{"rendered":"Foldable SDK update with Jetpack Window Manager"},"content":{"rendered":"<p>\n  Hello Android developers,\u00a0\n<\/p>\n<p><a href=\"https:\/\/developer.android.com\/jetpack\/androidx\/releases\/window\">Jetpack WindowManager version 1.0.0<\/a> 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 <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/\">dual-screen libraries for Android developers<\/a> are more foldable aware than ever!\n<\/p>\n<p>\n  The changes in the latest release are:\u00a0\n<\/p>\n<ul>\n<li>\n    Jetpack Window Manager version 1.0.0 used at the core of all the libraries.\u00a0\n  <\/li>\n<li>\n    We will stop updating ScreenManager-WindowManager and ScreenManager-DisplayMask.  There is no compatibility between them and this update.\u00a0\n  <\/li>\n<li>\n    All the libraries can also be used with other foldable devices (they also support single screen devices).\u00a0\n  <\/li>\n<li>\n    Updated\u00a0<a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/\">documentation<\/a>\u00a0and <a href=\"https:\/\/github.com\/microsoft\/surface-duo-sdk-samples-kotlin\">samples<\/a>.\u00a0\n  <\/li>\n<\/ul>\n<p>\n  Version information for each library (to use in your gradle files):\n<\/p>\n<ul>\n<li>\n    com.microsoft.device.dualscreen:layouts:1.0.0-beta8\n  <\/li>\n<li>\n    com.microsoft.device.dualscreen:tabs:1.0.0-beta4\u00a0\n  <\/li>\n<li>\n    com.microsoft.device.dualscreen:bottomnavigation:1.0.0-beta4\u00a0\n  <\/li>\n<li>\n    com.microsoft.device.dualscreen:recyclerview:1.0.0-beta6\u00a0\n  <\/li>\n<li>\n    com.microsoft.device.dualscreen:fragmentshandler:1.0.0-beta5 \n  <\/li>\n<\/ul>\n<p>\n  This blog post explains how to migrate from the previous versions and describes the other new features of this release.\u00a0\n<\/p>\n<h2>Discontinued Libraries<\/h2>\n<p>\n  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.\u00a0\n<\/p>\n<p>\n  Check the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/jetpack\/window-manager\/\">documentation and examples<\/a> for Jetpack Window Manager to learn more.\u00a0\n<\/p>\n<h2>Migrating from older releases\u00a0<\/h2>\n<p>\n  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:\u00a0\n<\/p>\n<ul>\n<li>\n    SurfaceDuoLayout changed to <b>FoldableLayout<\/b>\n  <\/li>\n<li>\n    SurfaceDuoFrameLayout changed to <b>FoldableFrameLayout<\/b>\n  <\/li>\n<li>\n    SurfaceDuoBottomNavigationView becomes <b>FoldableBottomNavigationView<\/b>\n  <\/li>\n<li>\n    SurfaceDuoTabLayout changed to <b>TabLayout<\/b>\n  <\/li>\n<li>\n    SurfaceDuoLayoutManager to <b>FoldableLayoutManager<\/b>\n  <\/li>\n<li>\n    SurfaceDuoItemDecoration to <b>FoldableItemDecoration<\/b>\n  <\/li>\n<\/ul>\n<p>\n  Furthermore, we have added two new classes inside the recycler view library, <code>FoldableStaggeredLayoutManager<\/code> and <code>FoldableStaggeredItemDecoration<\/code>, for staggered grid formation.\u00a0\n<\/p>\n<h2>Libraries available in Maven Central\u00a0<\/h2>\n<p>\nThe libraries are available on <a href=\"https:\/\/mvnrepository.com\/search?q=com.microsoft.device.dualscreen&amp;sort=relevance\" target=\"_blank\" rel=\"noopener\">Maven Central<\/a>, so to import the latest version of the SDK, you should include the <code>mavenCentral()<\/code> repository in your top-level build.gradle file like this:\u00a0\n<\/p>\n<pre>allprojects {\u00a0\r\n\u00a0\u00a0\u00a0repositories {\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 google()\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 mavenCentral()\u00a0\r\n\u00a0\u00a0\u00a0}\u00a0\r\n}<\/pre>\n<h2>Foldables support example<\/h2>\n<p>\n  Now let\u2019s check out our foldable support for <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/layouts\/surfaceduo-layout\">FoldableLayout<\/a> in the <a href=\"https:\/\/docs.microsoft.com\/dual-screen\/design\/dual-view\">Dual View pattern<\/a> sample.  We will see the same application running on the Android 8\u201d Fold Out emulator and the Surface Duo 2 emulator. \n<\/p>\n<p>\n<a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide.png\" alt=\"Two 8&quot; fold out emulator screenshots showing sample app menu and dualview example screen\" width=\"1909\" height=\"1000\" class=\"alignnone size-full wp-image-2174\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide.png 1909w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide-300x157.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide-1024x536.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide-768x402.png 768w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-foldout8-wide-1536x805.png 1536w\" sizes=\"(max-width: 1909px) 100vw, 1909px\" \/><\/a><br\/><em>Figure 1: Sample application running on the 8\u201d Android Emulator<\/em>\n<\/p>\n<p>\n<a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2.png\" alt=\"Surface Duo 2 running SDK sample demo app showing a list and a map\" width=\"1194\" height=\"957\" class=\"alignnone size-full wp-image-2176\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2.png 1194w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2-300x240.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2-1024x821.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-dualview2-768x616.png 768w\" sizes=\"(max-width: 1194px) 100vw, 1194px\" \/><\/a><a href=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu.png\" alt=\"Surface Duo 2 running SDK sample demo app showing the menu screen\" width=\"1194\" height=\"957\" class=\"alignnone size-full wp-image-2168\" srcset=\"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu.png 1194w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu-300x240.png 300w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu-1024x821.png 1024w, https:\/\/devblogs.microsoft.com\/surface-duo\/wp-content\/uploads\/sites\/53\/2022\/01\/sdk-sample-menu-768x616.png 768w\" sizes=\"(max-width: 1194px) 100vw, 1194px\" \/><\/a><br\/><em>Figure 2: Sample application running on the Surface Duo 2 Emulator<\/em>\n<\/p>\n<p>\nOn both devices the FoldableLayout library will automatically detect the type of folding feature and will react accordingly.\n<\/p>\n<p>\n  This behavior is present on all updated libraries.\n<\/p>\n<h2>Feedback and resources<\/h2>\n<p>\n  The\u00a0<a href=\"https:\/\/github.com\/microsoft\/surface-duo-sdk\">source code for the SDK<\/a>\u00a0is available on GitHub if you\u2019re curious about the implementation or wish to contribute. Visit the\u00a0<a href=\"https:\/\/docs.microsoft.com\/dual-screen\/android\/api-reference\/dualscreen-library\/\">documentation<\/a>\u00a0for more information.\n<\/p>\n<p>\n  Thanks to the team \u2013\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/bianca-miron-ro\/\">Bianca Miron<\/a>,\u00a0<a href=\"https:\/\/twitter.com\/CesarValiente\">Cesar Valiente<\/a>,\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/cristian-verdes-3b0046135\/\">Cristian Verdes<\/a>, and <a href=\"https:\/\/www.linkedin.com\/in\/andrei-cirja-9b781278\/\">Andrei Cirja<\/a>\u00a0\u2013 for their work on this release.\u00a0\n<\/p>\n<p>\n  We\u2019d love to hear from you and how you plan to incorporate dual-screen enhancements into your apps. Please reach to out using the\u202f<a href=\"http:\/\/aka.ms\/SurfaceDuoSDK-Feedback\" target=\"_blank\" rel=\"noopener\">feedback forum<\/a>\u202for message us\u202f<a href=\"https:\/\/twitter.com\/surfaceduodev\" target=\"_blank\" rel=\"noopener\">@surfaceduodev<\/a>\u202fon Twitter.\u00a0\n<\/p>\n<p>\n  Finally, please join us for our <a href=\"https:\/\/twitch.tv\/surfaceduodev\">dual screen developer livestream<\/a> at 11am (Pacific time) each Friday \u2013 and this week also at 13:00 Central European Time (12:00 UTC) on Friday, January 28th. \nMark it in your calendar and check out the <a href=\"https:\/\/www.youtube.com\/channel\/UClGu9QLtPNz8OdddBfhZXPA\">archives on YouTube<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Android developers,\u00a0 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 [&hellip;]<\/p>\n","protected":false},"author":82638,"featured_media":2168,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[31,705,706,473,45],"class_list":["post-2160","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-surface-duo-sdk","tag-dual-screen-development","tag-java","tag-jetpack-window-manager","tag-kotlin","tag-surface-duo-sdk"],"acf":[],"blog_post_summary":"<p>Hello Android developers,\u00a0 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/2160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/users\/82638"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/comments?post=2160"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/posts\/2160\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media\/2168"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/media?parent=2160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/categories?post=2160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/surface-duo\/wp-json\/wp\/v2\/tags?post=2160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}