Activate menu: standardize to 2 checkboxes (#8017)

pull/8019/head
hius07 3 years ago committed by GitHub
parent 2a6931e72f
commit 45d770b131
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,55 +2,36 @@ local InfoMessage = require("ui/widget/infomessage")
local UIManager = require("ui/uimanager")
local _ = require("gettext")
local function activateMenu() return G_reader_settings:readSetting("activate_menu") end
return {
text = _("Activate menu"),
sub_item_table = {
{
text = _("Swipe and tap"),
text = _("Tap"),
checked_func = function()
local activate_menu = activateMenu()
if activate_menu == nil or activate_menu == "swipe_tap" then
return true
else
return false
end
return G_reader_settings:readSetting("activate_menu") ~= "swipe"
end,
callback = function()
G_reader_settings:saveSetting("activate_menu", "swipe_tap")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
})
end
},
{
text = _("Only swipe"),
checked_func = function()
if activateMenu() == "swipe" then
return true
if G_reader_settings:readSetting("activate_menu") ~= "swipe" then
G_reader_settings:saveSetting("activate_menu", "swipe")
else
return false
G_reader_settings:saveSetting("activate_menu", "swipe_tap")
end
end,
callback = function()
G_reader_settings:saveSetting("activate_menu", "swipe")
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
})
end
end,
},
{
text = _("Only tap"),
text = _("Swipe"),
checked_func = function()
if activateMenu() == "tap" then
return true
else
return false
end
return G_reader_settings:readSetting("activate_menu") ~= "tap"
end,
callback = function()
G_reader_settings:saveSetting("activate_menu", "tap")
if G_reader_settings:readSetting("activate_menu") ~= "tap" then
G_reader_settings:saveSetting("activate_menu", "tap")
else
G_reader_settings:saveSetting("activate_menu", "swipe_tap")
end
UIManager:show(InfoMessage:new{
text = _("This will take effect on next restart."),
})

Loading…
Cancel
Save