Android sample apps for Surface Duo
There are a number of GitHub repos that contain code samples to help you enhance your apps for dual-screen and foldable devices. There is also a Google Codelab training module to learn how to use Window Manager.
Dual Screen Experience Example
Dual Screen Experience Example is a complete sample Android application that showcases real world scenarios and demonstrates different ways to make use of the dual-screen/foldable form factor. You can clone the GitHub repo or install it from the Google Play Store.
Demonstrates all the dual-screen design patterns and emphasizes the one currently being shown in the Toolbar.
Includes multiple controls from our SDK - Foldable Navigation Component, RecyclerView, BottomNavigationView, SnackbarContainer, and the Ink SDK.
Shows details regarding the current design pattern or dual-screen control, and makes it easy to explore the application code through a Toolbar item called Developer Mode.
There are Kotlin samples available that demonstrate all the different design patterns and unique features of the Surface Duo, such as extended canvas, list detail, two page, dual view, companion pane, how to access the hinge angle, and more.
A couple of these are highlighted below:
This sample features drag and drop capabilities that can span over a single page or multiple screens, depending on the layout of the application.
This sample demonstrates how pen events and corresponding data can be used within an application.
The Intent demo utilizes Intent functionality with Android to spawn secondary pages.
There are also Java versions available.
Jetpack Window Manager samples
See the complete list of Jetpack Window Manager samples. Here are three highlights:
Simple ebook reader implemented with Jetpack Window manager and ViewPager2.
Video player using ExoPlayer and Jetpack Window Manager to adapt the view depending on device the folding feature type and orientation.
To-do list application that uses Jetpack Window Manager and SlidingPaneLayout, along with Room for data storage.
These complete app samples demonstrate how to apply the dual-screen design patterns to real-world user interactions. These samples are designed to work on single-screen devices as well as the Surface Duo.
Note-taking application with note categories, drag-and-drop, and pen inking support.
This application implements a simple photo editor that lets users select, edit, and save images.
The application is an HTML editor that enables real-time rendering of formatted source code.