1
0
Форкнуть 0
surface-duo-window-manager-.../PhotoEditor
Kristen Halper b4ace80301
Fix PhotoEditor drag&drop UI test (#38)
* Update dependencies

* Add "Files" package to android manifest

So the launch intent for the Files package can be accessed (https://developer.android.com/training/package-visibility)

* Use target context and different intent flag

* Use test kit coordinates instead of hardcoding
2022-05-02 09:00:35 -04:00
..
app Fix PhotoEditor drag&drop UI test (#38) 2022-05-02 09:00:35 -04:00
gradle/wrapper Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
screenshots Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
.gitignore Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
README.md Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
build.gradle Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
dependencies.gradle Fix PhotoEditor drag&drop UI test (#38) 2022-05-02 09:00:35 -04:00
gradle.properties Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
gradlew Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
gradlew.bat Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00
ktlint.gradle Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
settings.gradle Convert PhotoEditor to Window Manager (#11) 2021-07-29 11:42:44 -07:00

README.md

page_type name description languages products urlFragment
sample Surface Duo - PhotoEditor Uses the companion pane dual-screen pattern and drag and drop features in a photo editing app for the Surface Duo.
kotlin
surface-duo
photo-editor

PhotoEditor

This Kotlin application implements a simple photo editor that lets users select, edit, and save images. Screenshots of the application and its behavior are available here.

Getting Started

To learn how to load apps on the Surface Duo emulator, see the documentation, and follow the blog.

[!NOTE] This application uses a beta release of the Constraint Layout library to facilitate image editing with the ImageFilterView class.

Features

In contrast to the original PhotoEditor sample which utilizes Microsoft's SurfaceDuoLayout to handle dual screen devices, this project makes use of Jetpack Window Manager API. This sample uses Window Manager to handle events that require consideration of a hinge or fold in the device's screen.

This app supports three main actions: selection, editing, and saving. To select a photo, click on the current image to open the device's photo gallery. To modify image properties, use the buttons and sliders. Finally, to save the changes in a new photo, click the save button.

PhotoEditor app on left screen with edited image and photo gallery on right screen displaying the same edited image after it was saved

Companion Pane

This sample shows how the companion pane dual-screen app pattern can be used to make more tools and controls available to users when the app is spanned. When in single-screen mode, the app only shows users three controls: the slider, the rotation buttons, and the save button. In order to modify all possible properties with the slider, the user must interact with the dropdown menu. This ensures that the chosen image is large enough on the screen to inspect any edits.

When switched to dual-screen mode, however, the entire left screen can be dedicated to image display. This frees up the right screen to display more editing controls. As a result, a dropdown menu is no longer needed and all three slider controls can be displayed.

Drag and Drop

This sample also demonstrates how drag and drop features can simplify file transfer across screens and between applications. Instead of clicking to open the photo gallery and select a new photo, users can simply drag the desired image file into the app and drop it over the currently displayed image, as shown below. For more information, check out this drag and drop sample.

Drag and drop example between Files app and PhotoEditor

Dual-screen Layout

The SurfaceDuoLayout element of the dual-screen layout package is the key to developing applications on the Surface Duo. This layout provides different attributes for single-screen and dual-screen views, and example usage can be seen in activity_main.xml.

[!NOTE] When defining landscape and portrait xml resources in Android Studio for the dual-screen view, the two screens are treated as one. That means the dual-screen landscape orientation is when the single-screen orientation would be considered portrait (shown below) and vice versa. For more tips, check out this blog post.

Dual-screen landscape view

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 opencode@microsoft.com with any additional questions or comments.

License

Copyright (c) Microsoft Corporation.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.