From 9037a1f4f28f5bc77d6ac74249b57538f643c9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fdez?= Date: Thu, 6 Aug 2020 13:14:29 +0200 Subject: [PATCH] bump luajit-launcher and remove frontlightwidget leftovers --- frontend/device/android/device.lua | 13 -------- frontend/device/devicelistener.lua | 25 +--------------- frontend/device/generic/device.lua | 4 --- frontend/ui/widget/frontlightwidget.lua | 40 ++++--------------------- platform/android/luajit-launcher | 2 +- 5 files changed, 8 insertions(+), 76 deletions(-) diff --git a/frontend/device/android/device.lua b/frontend/device/android/device.lua index c5f932b65..b4206ad7e 100644 --- a/frontend/device/android/device.lua +++ b/frontend/device/android/device.lua @@ -73,7 +73,6 @@ local Device = Generic:new{ hasColorScreen = function() return not android.isEink() end, hasFrontlight = yes, hasNaturalLight = android.isWarmthDevice, - hasLightLevelFallback = yes, canRestart = no, canSuspend = no, firmware_rev = android.app.activity.sdkVersion, @@ -245,14 +244,6 @@ function Device:init() android.setBackButtonIgnored(true) end - --- @todo remove fl_last_level and revert hasLightFallback if frontlightwidget - - -- check if we enable a custom light level for this activity - --local last_value = G_reader_settings:readSetting("fl_last_level") - --if type(last_value) == "number" and last_value >= 0 then - -- Device:setScreenBrightness(last_value) - --end - Generic.init(self) end @@ -311,10 +302,6 @@ function Device:setViewport(x,y,w,h) self.screen:setViewport(viewport) end -function Device:setScreenBrightness(level) - android.setScreenBrightness(level) -end - function Device:toggleFullscreen() local api = android.app.activity.sdkVersion if api >= 19 then diff --git a/frontend/device/devicelistener.lua b/frontend/device/devicelistener.lua index 4bf80002c..850e053d5 100644 --- a/frontend/device/devicelistener.lua +++ b/frontend/device/devicelistener.lua @@ -28,10 +28,6 @@ function DeviceListener:onSetNightMode(night_mode_on) end end -local function lightFrontlight() - return Device:hasLightLevelFallback() and G_reader_settings:nilOrTrue("light_fallback") -end - function DeviceListener:onShowIntensity() if not Device:hasFrontlight() then return true end local powerd = Device:getPowerDevice() @@ -142,15 +138,6 @@ if Device:hasFrontlight() then -- direction +1 - increase frontlight warmth -- direction -1 - decrease frontlight warmth function DeviceListener:onChangeFlWarmth(ges, direction) - -- when using frontlight system settings - if lightFrontlight() then - UIManager:show(Notification:new{ - text = _("Frontlight controlled by system settings."), - timeout = 2.5, - }) - return true - end - local powerd = Device:getPowerDevice() if powerd.fl_warmth == nil then return false end @@ -233,14 +220,6 @@ if Device:hasFrontlight() then end function DeviceListener:onToggleFrontlight() - -- when using frontlight system settings - if lightFrontlight() then - UIManager:show(Notification:new{ - text = _("Frontlight controlled by system settings."), - timeout = 2.5, - }) - return true - end local powerd = Device:getPowerDevice() powerd:toggleFrontlight() local new_text @@ -258,9 +237,7 @@ if Device:hasFrontlight() then function DeviceListener:onShowFlDialog() local FrontLightWidget = require("ui/widget/frontlightwidget") - UIManager:show(FrontLightWidget:new{ - use_system_fl = Device:hasLightLevelFallback() - }) + UIManager:show(FrontLightWidget:new{}) end end diff --git a/frontend/device/generic/device.lua b/frontend/device/generic/device.lua index 8181f1b6a..e2e56e23e 100644 --- a/frontend/device/generic/device.lua +++ b/frontend/device/generic/device.lua @@ -39,7 +39,6 @@ local Device = { isHapticFeedbackEnabled = no, isTouchDevice = no, hasFrontlight = no, - hasLightLevelFallback = no, hasNaturalLight = no, -- FL warmth implementation specific to NTX boards (Kobo, Cervantes) hasNaturalLightMixer = no, -- Same, but only found on newer boards needsTouchScreenProbe = no, @@ -368,9 +367,6 @@ function Device:lockGSensor(toggle) end end --- Device specific method for set custom light levels -function Device:setScreenBrightness(level) end - --[[ prepare for application shutdown --]] diff --git a/frontend/ui/widget/frontlightwidget.lua b/frontend/ui/widget/frontlightwidget.lua index f37eccaca..0560fd55d 100644 --- a/frontend/ui/widget/frontlightwidget.lua +++ b/frontend/ui/widget/frontlightwidget.lua @@ -33,13 +33,11 @@ local FrontLightWidget = InputContainer:new{ height = nil, -- This should stay active during natural light configuration is_always_active = true, - use_system_fl = false, rate = Screen.low_pan_rate and 3 or 30, -- Widget update rate. last_time = TimeVal:new{}, -- Tracks last update time to prevent update spamming. } function FrontLightWidget:init() - self.light_fallback = self.use_system_fl and G_reader_settings:nilOrTrue("light_fallback") self.medium_font_face = Font:getFace("ffont") self.larger_font_face = Font:getFace("cfont") self.light_bar = {} @@ -82,7 +80,7 @@ function FrontLightWidget:init() margin = button_margin, padding = button_padding, bordersize = button_bordersize, - enabled = not self.light_fallback, + enabled = true, width = self.button_width, show_parent = self, } @@ -132,7 +130,6 @@ function FrontLightWidget:setProgress(num, step, num_warmth) local button_group_down = HorizontalGroup:new{ align = "center" } local button_group_up = HorizontalGroup:new{ align = "center" } local vertical_group = VerticalGroup:new{ align = "center" } - self.fl_prog_button.enabled = not self.light_fallback local enable_button_plus = true local enable_button_minus = true if self.natural_light then @@ -173,7 +170,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth) text = "-1", margin = Size.margin.small, radius = 0, - enabled = enable_button_minus and not self.light_fallback, + enabled = enable_button_minus, width = math.floor(self.screen_width * 0.2), show_parent = self, callback = function() self:setProgress(self.fl_cur - 1, step) end, @@ -182,7 +179,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth) text = "+1", margin = Size.margin.small, radius = 0, - enabled = enable_button_plus and not self.light_fallback, + enabled = enable_button_plus, width = math.floor(self.screen_width * 0.2), show_parent = self, callback = function() self:setProgress(self.fl_cur + 1, step) end, @@ -197,7 +194,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth) text = _("Min"), margin = Size.margin.small, radius = 0, - enabled = not self.light_fallback, + enabled = true, width = math.floor(self.screen_width * 0.2), show_parent = self, callback = function() self:setProgress(self.fl_min+1, step) end, -- min is 1 (use toggle for 0) @@ -206,7 +203,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth) text = _("Max"), margin = Size.margin.small, radius = 0, - enabled = not self.light_fallback, + enabled = true, width = math.floor(self.screen_width * 0.2), show_parent = self, callback = function() self:setProgress(self.fl_max, step) end, @@ -215,7 +212,7 @@ function FrontLightWidget:setProgress(num, step, num_warmth) text = _("Toggle"), margin = Size.margin.small, radius = 0, - enabled = not self.light_fallback, + enabled = true, width = math.floor(self.screen_width * 0.2), show_parent = self, callback = function() @@ -244,20 +241,6 @@ function FrontLightWidget:setProgress(num, step, num_warmth) -- widgets below. table.insert(vertical_group, text_br) end - local system_level_checkbutton - system_level_checkbutton = CheckButton:new{ - text = _("Use system settings"), - checked = self.light_fallback, - callback = function() - if system_level_checkbutton.checked then - self.light_fallback = false - else - self.light_fallback = true - end - G_reader_settings:saveSetting("light_fallback", self.light_fallback) - self:setProgress(self.fl_cur, step) - end, - } table.insert(button_group_up, button_table_up) table.insert(button_group_down, button_table_down) table.insert(vertical_group, padding_span) @@ -267,10 +250,6 @@ function FrontLightWidget:setProgress(num, step, num_warmth) table.insert(vertical_group, padding_span) table.insert(vertical_group, button_group_down) table.insert(vertical_group, padding_span) - if self.use_system_fl then - table.insert(vertical_group, system_level_checkbutton) - table.insert(vertical_group, padding_span) - end if self.natural_light then -- If the device supports natural light, add the widgets for 'warmth', -- as well as a 'Configure' button for devices *without* a mixer @@ -520,13 +499,6 @@ function FrontLightWidget:setFrontLightIntensity(num) self.powerd:setIntensity(set_fl) end - if not self.light_fallback and self.fl_cur >= 0 then - G_reader_settings:saveSetting("fl_last_level", self.fl_cur * 10) - elseif self.light_fallback then - G_reader_settings:saveSetting("fl_last_level", nil) - Device:setScreenBrightness(-1) - end - -- get back the real level (different from set_fl if untoggle) self.fl_cur = self.powerd:frontlightIntensity() end diff --git a/platform/android/luajit-launcher b/platform/android/luajit-launcher index e3d58c643..eaa5cff5a 160000 --- a/platform/android/luajit-launcher +++ b/platform/android/luajit-launcher @@ -1 +1 @@ -Subproject commit e3d58c6432ba06d43bdd609c38e6315367825d7e +Subproject commit eaa5cff5a0b0162e870792489e70434c0541ee93