mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Frontlight - Add checkbox use system settings (#5307)
See: https://github.com/koreader/koreader/issues/5205#issuecomment-526935357 Devices with `hasLightLevelFallback = true` (for now Android) has extra checkbutton `Use system settings`. Default unchecked.
This commit is contained in:
@@ -66,6 +66,7 @@ local Device = Generic:new{
|
||||
hasEinkScreen = function() return android.isEink() end,
|
||||
hasColorScreen = function() return not android.isEink() end,
|
||||
hasFrontlight = yes,
|
||||
hasLightLevelFallback = yes,
|
||||
canRestart = no,
|
||||
firmware_rev = android.app.activity.sdkVersion,
|
||||
display_dpi = android.lib.AConfiguration_getDensity(android.app.config),
|
||||
@@ -194,6 +195,12 @@ function Device:init()
|
||||
android.setVolumeKeysIgnored(true);
|
||||
end
|
||||
|
||||
-- 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
|
||||
|
||||
@@ -233,6 +240,10 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user