Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly less crappy Nightmode #4871

Merged
merged 37 commits into from Apr 8, 2019
Merged
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c43780
Add a toast to mention that toggling sleepcover requires a restart
NiLuJe Apr 3, 2019
6baa8dc
Use isTrue instead of a raw readSettings
NiLuJe Apr 3, 2019
ee45d0c
Flip those, too.
NiLuJe Apr 3, 2019
5588aff
Add a canHWInvert capa for devices
NiLuJe Apr 3, 2019
02952c2
Drop the redundant bits ;)
NiLuJe Apr 3, 2019
dc6880b
Not actually a color space, more of a pixel format, so this is slightly
NiLuJe Apr 3, 2019
24aeb3f
Those ovverrides are redundant
NiLuJe Apr 4, 2019
5b70446
Frontlight refinements...
NiLuJe Apr 5, 2019
3ee5b8d
Okay, on Kobo w/ only ioctl, need to sleep, ioctls are too fast
NiLuJe Apr 5, 2019
bae7690
Move the ramping FL toggle to Kobo-only
NiLuJe Apr 5, 2019
a3586a8
Fix setWarmth/setBrightness for non-mixer devices, too.
NiLuJe Apr 5, 2019
bdc39b6
Kill debug
NiLuJe Apr 5, 2019
b56ccb4
Revert that double-check from the generic code.
NiLuJe Apr 5, 2019
6a37c7c
Fix frontlight test
NiLuJe Apr 5, 2019
e4f6bce
Possibly fix AutofrontLight test
NiLuJe Apr 5, 2019
e72ff08
:?
NiLuJe Apr 5, 2019
0901e22
-_-"
NiLuJe Apr 5, 2019
98173f2
>_<"
NiLuJe Apr 5, 2019
967250d
This makes no sense, whooohoo.
NiLuJe Apr 5, 2019
4a810b2
Slightly less insane
NiLuJe Apr 5, 2019
b68a084
Okay, my bad.
NiLuJe Apr 5, 2019
ed06337
O_O
NiLuJe Apr 5, 2019
58ab66d
Okay, it's vaguely starting to make sense.
NiLuJe Apr 5, 2019
6811eab
Okay, better without magic numbers coming form wherever.
NiLuJe Apr 5, 2019
35df686
. -> :
NiLuJe Apr 5, 2019
3354ca2
Bis
NiLuJe Apr 5, 2019
f7c005d
Hulk. Smash.
NiLuJe Apr 5, 2019
71118f9
:!
NiLuJe Apr 5, 2019
1eaf58a
"#_#
NiLuJe Apr 5, 2019
08b22be
{X}_{x}
NiLuJe Apr 5, 2019
64d8d01
NiLuJe Apr 5, 2019
e3506d0
:|
NiLuJe Apr 5, 2019
9dea2d7
~_~
NiLuJe Apr 5, 2019
216742b
I'm going to go cry in a corner.
NiLuJe Apr 5, 2019
f107549
Unbreak Clippy
NiLuJe Apr 5, 2019
c80d075
Okay, this passes.
NiLuJe Apr 5, 2019
daec8cd
Bump base to pickup matching nightmode changes.
NiLuJe Apr 8, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -703,7 +703,7 @@ function ReaderGesture:gestureAction(action, ges)
elseif action == "toc" then
self.ui:handleEvent(Event:new("ShowToc"))
elseif action == "night_mode" then
local night_mode = G_reader_settings:readSetting("night_mode") or false
local night_mode = G_reader_settings:isTrue("night_mode") or false
This conversation was marked as resolved by NiLuJe

This comment has been minimized.

Copy link
@Frenzie

Frenzie Apr 3, 2019

Member

Redundant or false? ;-)

This comment has been minimized.

Copy link
@NiLuJe

NiLuJe Apr 3, 2019

Author Member

Indeed, thanks ;).

Screen:toggleNightMode()
UIManager:setDirty("all", "full")
G_reader_settings:saveSetting("night_mode", not night_mode)
@@ -31,6 +31,7 @@ local Device = {
hasClipboard = yes, -- generic internal clipboard on all devices
hasEinkScreen = yes,
canHWDither = no,
canHWInvert = no,
hasColorScreen = no,
hasBGRFrameBuffer = no,
canToggleGSensor = no,
@@ -75,6 +75,8 @@ local Kindle = Generic:new{
-- NOTE: We can cheat by adding a platform-specific entry here, because the only code that will check for this is here.
isSpecialOffers = isSpecialOffers(),
hasOTAUpdates = yes,
-- NOTE: HW inversion is generally safe on mxcfb Kindles
canHWInvert = yes,
}

function Kindle:initNetworkManager(NetworkMgr)
@@ -206,26 +208,30 @@ local Kindle2 = Kindle:new{
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local KindleDXG = Kindle:new{
model = "KindleDXG",
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local Kindle3 = Kindle:new{
model = "Kindle3",
hasKeyboard = yes,
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local Kindle4 = Kindle:new{
model = "Kindle4",
hasKeys = yes,
hasDPad = yes,
canHWInvert = no,
}

local KindleTouch = Kindle:new{
@@ -38,6 +38,8 @@ local Kobo = Generic:new{
internal_storage_mount_point = "/mnt/onboard/",
-- currently only the Aura One and Forma have coloured frontlights
hasNaturalLight = no,
-- HW inversion is generally safe on Kobo, except on a few baords/kernels
canHWInvert = yes,
}

-- TODO: hasKeys for some devices?
@@ -114,6 +116,8 @@ local KoboPhoenix = Kobo:new{
display_dpi = 212,
-- the bezel covers 12 pixels at the bottom:
viewport = Geom:new{x=0, y=0, w=758, h=1012},
-- NOTE: May have a buggy kernel, according to the nightmode hack...
canHWInvert = no,
}

-- Kobo Aura H2O2:
@@ -114,15 +114,18 @@ if Device:isKobo() then
end,
callback = function()
G_reader_settings:flipNilOrFalse("ignore_power_sleepcover")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
})
end
}
end

common_settings.night_mode = {
text = _("Night mode"),
checked_func = function() return G_reader_settings:readSetting("night_mode") end,
checked_func = function() return G_reader_settings:isTrue("night_mode") end,
callback = function()
local night_mode = G_reader_settings:readSetting("night_mode") or false
local night_mode = G_reader_settings:isTrue("night_mode") or false
Screen:toggleNightMode()
UIManager:setDirty(nil, "full")
G_reader_settings:saveSetting("night_mode", not night_mode)
@@ -170,7 +170,7 @@ elseif not QuickStart:isShown() then
last_file = QuickStart:getQuickStart()
end
-- night mode
if G_reader_settings:readSetting("night_mode") then
if G_reader_settings:isTrue("night_mode") then
Device.screen:toggleNightMode()
end

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.