Git Product home page Git Product logo

surface-duo-window-manager-samples's Introduction

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. Projects are updated to the 1.0.0 release of Window Manager.

  • eBookReader
  • FoldingVideo
  • FoldingVideoWithChat
  • PhotoEditor
  • SourceEditor
  • TravelPlanner
  • TwoDo
  • TwoNote

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.

surface-duo-window-manager-samples's People

Contributors

cesarvaliente avatar conceptdev avatar hvak avatar khalp avatar microsoft-github-operations[bot] avatar microsoftopensource avatar parkerschroeder avatar raymondliu2022 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

surface-duo-window-manager-samples's Issues

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?

[FoldingVideo] UI tests fail

Looks like the dual_portrait_split_ctrls_saved() test is failing on the last assertion, will need to investigate why

[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

[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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.