Skip to content

Commit

Permalink
fix brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
regulad committed Oct 24, 2024
1 parent e9d2cd9 commit 118f31b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "xyz.regulad"
version = "1.4.1"
version = "1.4.2"

nexusPublishing {
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ fun WithBrightness(brightness: Float) {
val activity = (context as? Activity) ?: return

DisposableEffect(brightness) {
activity.window.attributes.screenBrightness = brightness
val attrs = activity.window.attributes
attrs.screenBrightness = brightness
activity.window.attributes = attrs

onDispose {
activity.window.attributes.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE
val attrs2 = activity.window.attributes
attrs2.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE
activity.window.attributes = attrs2
}
}
}
Expand Down

0 comments on commit 118f31b

Please sign in to comment.