From f65ae9a2b5f36aa53a8f6a992f56a34ec4c78812 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 14 Aug 2013 06:34:12 -0400 Subject: [PATCH 1/2] check frontlight before setting intensity --- reader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader.lua b/reader.lua index 8da196131..b06ec77a8 100755 --- a/reader.lua +++ b/reader.lua @@ -271,7 +271,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) From ce4d62802864eb8e5829513d639e7c8d5328a9e3 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Wed, 14 Aug 2013 06:52:39 -0400 Subject: [PATCH 2/2] only insert frontlight menu item if frontlight is detected --- frontend/ui/readerui.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/ui/readerui.lua b/frontend/ui/readerui.lua index 877ccb200..171283245 100644 --- a/frontend/ui/readerui.lua +++ b/frontend/ui/readerui.lua @@ -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