Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Screen off prevention On Full Screen player #714

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import android.view.WindowManager
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
Expand Down Expand Up @@ -138,6 +139,9 @@ fun FullscreenPlayer(
val insetsController = WindowCompat.getInsetsController(window, window.decorView)

onDispose {

window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

insetsController.apply {
show(WindowInsetsCompat.Type.systemBars())
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_DEFAULT
Expand All @@ -152,6 +156,9 @@ fun FullscreenPlayer(
LaunchedEffect(true) {
val activity = context.findActivity()
val window = activity.window

window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)

val insetsController = WindowCompat.getInsetsController(window, window.decorView)
insetsController.apply {
hide(WindowInsetsCompat.Type.systemBars())
Expand Down