Skip to content

Commit

Permalink
Fix edge glow crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Domi04151309 committed Dec 30, 2023
1 parent 87375b1 commit 5aa7584
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ class EdgeGlowThread(
private val activity: Activity,
private val background: TransitionDrawable?,
) : Thread() {
private val transitionTime =
P.getPreferences(activity).getInt(
P.EDGE_GLOW_DURATION,
P.EDGE_GLOW_DURATION_DEFAULT,
)
private val transitionDelay =
P.getPreferences(activity).getInt(
P.EDGE_GLOW_DELAY,
P.EDGE_GLOW_DELAY_DEFAULT,
)

@JvmField
internal var notificationAvailable: Boolean = false

override fun run() {
val transitionTime =
P.getPreferences(activity).getInt(
P.EDGE_GLOW_DURATION,
P.EDGE_GLOW_DURATION_DEFAULT,
)
val transitionDelay =
P.getPreferences(activity).getInt(
P.EDGE_GLOW_DELAY,
P.EDGE_GLOW_DELAY_DEFAULT,
)
try {
while (!isInterrupted) {
if (notificationAvailable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import io.github.domi04151309.alwayson.actions.alwayson.AlwaysOn
import io.github.domi04151309.alwayson.helpers.P

class LAFBrightnessActivity : BaseActivity() {
companion object {
private const val FULL_BRIGHTNESS = 100.0
}

private lateinit var brightnessSwitch: SwitchCompat
private lateinit var seekBar: SeekBar

Expand All @@ -27,7 +31,7 @@ class LAFBrightnessActivity : BaseActivity() {
) {
// Turning this into a single statement will not work!
val attributes = window.attributes
attributes.screenBrightness = (progress / 100.0).toFloat()
attributes.screenBrightness = (progress / FULL_BRIGHTNESS).toFloat()
window.attributes = attributes
}

Expand Down

0 comments on commit 5aa7584

Please sign in to comment.