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.

SDK samples

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:

KotlinDragAndDrop

Drag and Drop

This sample features drag and drop capabilities that can span over a single page or multiple screens, depending on the layout of the application.

KotlinPenEvents

Pen Events

This sample demonstrates how pen events and corresponding data can be used within an application.

KotlinIntentSecondScreen

Intent Second Screen

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:

eBook Reader

eBook Reader

Simple ebook reader implemented with Jetpack Window manager and ViewPager2.

Folding Video

Folding Video

Video player using ExoPlayer and Jetpack Window Manager to adapt the view depending on device the folding feature type and orientation.

TwoDo

TwoDo

To-do list application that uses Jetpack Window Manager and SlidingPaneLayout, along with Room for data storage.

SurfaceDuoLayout samples

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.

TwoNote

TwoNote

Note-taking application with note categories, drag-and-drop, and pen inking support.

PhotoEditor

Photo Editor

This application implements a simple photo editor that lets users select, edit, and save images.

SourceEditor

Source Editor

The application is an HTML editor that enables real-time rendering of formatted source code.