mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Ignore the accelerometer while we're sleeping on Kobo
It might cause unwanted wakeups, and even it it doesn't, it just feels and looks stupid ;).
This commit is contained in:
@@ -91,14 +91,22 @@ function UIManager:init()
|
||||
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
|
||||
-- resume.
|
||||
-- resume. Done via the plugin's onSuspend/onResume handlers.
|
||||
self.event_handlers["Suspend"] = function()
|
||||
-- Ignore the accelerometer (if that's not already the case) while we're alseep
|
||||
if G_reader_settings:nilOrFalse("input_ignore_gsensor") then
|
||||
Device:toggleGSensor()
|
||||
end
|
||||
self:_beforeSuspend()
|
||||
Device:onPowerEvent("Suspend")
|
||||
end
|
||||
self.event_handlers["Resume"] = function()
|
||||
Device:onPowerEvent("Resume")
|
||||
self:_afterResume()
|
||||
-- Stop ignoring the accelerometer (unless requested) when we wakeup
|
||||
if G_reader_settings:nilOrFalse("input_ignore_gsensor") then
|
||||
Device:toggleGSensor()
|
||||
end
|
||||
end
|
||||
self.event_handlers["PowerPress"] = function()
|
||||
UIManager:scheduleIn(2, self.poweroff_action)
|
||||
|
||||
Reference in New Issue
Block a user