mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Synchronise frontlight level with nickel config
* Drops support for mocking the frontlight setting internally which may cause incorrect in-memory values. * Adds new supported value for `KOBO_LIGHT_ON_START` (-2), which sets 'Kobo eReader.conf' as the source to update `settings.reader.lua`'s brightness setting on startup, thus using the value from it indirectly. * Adds the `KOBO_SYNC_BRIGHTNESS_WITH_NICKEL` configuration variable which updates 'Kobo eReader.conf' every time the brightness setting is changed within koreader. * Fixes missing call to save brightness when modifying via two-finger swipe. Closes #1523.
This commit is contained in:
@@ -46,10 +46,14 @@ function ReaderFrontLight:onAdjust(arg, ges)
|
||||
DEBUG("step = ", step)
|
||||
local delta_int = self.steps[step] or self.steps[#self.steps]
|
||||
DEBUG("delta_int = ", delta_int)
|
||||
local new_intensity
|
||||
if ges.direction == "north" then
|
||||
powerd:setIntensity(powerd.flIntensity + delta_int)
|
||||
new_intensity = powerd.flIntensity + delta_int
|
||||
elseif ges.direction == "south" then
|
||||
powerd:setIntensity(powerd.flIntensity - delta_int)
|
||||
new_intensity = powerd.flIntensity - delta_int
|
||||
end
|
||||
if new_intensity ~= nil then
|
||||
powerd:setIntensity(new_intensity)
|
||||
end
|
||||
end
|
||||
return true
|
||||
@@ -121,7 +125,6 @@ end
|
||||
|
||||
function ReaderFrontLight:close()
|
||||
self.fl_dialog:onClose()
|
||||
G_reader_settings:saveSetting("frontlight_intensity", Device:getPowerDevice().flIntensity)
|
||||
UIManager:close(self.fl_dialog)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user