feat: Added support for Tabletop (Flex Mode/Half Open) in Player [#1313] #1398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Commit Message
Feature Overview
In the player page, when the device goes to Tabletop/Flex Mode/Half Open, the player screen will only occupy the top half of the screen.
This can be achieved by implementing fold-aware logic in the activity.
https://developer.android.com/develop/ui/compose/layouts/adaptive/foldables/make-your-app-fold-aware#tabletop_posture
Code Changes
Added WindowManager dependency in the
playermodule. In theactivity_player.xml, the root view is moved inside a constraint layout so that it can be managed easily to fill the top half of the screen by setting thelayout_constraintHeight_percentto 0.5.In the
PlayerActivity.kt,WindowInfoTracker&windowLayoutInfochanges are used to determine the fold mode and change the layout accordingly.Screen Record
Screen_recording_20250821_222342.mp4
Additional Info
Screen Record in Samsung Z Fold in Samsung Remote Test Lab.
If anyone is interested, check out the Universal Signed APK