@@ -10,13 +10,18 @@ import android.content.Context
1010import android.content.Intent
1111import android.content.ServiceConnection
1212import android.content.res.Configuration
13+ import android.graphics.Color
1314import android.os.Build
1415import android.os.Bundle
1516import android.os.IBinder
1617import androidx.activity.ComponentActivity
18+ import androidx.activity.SystemBarStyle
1719import androidx.activity.compose.setContent
20+ import androidx.activity.enableEdgeToEdge
1821import androidx.annotation.RequiresApi
1922import androidx.compose.foundation.layout.fillMaxSize
23+ import androidx.compose.foundation.layout.navigationBarsPadding
24+ import androidx.compose.foundation.layout.statusBarsPadding
2025import androidx.compose.material3.MaterialTheme
2126import androidx.compose.material3.Surface
2227import androidx.compose.runtime.Composable
@@ -45,11 +50,11 @@ import java.net.URL
4550/* *
4651 * Simple player activity that can handle picture in picture.
4752 *
48- * It handle basic background playback, as it will stop playback when the Activity is destroyed!
49- * To have pure background playback with good integration from other device like Auto, Wear, etc... we need *MediaSessionService*
53+ * It handles basic background playback, as it will stop playback when the Activity is destroyed!
54+ * To have pure background playback with good integration from other devices like Auto, Wear, etc... we need *MediaSessionService*
5055 *
5156 * For this demo, only the picture in picture button can enable picture in picture.
52- * But feel free to call [startPictureInPicture] whenever you decide, for example when [onUserLeaveHint]
57+ * But feel free to call [startPictureInPicture] whenever you decide, for example, when [onUserLeaveHint]
5358 */
5459class SimplePlayerActivity : ComponentActivity (), ServiceConnection {
5560
@@ -64,7 +69,13 @@ class SimplePlayerActivity : ComponentActivity(), ServiceConnection {
6469 }
6570
6671 override fun onCreate (savedInstanceState : Bundle ? ) {
72+ enableEdgeToEdge(
73+ statusBarStyle = SystemBarStyle .dark(Color .BLACK ),
74+ navigationBarStyle = SystemBarStyle .dark(Color .BLACK ),
75+ )
76+
6777 super .onCreate(savedInstanceState)
78+
6879 val ilHost = IntentCompat .getSerializableExtra(intent, ARG_IL_HOST , URL ::class .java) ? : IlHost .DEFAULT
6980 playerViewModel = ViewModelProvider (this , factory = SimplePlayerViewModel .Factory (application, ilHost))[SimplePlayerViewModel ::class .java]
7081 readIntent(intent)
@@ -83,7 +94,13 @@ class SimplePlayerActivity : ComponentActivity(), ServiceConnection {
8394 bindPlaybackService()
8495 setContent {
8596 PillarboxTheme {
86- Surface (modifier = Modifier .fillMaxSize(), color = MaterialTheme .colorScheme.background) {
97+ Surface (
98+ modifier = Modifier
99+ .fillMaxSize()
100+ .statusBarsPadding()
101+ .navigationBarsPadding(),
102+ color = MaterialTheme .colorScheme.background,
103+ ) {
87104 MainContent (playerViewModel.player)
88105 }
89106 }
0 commit comments