Skip to content

Commit

Permalink
Fix brightness issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Dec 30, 2023
1 parent 808408d commit 4b2985b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ class AlwaysOn : OffActivity(), NotificationService.OnNotificationsChangedListen

// Brightness
if (prefs.get(P.FORCE_BRIGHTNESS, P.FORCE_BRIGHTNESS_DEFAULT)) {
window.attributes.screenBrightness =
prefs.get(
P.FORCE_BRIGHTNESS_VALUE,
P.FORCE_BRIGHTNESS_VALUE_DEFAULT,
) / 255.toFloat()
// Turning this into a single statement will not work!
val attributes = window.attributes
attributes.screenBrightness = prefs.get(
P.FORCE_BRIGHTNESS_VALUE,
P.FORCE_BRIGHTNESS_VALUE_DEFAULT,
) / 255.toFloat()
window.attributes = attributes
}

// Show on lock screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class LAFBrightnessActivity : AppCompatActivity() {
progress: Int,
fromUser: Boolean,
) {
window.attributes.screenBrightness = progress / 255.toFloat()
// Turning this into a single statement will not work!
val attributes = window.attributes
attributes.screenBrightness = (progress / 100.0).toFloat()
window.attributes = attributes
}

override fun onStartTrackingTouch(seekBar: SeekBar) {
Expand Down

0 comments on commit 4b2985b

Please sign in to comment.