File tree Expand file tree Collapse file tree 6 files changed +42
-3
lines changed
java/com/mux/player/media3 Expand file tree Collapse file tree 6 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 11
11
android : roundIcon =" @mipmap/ic_launcher_round"
12
12
android : supportsRtl =" true"
13
13
android : theme =" @style/Theme.MuxVideoMedia3"
14
- tools : targetApi = " 31 " >
14
+ >
15
15
<activity
16
16
android : name =" .examples.carousel.PlayerCarouselActivity"
17
17
android : screenOrientation =" sensorPortrait"
18
18
android : exported =" false"
19
+ android : theme =" @style/Theme.MuxVideoMedia3.NoActionBar"
19
20
tools : ignore =" LockedOrientationActivity" />
20
21
<activity
21
22
android : name =" .examples.BasicPlayerActivity"
Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ import android.os.Bundle
6
6
import android.view.LayoutInflater
7
7
import android.view.View
8
8
import android.view.ViewGroup
9
+ import android.widget.Toast
9
10
import androidx.appcompat.app.AppCompatActivity
11
+ import androidx.core.view.ViewCompat
12
+ import androidx.core.view.WindowInsetsCompat
13
+ import androidx.core.view.updatePadding
10
14
import androidx.recyclerview.widget.LinearLayoutManager
11
15
import androidx.recyclerview.widget.RecyclerView
12
16
import com.mux.player.media3.databinding.ActivityMainBinding
@@ -25,6 +29,19 @@ class MainActivity : AppCompatActivity() {
25
29
super .onCreate(savedInstanceState)
26
30
binding = ActivityMainBinding .inflate(layoutInflater)
27
31
setContentView(binding.root)
32
+
33
+ ViewCompat .setOnApplyWindowInsetsListener(binding.mainExampleTb) { v, insets ->
34
+ val bars = insets.getInsets(
35
+ WindowInsetsCompat .Type .systemBars()
36
+ or WindowInsetsCompat .Type .displayCutout()
37
+ )
38
+ v.updatePadding(
39
+ top = bars.top,
40
+ bottom = bars.bottom,
41
+ )
42
+ WindowInsetsCompat .CONSUMED
43
+ }
44
+
28
45
examplesView.layoutManager = LinearLayoutManager (this )
29
46
30
47
binding.mainExampleTb.apply {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import android.util.Log
6
6
import android.widget.Toast
7
7
import androidx.annotation.OptIn
8
8
import androidx.appcompat.app.AppCompatActivity
9
+ import androidx.core.view.WindowCompat
9
10
import androidx.media3.common.MediaMetadata
10
11
import androidx.media3.common.PlaybackException
11
12
import androidx.media3.common.Player
@@ -32,6 +33,9 @@ class BasicPlayerActivity : AppCompatActivity() {
32
33
33
34
override fun onCreate (savedInstanceState : Bundle ? ) {
34
35
super .onCreate(savedInstanceState)
36
+
37
+ WindowCompat .setDecorFitsSystemWindows(window, true )
38
+
35
39
binding = ActivityBasicPlayerBinding .inflate(layoutInflater)
36
40
setContentView(binding.root)
37
41
}
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ import android.widget.Toast
14
14
import androidx.annotation.OptIn
15
15
import androidx.appcompat.app.AppCompatActivity
16
16
import androidx.constraintlayout.widget.ConstraintLayout
17
+ import androidx.core.view.ViewCompat
18
+ import androidx.core.view.WindowInsetsCompat
19
+ import androidx.core.view.updatePadding
17
20
import androidx.media3.common.MediaItem
18
21
import androidx.media3.common.MediaMetadata
19
22
import androidx.media3.common.PlaybackException
@@ -52,6 +55,18 @@ class ConfigurablePlayerActivity : AppCompatActivity() {
52
55
binding = ActivityConfigurablePlayerBinding .inflate(layoutInflater)
53
56
setContentView(binding.root)
54
57
58
+ ViewCompat .setOnApplyWindowInsetsListener(binding.root) { v, insets ->
59
+ val bars = insets.getInsets(
60
+ WindowInsetsCompat .Type .systemBars()
61
+ or WindowInsetsCompat .Type .displayCutout()
62
+ )
63
+ v.updatePadding(
64
+ top = bars.top,
65
+ bottom = bars.bottom,
66
+ )
67
+ WindowInsetsCompat .CONSUMED
68
+ }
69
+
55
70
if (savedInstanceState != null ) {
56
71
playbackParamsHelper.restoreInstanceState(savedInstanceState)
57
72
}
Original file line number Diff line number Diff line change 10
10
<androidx .media3.ui.PlayerView
11
11
android : id =" @+id/player"
12
12
android : layout_width =" match_parent"
13
- android : layout_height =" 320dp"
13
+ android : layout_height =" 0dp"
14
+ app : layout_constraintDimensionRatio =" 4:3"
14
15
app : layout_constraintTop_toTopOf =" parent" />
15
16
16
17
</androidx .constraintlayout.widget.ConstraintLayout>
Original file line number Diff line number Diff line change 13
13
<androidx .media3.ui.PlayerView
14
14
android : id =" @+id/player"
15
15
android : layout_width =" match_parent"
16
- android : layout_height =" 320dp"
16
+ android : layout_height =" 0dp"
17
+ app : layout_constraintDimensionRatio =" 4:3"
17
18
app : layout_constraintTop_toTopOf =" parent" />
18
19
19
20
<LinearLayout
You can’t perform that action at this time.
0 commit comments