[UX] Gesture manager: add action - go to (#4690)

Cf. <https://github.com/koreader/koreader/issues/4687>.
pull/4692/head
Frans de Jonge 5 years ago committed by GitHub
parent 332fa642e3
commit 1475acdae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,6 +23,7 @@ local action_strings = {
page_jmp_back_1 = _("Previous page"),
page_jmp_fwd_10 = _("Forward 10 pages"),
page_jmp_fwd_1 = _("Next page"),
go_to = _("Go to"),
skim = _("Skim"),
back = _("Back"),
previous_location = _("Back to previous location"),
@ -101,6 +102,7 @@ function ReaderGesture:init()
multiswipe_north_east = "toc",
multiswipe_north_west = self.ges_mode == "gesture_fm" and "folder_up" or "bookmarks",
multiswipe_east_north = "history",
multiswipe_east_south = "go_to",
multiswipe_south_north = "skim",
multiswipe_south_east = "toggle_reflow",
multiswipe_south_west = "show_frontlight_dialog",
@ -245,6 +247,7 @@ function ReaderGesture:buildMenu(ges, default)
{"page_jmp_back_1", not self.is_docless},
{"page_jmp_fwd_10", not self.is_docless},
{"page_jmp_fwd_1", not self.is_docless},
{"go_to", true},
{"skim", not self.is_docless},
{"back", true},
{"previous_location", not self.is_docless},
@ -510,6 +513,8 @@ function ReaderGesture:gestureAction(action)
self:pageUpdate(-10)
elseif action == "page_jmp_back_1" then
self:pageUpdate(-1)
elseif action == "go_to" then
self.ui:handleEvent(Event:new("ShowGotoDialog"))
elseif action == "skim" then
self.ui:handleEvent(Event:new("ShowSkimtoDialog"))
elseif action == "back" then

@ -353,7 +353,7 @@ function KeyValuePage:init()
self.page_info_text = Button:new{
text = "",
hold_input = {
title = _("Input page number"),
title = _("Enter page number"),
type = "number",
hint_func = function()
return "(" .. "1 - " .. self.pages .. ")"

@ -643,7 +643,7 @@ function Menu:init()
}
if self.goto_letter then
title_goto = _("Input page number or letter")
title_goto = _("Enter page number or letter")
type_goto = "string"
hint_func = function()
return string.format("(1 - %s) or (a - z)", self.page_num)
@ -666,7 +666,7 @@ function Menu:init()
end,
})
else
title_goto = _("Input page number")
title_goto = _("Enter page number")
type_goto = "number"
hint_func = function()
return string.format("(1 - %s)", self.page_num)
@ -1032,6 +1032,12 @@ function Menu:onSelectByShortCut(_, keyevent)
return true
end
function Menu:onShowGotoDialog()
if self.page_info_text and self.page_info_text.hold_input then
self.page_info_text:onInput(self.page_info_text.hold_input)
end
end
function Menu:onWrapFirst()
if self.page > 1 then
self.page = self.page - 1

Loading…
Cancel
Save