nextplayer icon indicating copy to clipboard operation
nextplayer copied to clipboard

feat: Added support for Tabletop (Flex Mode/Half Open) in Player [#1313]

Open srdalai opened this issue 4 months ago • 1 comments

Commit Message

  • Added Jetpack WindowManager dependency
  • Changed Player Activity & Layout to support Tabletop

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 player module. In the activity_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 the layout_constraintHeight_percent to 0.5.

In the PlayerActivity.kt, WindowInfoTracker & windowLayoutInfo changes are used to determine the fold mode and change the layout accordingly.

Screen Record

https://github.com/user-attachments/assets/a600d436-f2b4-4a6f-a474-29a29a3f699f

Additional Info

Screen Record in Samsung Z Fold in Samsung Remote Test Lab.

If anyone is interested, check out the Universal Signed APK

srdalai avatar Aug 21 '25 17:08 srdalai

Works perfectly on my Galaxy Fold 7. Thanks @srdalai!

asakahn avatar Sep 04 '25 19:09 asakahn