2
0
mirror of https://github.com/koreader/koreader synced 2024-11-11 19:11:14 +00:00
koreader/frontend/ui/elements/screen_toggle_gsensor.lua
NiLuJe 38e7975728
More robust Gyro toggle (#5104)
* Make toggling Gyro events more robust

Actually ask to turn it on/off depending on the setting, instead of a
blind toggle

A quick succession of suspend/resume events could otherwise leave it
in an unexpected state (i.e., off when it should have been on).
2019-07-01 17:12:24 +02:00

14 lines
414 B
Lua

local Device = require("device")
local _ = require("gettext")
return {
text = _("Ignore accelerometer rotation events"),
checked_func = function()
return G_reader_settings:isTrue("input_ignore_gsensor")
end,
callback = function()
G_reader_settings:flipNilOrFalse("input_ignore_gsensor")
Device:toggleGSensor(not G_reader_settings:isTrue("input_ignore_gsensor"))
end,
}