2023-08-11 21:58:00 +00:00
|
|
|
local Device = require("device")
|
|
|
|
local Event = require("ui/event")
|
|
|
|
local UIManager = require("ui/uimanager")
|
|
|
|
local _ = require("gettext")
|
|
|
|
|
2023-08-11 22:53:11 +00:00
|
|
|
-- This whole menu is hidden behind a hasKeys device cap.
|
2023-08-12 01:15:11 +00:00
|
|
|
local PhysicalButtons = {
|
|
|
|
text = _("Physical buttons"), -- Mainly so as to differentiate w/ "Page Turns" when in readermenu...
|
2023-08-11 22:03:36 +00:00
|
|
|
sub_item_table = {
|
|
|
|
{
|
|
|
|
text = _("Invert page turn buttons"),
|
|
|
|
checked_func = function()
|
|
|
|
return G_reader_settings:isTrue("input_invert_page_turn_keys")
|
|
|
|
end,
|
|
|
|
callback = function()
|
|
|
|
UIManager:broadcastEvent(Event:new("SwapPageTurnButtons"))
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
},
|
2023-08-11 21:58:00 +00:00
|
|
|
}
|
|
|
|
|
2023-08-11 22:34:29 +00:00
|
|
|
if Device:canKeyRepeat() then
|
2023-08-12 01:15:11 +00:00
|
|
|
table.insert(PhysicalButtons.sub_item_table, {
|
|
|
|
text = _("Disable key repeat"),
|
2023-08-11 22:34:29 +00:00
|
|
|
help_text = _("Useful if you don't like the behavior or if your device has faulty switches"),
|
|
|
|
checked_func = function()
|
2023-08-12 01:15:11 +00:00
|
|
|
return G_reader_settings:isTrue("input_no_key_repeat")
|
2023-08-11 22:34:29 +00:00
|
|
|
end,
|
|
|
|
callback = function()
|
|
|
|
UIManager:broadcastEvent(Event:new("ToggleKeyRepeat"))
|
|
|
|
end,
|
|
|
|
separator = true,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2023-08-12 01:15:11 +00:00
|
|
|
return PhysicalButtons
|