Android samples built using Jetpack Window Manager for foldable and dual-screen devices like Microsoft Surface Duo.

Overview

Jetpack Window Manager samples for dual-screen and foldable devices like Microsoft Surface Duo

Android app samples that use Jetpack Window Manager to support dual-screen and foldable devices.

Related links

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Comments
  • Window Manager approach does not account for occluded content

    Window Manager approach does not account for occluded content

    I am working on an app for the Duo and I just finished implementing the window manager approach as used in the TwoDo app. I noticed that in both the sample TwoDo app and my app this approach doesn't seem to account for the region occluded by the hinge. The ReactiveGuide used for the vertical and horizontal folds has visibility GONE and doesn't have a width. In general it behaves very oddly.

    What this means:

    If you add a simple view (like a textview) at the hinge adjacent edges of a set of containers, you'll see that one of them is occluded by the hinge.

    image

    Below, the pink container's end is constrained to the start of the vertical fold. The green container's start is constrained to the end of the vertical fold.

    image

    In the layout inspector, you can see that the pink start container is a little bigger than the green end container from stretching into the hinge area (about 33dp or 82.5 raw pixels at the Surface Duo's dpi).

    image image

    If you call ScreenInfo.getHinge().width(), it returns 84 pixels. This is close enough to the 82.5 raw pixel difference the layout inspector is reporting to not be a coincidence.

    Solution & TLDR

    ReactiveGuides don't account for an occluding hinge. I expected that the APIs would handle this (and I suspect many other developers will as well). You can fix it by padding the end of the container with whatever ScreenInfo.getHinge().width() returns.

            if(duoScreenProviderInfo.isSurfaceDuoDevice())
            {
                // ReactiveGuides specified in the layout (vert_fold and horiz_fold) don't provide full
                // support for devices with occluding folds like the Duo. We need to manually draw
                // the region that is occluded, otherwise our fragments will extend into that space.
    
                // Check that you're in dual screen mode, etc. then the call below should never fail.
                val hingeRegion = duoScreenProviderInfo.getHinge()!!
    
                // For a vertical orientation updatePadding(left, top, right, bottom)
                // startContainer.updatePadding(0, 0, hingeRegion.width(), 0)
    
                // For a horizontal orientation updatePadding(left, top, right, bottom)
                // endContainer.updatePadding(0, hingeRegion.height(), 0, 0)
            }
    

    When vertical update the startContainer, when horizontal update the endContainer.

    I can confirm this works in the emulator and on a real device. I assume this is how the SurfaceDuoLayout libraries may be handling this, but I was not able to get them working for my use case. Either way, I'd like to use the device agnostic APIs as much as possible.

    image

    Would you all be willing to update the samples and/or docs with this?

    opened by neatorobito 4
  • Issue 16 (PhotoEditor)

    Issue 16 (PhotoEditor)

    Seems like the issue was that we were deciding whether to inflate the single vs dual screen layout (in ActivityFragment) based on information from window manager, but the window manager info wasn't always updated before inflating the views!

    @conceptdev @CesarValiente

    opened by khalp 2
  • PhotoEditor port to WindowInfoRepository sometimes shows squished layout

    PhotoEditor port to WindowInfoRepository sometimes shows squished layout

    I think there might be a timing or other issue with PhotoEditor's migration to WindowInfoRepository... fixes itself after rotation, so the layout code is there. Example:

    bad-layout

    opened by conceptdev 2
  • Fix PhotoEditor drag&drop UI test

    Fix PhotoEditor drag&drop UI test

    ๐Ÿ“ƒ Description

    Updates the drag and drop test in PhotoEditor so it works on both device and emulator

    ๐Ÿค” Motivation and Context

    Fixes #34 by using targetContext instead of context, making sure the app has permission to query the Files app, and using test kit device coordinates instead of hardcoded values

    ๐Ÿงช How Has This Been Tested?

    Tested on Surface Duo, Surface Duo 2, and Surface Duo 2 emulator

    Note: test will not pass on Surface Duo 1 emulator due to known smallestWidthDp issue (emulator dimensions are incorrect, so the device model will not be recognized)

    image

    โš’๏ธ Does the PR contain new tests or refactored old ones?

    Refactors the old drag & drop test

    ๐Ÿ“ท Screenshots (if appropriate)

    ๐Ÿ“ฆ Types of changes

    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Enhancement to a current functionality
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [x] Bug fix (non-breaking change which fixes #34).

    โœ… Checklist

    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [ ] This PR contains new tests that cover the new code.
    • [ ] This PR refactor previous tests to cover the new code.
    • [ ] This PR is part of a set of PRs that build a bigger feature. If so, please, add here links to previously merged or open PRs.
    opened by khalp 1
  • Use test kit in sample UI tests

    Use test kit in sample UI tests

    Update samples with UI tests to use test kit spanning methods instead of local helper methods

    Note: some of the UI tests in FoldingVideo and PhotoEditor fail but for reasons other than this update - I can create issues for these so we can fix them in the future

    opened by khalp 1
  • update to rc01

    update to rc01

    Update samples to Jetpack Window Manager rc01:

    • [x] eBookReader ^
    • [x] FoldingVideo
    • [x] FoldingVideoPlusChat
    • [x] PhotoEditor
    • [x] SourceEditor
    • [x] TravelPlanner ^
    • [x] TwoDo ^
    • [x] TwoNote

    ^ these samples were also updated with SlidingPaneLayout rc01

    opened by conceptdev 1
  • update to beta04

    update to beta04

    Update samples to Jetpack Window Manager beta04:

    • [ ] eBookReader ^
    • [x] FoldingVideo
    • [x] FoldingVideoPlusChat
    • [x] PhotoEditor
    • [x] SourceEditor
    • [ ] TravelPlanner ^
    • [ ] TwoDo ^
    • [x] TwoNote

    ^ three samples use slidingpanelayout:1.2.0-beta01 which is still dependent on an earlier version of JWM (1.0.0-beta02) and cannot be updated until a new SlidingPaneLayout is available that's based on JWM beta04.

    opened by conceptdev 1
  • ebook reader needs to be added to the `buid-test-check` workflow

    ebook reader needs to be added to the `buid-test-check` workflow

    @raymondliu2022 can you please add ebook-reader project to the existent build-text-check workflow? so tests and checks are done also on it? https://github.com/microsoft/surface-duo-window-manager-samples/blob/c9d47df61282384420ee33716e34139fcae20356/.github/workflows/build_test_check.yml#L24

    Thanks!

    enhancement 
    opened by CesarValiente 1
  • [PhotoEditor] Drag and drop test fails

    [PhotoEditor] Drag and drop test fails

    The intent for launching the "Files" app fails

    The if statement to check if running on a device or emulator also needs to be updated to check if the model contains "Image" because it looks like the emulator name has changed

    bug 
    opened by khalp 0
  • update to 1.0.0 stable release

    update to 1.0.0 stable release

    and slidingpanelayout-1.2.0 stable release

    Update samples to Jetpack Window Manager 1.0.0:

    • [x] eBookReader ^
    • [x] FoldingVideo
    • [ ] FoldingVideoPlusChat
    • [ ] PhotoEditor
    • [x] SourceEditor
    • [ ] TravelPlanner ^
    • [x] TwoDo ^
    • [ ] TwoNote

    ^ these samples were also updated with SlidingPaneLayout to 1.2.0

    opened by conceptdev 0
  • splash screens for auto-span

    splash screens for auto-span

    Adds auto-span compatible splash screens to the following samples:

    • [x] PhotoEditor
    • [x] SourceEditor
    • [x] TwoNote
    • [x] eBook
    • [x] FoldingVideo
    • [x] FoldingVideoPlusChat

    Two samples do NOT use the default splash screen set-up:

    • TwoDo
    • TravelPlanner

    These samples already have their own splash-like behavior (yet to be tested with auto-span).

    opened by conceptdev 0
  • [TravelPlanner] verify splash-screen behavior with auto-span

    [TravelPlanner] verify splash-screen behavior with auto-span

    Travel Planner starts with an internet connectivity check which behaves like a splash screen.

    Test how it renders with auto-span, and adapt the UI if required.

    Test both empty (new install, no data) as well as populated with data states.

    bug 
    opened by conceptdev 0
  • [FoldingVideoPlusChat] in tablet portrait mode, keyboard hides entry

    [FoldingVideoPlusChat] in tablet portrait mode, keyboard hides entry

    On Surface Duo dual-portrait mode, the keyboard forces the chat next to the video so both are visible, but on tablet portrait mode the keyboard covers the chat. Need to handle this case for large screen devices.

    Surface Duo โœ”๏ธ

    videochat-dual-land

    Tablet โŒ

    videochat-fire-port -keyboardbug

    enhancement 
    opened by conceptdev 0
Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Proof of concept of custom widgets and apps running on the Z Flip3 cover screen. Adds a widget to Z Flip3 cover screen that lets you launch a web browser-like app on the cover.

SubUI-browser Proof of concept of custom widgets and apps running on the Z Flip3 cover screen. Adds a widget to Z Flip3 cover screen that lets you lau

null 35 Dec 24, 2022
Attendance-Manager - Attendance Manager, a attendance recording app that helps stay at your 75% attendance

Android-Study-Jams Attendance tracker app Problem Statement: There has been a ne

Gdsc_JMI 1 Jan 9, 2022
Android-splash-screen-demo - Sample application to demo the various features provided in android-splash-screen

Android Splash screen API demo This is a sample application used to demonstrate the various features provided in android-splash-screen. More details c

Sridhar 1 Jan 3, 2022
akka-samples-peristence-java by Lightbend, but using Kotlin.

This example illustrates event sourcing with Akka Persistence. it is based (okay, stolen from) the generated sample project akka-samples-peristence-ja

Jurjen Vorhauer 1 Oct 11, 2022
Ankiconnect Android allows you to utilize the standard Anki mining workflow on Android devices like phones and eReaders

Ankiconnect Android Ankiconnect Android allows you to utilize the standard Anki mining workflow on Android devices like phones and eReaders. Create An

Kamron Bhavnagri 29 Dec 28, 2022
Samples demonstrating the features and use of Koala Plot, a Compose Multiplatform based charting and plotting library written in Kotlin.

Koala Plot Samples This repository houses samples demonstrating the use and features of Koala Plot libraries. How to run Build koalaplot-core with the

Koala Plot 6 Oct 18, 2022
Google Play game services - Android samples

Google Play game services - Android Samples Copyright (C) 2014 Google Inc. Contents These are the Android samples for Google Play game services. Colle

Google Play Game Services 953 Jan 2, 2023
Android samples for Google Workspace APIs

Google Workspace Android Samples A collection of samples that demonstrate how to call Google Workspace APIs from Android. Products Drive Deprecation A

Google Workspace 615 Dec 16, 2022
Samples showing best practices for MIDI on Android.

MIDI Samples This repository contains a set of individual Android Studio projects to help you write apps using MIDI APIs. Android MIDI 2.0 API samples

Android 23 Dec 19, 2022
Samples in Material Animation (Deprecated)

Material-Animation-Samples (Deprecated) or watch it on youtube #Samples: Samples in material animation will be added through the next two monthes. Lay

Ahmed Tarek 228 Dec 7, 2021
This is an open source launcher project for Android devices that has been built completely from scratch

Description This is an open source launcher project for Android devices that has been built completely from scratch. The main goal of this launcher is

OpenLauncher Team 1.3k Dec 21, 2022
Demo app demonstrating how to create and manage notifications locally using a combination of Jetpacks Worker Manager and Broadcast Receiver.

Worker Notification Demo app demonstrating how to create and manage notifications locally using a combination of Jetpacks Worker Manager and Broadcast

Ayia 1 Sep 19, 2022
Identification of android devices using wallpaper image

WallpaperID The source code of the demo application that calculates an ID for a device using wallpaper images. The ID is scoped to a device and will b

FingerprintJS 20 Sep 27, 2022
An android application that provides simple communication between bluetooth enabled devices using LoRa for intermidiate data transfer

LoRa and bluetooth communication An android application that provides simple communication between bluetooth enabled devices using LoRa for intermidia

Erling Mathias Staff 2 May 4, 2022
This repo provides a sample application that demonstrates how you can speed up the authentication experience for frontline workers on shared devices using QR codes.

Project This repo has been populated by an initial template to help get you started. Please make sure to update the content to build a great experienc

Microsoft 5 Dec 7, 2022
Demo of Downloading Songs/Images through Android Download Manager using RxJava2

Downloader Demo using RxJava Overview This project is for downloading items(songs, images etc) in Android using RxJava2. There are, however 2 conditio

Anshul Jain 168 Nov 25, 2022
Money Manager app that helps you to add your daily small incomes and expenses and track them easily.

Simple Money Manager This app is a simple money manager app which helps you to add your daily small incomes and expenses and track them easily. Screen

Yash Bansal 2 Nov 21, 2021