Partial fix for 3477 (#3568)

Partial, as it will safe the state when suspending the reader by pressing the power-button.

However, it will still not safe the state when Pocketbooks autoPowerOff-Feature kicks in, as this does not create an event (e.g. no EVT_BACKGROUND) of any kind.

* Clean up device.lua

* Save state on suspend
This commit is contained in:
Fabian Müller-Knapp
2018-01-06 13:14:26 +01:00
committed by Frans de Jonge
parent 22a8cfde7c
commit 88c03c08d1
2 changed files with 53 additions and 84 deletions

View File

@@ -74,6 +74,16 @@ function UIManager:init()
Device:reboot()
end)
end
if Device:isPocketBook() then
self.event_handlers["Suspend"] = function()
self:_beforeSuspend()
Device:onPowerEvent("Power")
end
self.event_handlers["Resume"] = function()
Device:onPowerEvent("Power")
self:_afterResume()
end
end
if Device:isKobo() then
-- We do not want auto suspend procedure to waste battery during
-- suspend. So let's unschedule it when suspending, and restart it after