1
0
Форкнуть 0
surface-duo-window-manager-.../FoldingVideo
Kristen Halper e52c21050f
Use test kit in sample UI tests (#33)
* Update PhotoEditor dependencies and tests

* Update FoldingVideo dependencies and tests

* Update SourceEditor dependencies and tests

* Update TwoNote dependencies and tests

* Import ForceClick
2022-03-02 11:02:31 -05:00
..
app Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
gradle/wrapper Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
screenshots FoldingVideo sample app (#1) 2021-07-01 10:55:55 -07:00
.gitignore Build pipeline setup (#4) 2021-07-09 00:41:35 +02:00
README.md FoldingVideo sample app (#1) 2021-07-01 10:55:55 -07:00
build.gradle Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
gradle.properties FoldingVideo sample app (#1) 2021-07-01 10:55:55 -07:00
gradlew Build pipeline setup (#4) 2021-07-09 00:41:35 +02:00
gradlew.bat Build pipeline setup (#4) 2021-07-09 00:41:35 +02:00
ktlint.gradle Use test kit in sample UI tests (#33) 2022-03-02 11:02:31 -05:00
settings.gradle FoldingVideo sample app (#1) 2021-07-01 10:55:55 -07:00

README.md

page_type name description languages products urlFragment
sample Surface Duo - FoldingVideo Adapts videos to dual-screen by separating the controls
kotlin
surface-duo
folding-video

FoldingVideo - Video with External Controls Sample

This sample app shows how video-playing apps can be adapted to dual-screen and foldable devices. When a video is cut off by a hinge or fold, you can separate the video and its controls onto separate halves of the device. By calculating the fold position with Jetpack Window Manager, we can use MotionLayout and ReactiveGuide to move the controls accordingly.

Jetpack WM, MotionLayout, and ReactiveGuide

MotionLayout is used to animate the movement of the PlayerView and external ControlView. The PlayerView and the ControlView are constrained to a ReactiveGuide, which changes depending on the presence and location of a hinge/fold.

The app uses Jetpack Window Manager to detect the presence of a fold/hinge when the devices layout configuration changes. When there is a hinge and the controls need to be separated from the video, the app calculates the position of the fold using the FoldingFeature provided by Jetpack WMs WindowLayoutInfo and the MotionLayout view. The app pushes that fold position to the ReactiveGuide. The PlayerView and the ControlView are both constrained to the ReactiveGuide position, so they move accordingly to separate the video and the controls. The overlaid controls on the PlayerView are disabled, leaving only the video on one half, and the external controls on the other half. This is implemented twice, once for both orientations.

Surface Duo Examples

In dual-portrait mode, we have the option to split the controls with the FloatingActionButton in the top left corner. Optional split when the video is spanned across both screens

In dual-landscape mode, we always split the controls and leave the video on the top screen. Controls stay on the bottom screen when spanned to dual-landscape