mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Navigation settings for all devices (#4680)
Before multiswipes and the gesture manager this was impractical on touch-only devices, but no more! Also includes some minor textual clarifications on some of the settings.
This commit is contained in:
@@ -24,6 +24,7 @@ local action_strings = {
|
||||
page_jmp_fwd_10 = _("Forward 10 pages"),
|
||||
page_jmp_fwd_1 = _("Next page"),
|
||||
skim = _("Skim"),
|
||||
back = _("Back"),
|
||||
previous_location = _("Back to previous location"),
|
||||
latest_bookmark = _("Go to latest bookmark"),
|
||||
|
||||
@@ -101,6 +102,7 @@ function ReaderGesture:init()
|
||||
multiswipe_east_north = "history",
|
||||
multiswipe_south_north = "skim",
|
||||
multiswipe_south_west = "show_frontlight_dialog",
|
||||
multiswipe_west_south = "back",
|
||||
multiswipe_west_east_west = "open_previous_document",
|
||||
multiswipe_east_north_west = "zoom_contentwidth",
|
||||
multiswipe_south_east_north = "zoom_contentheight",
|
||||
@@ -242,6 +244,7 @@ function ReaderGesture:buildMenu(ges, default)
|
||||
{"page_jmp_fwd_10", not self.is_docless},
|
||||
{"page_jmp_fwd_1", not self.is_docless},
|
||||
{"skim", not self.is_docless},
|
||||
{"back", true},
|
||||
{"previous_location", not self.is_docless},
|
||||
{"latest_bookmark", not self.is_docless, true},
|
||||
|
||||
@@ -506,6 +509,8 @@ function ReaderGesture:gestureAction(action)
|
||||
self:pageUpdate(-1)
|
||||
elseif action == "skim" then
|
||||
self.ui:handleEvent(Event:new("ShowSkimtoDialog"))
|
||||
elseif action == "back" then
|
||||
self.ui:handleEvent(Event:new("Back"))
|
||||
elseif action == "previous_location" then
|
||||
self.ui:handleEvent(Event:new("GoBackLink"))
|
||||
elseif action == "latest_bookmark" then
|
||||
|
||||
@@ -165,92 +165,104 @@ if Device:isTouchDevice() then
|
||||
}
|
||||
end
|
||||
|
||||
common_settings.navigation = {
|
||||
text = _("Navigation"),
|
||||
}
|
||||
local back_to_exit_str = {
|
||||
prompt = {_("Prompt"), _("prompt")},
|
||||
always = {_("Always"), _("always")},
|
||||
disable ={_("Disable"), _("disable")},
|
||||
}
|
||||
common_settings.back_to_exit = {
|
||||
text_func = function()
|
||||
local back_to_exit = G_reader_settings:readSetting("back_to_exit") or "prompt"
|
||||
return T(_("Back to exit (%1)"),
|
||||
back_to_exit_str[back_to_exit][2])
|
||||
end,
|
||||
sub_item_table = {
|
||||
{
|
||||
text = back_to_exit_str.prompt[1],
|
||||
checked_func = function()
|
||||
local setting = G_reader_settings:readSetting("back_to_exit")
|
||||
return setting == "prompt" or setting == nil
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "prompt")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = back_to_exit_str.always[1],
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_to_exit")
|
||||
== "always"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "always")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = back_to_exit_str.disable[1],
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_to_exit")
|
||||
== "disable"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "disable")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
common_settings.back_in_filemanager = {
|
||||
text = _("Back in file browser"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text_func = function()
|
||||
local back_to_exit = G_reader_settings:readSetting("back_to_exit") or "prompt"
|
||||
return T(_("Back to exit (%1)"),
|
||||
back_to_exit_str[back_to_exit][2])
|
||||
end,
|
||||
checked_func = function()
|
||||
local back_in_filemanager = G_reader_settings:readSetting("back_in_filemanager")
|
||||
return back_in_filemanager == nil or back_in_filemanager == "default"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_filemanager", "default")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Go to parent folder"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_in_filemanager")
|
||||
== "parent_folder"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_filemanager", "parent_folder")
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
common_settings.enable_back_history = {
|
||||
text = _("Enable back history"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:nilOrTrue("enable_back_history")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrTrue("enable_back_history")
|
||||
end,
|
||||
}
|
||||
if Device:hasKeys() then
|
||||
common_settings.navigation = {
|
||||
text = _("Navigation"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("Back key to exit KOReader"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("Prompt"),
|
||||
checked_func = function()
|
||||
local setting = G_reader_settings:readSetting("back_to_exit")
|
||||
return setting == "prompt" or setting == nil
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "prompt")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Always"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_to_exit")
|
||||
== "always"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "always")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Disable"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_to_exit")
|
||||
== "disable"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_to_exit", "disable")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
text = _("Back key in file browser"),
|
||||
sub_item_table = {
|
||||
{
|
||||
text = _("Default"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_in_filemanager")
|
||||
== "default"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_filemanager", "default")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Go to parent folder"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:readSetting("back_in_filemanager")
|
||||
== "parent_folder"
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:saveSetting("back_in_filemanager", "parent_folder")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
text = _("Enable back history"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:nilOrTrue("enable_back_history")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrTrue("enable_back_history")
|
||||
end,
|
||||
},
|
||||
{
|
||||
text = _("Invert page turn buttons"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("input_invert_page_turn_keys")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("input_invert_page_turn_keys")
|
||||
Device:invertButtons()
|
||||
end,
|
||||
},
|
||||
}
|
||||
common_settings.invert_page_turn_buttons = {
|
||||
text = _("Invert page turn buttons"),
|
||||
checked_func = function()
|
||||
return G_reader_settings:isTrue("input_invert_page_turn_keys")
|
||||
end,
|
||||
callback = function()
|
||||
G_reader_settings:flipNilOrFalse("input_invert_page_turn_keys")
|
||||
Device:invertButtons()
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
common_settings.document = {
|
||||
text = _("Document"),
|
||||
sub_item_table = {
|
||||
|
||||
@@ -41,6 +41,13 @@ local order = {
|
||||
"battery",
|
||||
"mass_storage_settings",
|
||||
},
|
||||
navigation = {
|
||||
"back_to_exit",
|
||||
"back_in_filemanager",
|
||||
"enable_back_history",
|
||||
"----------------------------",
|
||||
"invert_page_turn_buttons",
|
||||
},
|
||||
network = {
|
||||
"network_wifi",
|
||||
"network_proxy",
|
||||
|
||||
@@ -61,6 +61,13 @@ local order = {
|
||||
"battery",
|
||||
"mass_storage_settings",
|
||||
},
|
||||
navigation = {
|
||||
"back_to_exit",
|
||||
"back_in_filemanager",
|
||||
"enable_back_history",
|
||||
"----------------------------",
|
||||
"invert_page_turn_buttons",
|
||||
},
|
||||
network = {
|
||||
"network_wifi",
|
||||
"network_proxy",
|
||||
|
||||
Reference in New Issue
Block a user