mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #215 from houqp/houqp-master
check frontlight before setting intensity
This commit is contained in:
@@ -108,13 +108,12 @@ function ReaderUI:init()
|
||||
}
|
||||
table.insert(self, highlight)
|
||||
-- goto
|
||||
local goto = ReaderGoto:new{
|
||||
table.insert(self, ReaderGoto:new{
|
||||
dialog = self.dialog,
|
||||
view = self[1],
|
||||
ui = self,
|
||||
document = self.document,
|
||||
}
|
||||
table.insert(self, goto)
|
||||
})
|
||||
-- dictionary
|
||||
local dict = ReaderDictionary:new{
|
||||
dialog = self.dialog,
|
||||
@@ -130,13 +129,14 @@ function ReaderUI:init()
|
||||
ui = self
|
||||
}
|
||||
table.insert(self.active_widgets, reader_ss)
|
||||
-- frontlight controller
|
||||
local reader_fl = ReaderFrontLight:new{
|
||||
dialog = self.dialog,
|
||||
view = self[1],
|
||||
ui = self
|
||||
}
|
||||
table.insert(self, reader_fl)
|
||||
if Device:getFrontlight() then
|
||||
-- frontlight controller
|
||||
table.insert(self, ReaderFrontLight:new{
|
||||
dialog = self.dialog,
|
||||
view = self[1],
|
||||
ui = self
|
||||
})
|
||||
end
|
||||
|
||||
if self.document.info.has_pages then
|
||||
-- for page specific controller
|
||||
|
||||
@@ -156,7 +156,7 @@ local last_file = G_reader_settings:readSetting("lastfile")
|
||||
|
||||
do
|
||||
local fl = Device:getFrontlight()
|
||||
if fl.restore_settings then
|
||||
if fl and fl.restore_settings then
|
||||
local intensity = G_reader_settings:readSetting("frontlight_intensity")
|
||||
intensity = intensity or fl.intensity
|
||||
fl:setIntensity(intensity)
|
||||
|
||||
Reference in New Issue
Block a user