mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[screensaver] Ignore sleep screen cover conditionally (#13068)
This commit is contained in:
@@ -38,6 +38,51 @@ return {
|
||||
genMenuItem(_("Show reading progress on sleep screen"), "screensaver_type", "readingprogress", isReaderProgressEnabled),
|
||||
genMenuItem(_("Show book status on sleep screen"), "screensaver_type", "bookstatus", hasLastFile),
|
||||
genMenuItem(_("Leave screen as-is"), "screensaver_type", "disable", nil, true),
|
||||
{
|
||||
text = _("Ignore book cover"),
|
||||
help_text = _("Choose when to ignore showing book covers on the sleep screen."),
|
||||
enabled_func = function()
|
||||
return G_reader_settings:readSetting("screensaver_type") == "cover"
|
||||
end,
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("screensaver_hide_cover_in_filemanager")
|
||||
or G_reader_settings:isTrue("screensaver_exclude_finished_books")
|
||||
or G_reader_settings:isTrue("screensaver_exclude_on_hold_books")
|
||||
end,
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("For books on hold"),
|
||||
help_text = _("When the device is locked and the current book has been marked as on hold, both the cover and sleep screen message of the book will not be shown."),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("screensaver_exclude_on_hold_books")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("screensaver_exclude_on_hold_books")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("For finished books"),
|
||||
help_text = _("When the device is locked and the current book has been marked as finished, both the cover and sleep screen message of the book will not be shown."),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("screensaver_exclude_finished_books")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("screensaver_exclude_finished_books")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("When in file browser"),
|
||||
help_text = _("When the device is locked from the file browser, both the cover and sleep screen message of the last opened book will not be shown."),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("screensaver_hide_cover_in_filemanager")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("screensaver_hide_cover_in_filemanager")
|
||||
end,
|
||||
},
|
||||
},
|
||||
separator = true,
|
||||
},
|
||||
{
|
||||
text = _("Border fill, rotation, and fit"),
|
||||
enabled_func = function()
|
||||
|
||||
@@ -450,6 +450,18 @@ function Screensaver:setup(event, event_message)
|
||||
doc_settings = DocSettings:open(lastfile)
|
||||
end
|
||||
excluded = doc_settings:isTrue("exclude_screensaver")
|
||||
|
||||
local book_summary = doc_settings:readSetting("summary")
|
||||
local book_finished = book_summary and book_summary.status == "complete"
|
||||
local book_on_hold = book_summary and book_summary.status == "abandoned"
|
||||
local exclude_finished_book = G_reader_settings:isTrue("screensaver_exclude_finished_books") and book_finished
|
||||
local exclude_on_hold_book = G_reader_settings:isTrue("screensaver_exclude_on_hold_books") and book_on_hold
|
||||
local exclude_book_in_fm = not ui and G_reader_settings:isTrue("screensaver_hide_cover_in_filemanager")
|
||||
local should_exclude_book = exclude_book_in_fm or exclude_finished_book or exclude_on_hold_book
|
||||
if should_exclude_book then
|
||||
excluded = true
|
||||
self.show_message = false
|
||||
end
|
||||
else
|
||||
-- No DocSetting, not excluded
|
||||
excluded = false
|
||||
|
||||
Reference in New Issue
Block a user