2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

[AutoWarmth] Delay front light actions after resume (#12315)

This commit is contained in:
zwim 2024-08-09 19:42:13 +02:00 committed by GitHub
parent 2d2921032d
commit 92de5821bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -428,14 +428,16 @@ function AutoWarmth:setFrontlight(enable, keep_user_toggle)
return
end
if enable then
Powerd:turnOnFrontlight()
AutoWarmth.fl_turned_off = false
else
Powerd:turnOffFrontlight()
AutoWarmth.fl_turned_off = true
UIManager:broadcastEvent(Event:new("FrontlightTurnedOff")) -- used e.g. in AutoDim
end
UIManager:scheduleIn(0.01, function()
if enable then
Powerd:turnOnFrontlight()
AutoWarmth.fl_turned_off = false
else
Powerd:turnOffFrontlight()
AutoWarmth.fl_turned_off = true
UIManager:broadcastEvent(Event:new("FrontlightTurnedOff")) -- used e.g. in AutoDim
end
end)
end
-- toggles Frontlight on or off, depending on `now_s`