Refactor Kobo frontlight_intensity restoration: move to reader.lua

pull/212/head
Paulo Matias 11 years ago
parent f68edd97ba
commit e45442c1f6

@ -19,7 +19,8 @@ KindleFrontLight = {
KoboFrontLight = { KoboFrontLight = {
min = 1, max = 100, min = 1, max = 100,
intensity = nil, intensity = 20,
restore_settings = true,
fl = nil, fl = nil,
} }
@ -227,11 +228,6 @@ end
function KoboFrontLight:init() function KoboFrontLight:init()
self.fl = kobolight.open() self.fl = kobolight.open()
self.intensity = G_reader_settings:readSetting("frontlight_intensity")
if not self.intensity then
self.intensity = 20
end
self:setIntensity(self.intensity)
end end
function KoboFrontLight:toggle() function KoboFrontLight:toggle()

@ -264,7 +264,6 @@ function Input:init()
if Device:isTouchDevice() then if Device:isTouchDevice() then
self:initTouchState() self:initTouchState()
end end
Device:getFrontlight() -- forces initialization
-- set up fake event map -- set up fake event map
self.event_map[10000] = "IntoSS" -- go into screen saver self.event_map[10000] = "IntoSS" -- go into screen saver
self.event_map[10001] = "OutOfSS" -- go out of screen saver self.event_map[10001] = "OutOfSS" -- go out of screen saver

@ -269,6 +269,14 @@ local last_file = G_reader_settings:readSetting("lastfile")
--@TODO we can read version here, refer to commit in master tree: (houqp) --@TODO we can read version here, refer to commit in master tree: (houqp)
--87712cf0e43fed624f8a9f610be42b1fe174b9fe --87712cf0e43fed624f8a9f610be42b1fe174b9fe
do
local fl = Device:getFrontlight()
if fl.restore_settings then
local intensity = G_reader_settings:readSetting("frontlight_intensity")
intensity = intensity or fl.intensity
fl:setIntensity(intensity)
end
end
if ARGV[argidx] and ARGV[argidx] ~= "" then if ARGV[argidx] and ARGV[argidx] ~= "" then
if lfs.attributes(ARGV[argidx], "mode") == "directory" then if lfs.attributes(ARGV[argidx], "mode") == "directory" then

Loading…
Cancel
Save