Skip to content

Commit 49d83e5

Browse files
committed
fix(player): unlock brightness control after disposing player screen [attempt 1]
1 parent 46e0d19 commit 49d83e5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

feature/mobile/player/src/main/java/com/flixclusive/feature/mobile/player/PlayerScreen.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,12 @@ internal fun PlayerScreen(
272272
context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
273273
context.toggleSystemBars(isVisible = false)
274274

275-
// Initialize brightness
276-
val userDefaultBrightnessLevel = brightnessManager.currentBrightness
277-
278275
onDispose {
279276
// Lock the screen to landscape only if we're just changing
280277
// episodes. This is really bad code bruh.
281278
if (!isChangingEpisode) {
282279
context.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
283-
brightnessManager.setBrightness(userDefaultBrightnessLevel)
280+
brightnessManager.unlockBrightnessControl()
284281
context.toggleSystemBars(isVisible = true)
285282
}
286283

feature/mobile/player/src/main/java/com/flixclusive/feature/mobile/player/util/BrightnessManager.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@ internal class BrightnessManager(private val activity: Activity) {
2929
layoutParams.screenBrightness = currentBrightness
3030
activity.window.attributes = layoutParams
3131
}
32-
}
32+
33+
fun unlockBrightnessControl() {
34+
val layoutParams = activity.window.attributes
35+
layoutParams.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE
36+
activity.window.attributes = layoutParams
37+
}
38+
}

0 commit comments

Comments
 (0)