mirror of
https://github.com/koreader/koreader
synced 2024-11-16 06:12:56 +00:00
bump luajit-launcher and remove frontlightwidget leftovers
This commit is contained in:
parent
627716db9c
commit
9037a1f4f2
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
--]]
|
||||
|
@ -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
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e3d58c6432ba06d43bdd609c38e6315367825d7e
|
||||
Subproject commit eaa5cff5a0b0162e870792489e70434c0541ee93
|
Loading…
Reference in New Issue
Block a user