mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Set global settings independent of local setting (#5522)
This commit is contained in:
committed by
Frans de Jonge
parent
6c68df42ec
commit
aa165cefe9
@@ -1,10 +1,10 @@
|
||||
local ButtonDialog = require("ui/widget/buttondialog")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local Device = require("device")
|
||||
local Event = require("ui/event")
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
local Notification = require("ui/widget/notification")
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local MultiConfirmBox = require("ui/widget/multiconfirmbox")
|
||||
local Notification = require("ui/widget/notification")
|
||||
local TimeVal = require("ui/timeval")
|
||||
local Translator = require("ui/translator")
|
||||
local UIManager = require("ui/uimanager")
|
||||
@@ -116,7 +116,7 @@ function ReaderHighlight:genHighlightDrawerMenu()
|
||||
self.view.highlight.disabled = not self.view.highlight.disabled
|
||||
end,
|
||||
hold_callback = function(touchmenu_instance)
|
||||
self:makeDefault(not self.view.highlight.disabled)
|
||||
self:toggleDefault()
|
||||
end,
|
||||
separator = true,
|
||||
},
|
||||
@@ -1179,17 +1179,24 @@ function ReaderHighlight:onClose()
|
||||
self:clear()
|
||||
end
|
||||
|
||||
function ReaderHighlight:makeDefault(highlight_disabled)
|
||||
local new_text
|
||||
if highlight_disabled then
|
||||
new_text = _("Disable highlight by default.")
|
||||
else
|
||||
new_text = _("Enable highlight by default.")
|
||||
end
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = new_text,
|
||||
ok_callback = function()
|
||||
G_reader_settings:saveSetting("highlight_disabled", highlight_disabled)
|
||||
function ReaderHighlight:toggleDefault()
|
||||
local highlight_disabled = G_reader_settings:isTrue("highlight_disabled")
|
||||
UIManager:show(MultiConfirmBox:new{
|
||||
text = highlight_disabled and _("Would you like to enable or disable highlighting by default?\n\nThe current default (★) is disabled.")
|
||||
or _("Would you like to enable or disable highlighting by default?\n\nThe current default (★) is enabled."),
|
||||
choice1_text_func = function()
|
||||
return highlight_disabled and _("Disable (★)") or _("Disable")
|
||||
end,
|
||||
choice1_enabled = not highlight_disabled,
|
||||
choice1_callback = function()
|
||||
G_reader_settings:saveSetting("highlight_disabled", true)
|
||||
end,
|
||||
choice2_text_func = function()
|
||||
return highlight_disabled and _("Enable") or _("Enable (★)")
|
||||
end,
|
||||
choice2_enabled = highlight_disabled,
|
||||
choice2_callback = function()
|
||||
G_reader_settings:saveSetting("highlight_disabled", false)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user