Skip to content

Commit

Permalink
feat: draw over display cutout setting
Browse files Browse the repository at this point in the history
  • Loading branch information
abdallahmehiz committed Jun 8, 2024
1 parent 4bd4a9d commit d78b30a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PlayerPreferences(
) {
val orientation = preferenceStore.getEnum("player_orientation", PlayerOrientation.SensorLandscape)
val invertDuration = preferenceStore.getBoolean("invert_duration", false)
val drawOverDisplayCutout = preferenceStore.getBoolean("draw_over_cutout", true)

val doubleTapToPause = preferenceStore.getBoolean("double_tap_to_pause", false)
val doubleTapToSeek = preferenceStore.getBoolean("double_tap_to_seek", true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PlayerActivity : AppCompatActivity() {
private val subtitlesPreferences by inject<SubtitlesPreferences>()

override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
if(playerPreferences.drawOverDisplayCutout.get()) enableEdgeToEdge()
super.onCreate(savedInstanceState)
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
Expand Down Expand Up @@ -259,6 +260,7 @@ class PlayerControls(
modifier = Modifier
.fillMaxSize()
.background(transparentOverlay)
.navigationBarsPadding()
.padding(horizontal = 16.dp),
) {
val (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ object PlayerPreferencesScreen : Screen {
summary = { Text(text = stringResource(id = orientation.titleRes)) },
)
}
switchPreference(
key = preferences.drawOverDisplayCutout.key(),
defaultValue = preferences.drawOverDisplayCutout.defaultValue(),
title = { Text(stringResource(R.string.pref_player_draw_over_cutout)) },
)
switchPreference(
key = preferences.doubleTapToPause.key(),
defaultValue = preferences.doubleTapToPause.defaultValue(),
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<string name="pref_player_orientation_landscape">Landscape</string>
<string name="pref_player_orientation_reverse_landscape">Reverse landscape</string>
<string name="pref_player_orientation_sensor_landscape">Sensor landscape</string>
<string name="pref_player_draw_over_cutout">Draw over display cutout</string>
<string name="pref_player_double_tap_to_pause">Double tap to pause</string>
<string name="pref_player_double_tap_to_seek">Double tap to seek</string>
<string name="pref_player_double_tap_seek_duration">Double tap seek duration</string>
Expand Down

0 comments on commit d78b30a

Please sign in to comment.