[feat] GestureManager: Implement action to change highlight style using gesture manager (#4936)

pull/4938/head
Galunid 5 years ago committed by Frans de Jonge
parent c053e48526
commit 9759ffa381

@ -84,6 +84,7 @@ local action_strings = {
show_plus_menu = _("Show plus menu"),
folder_shortcuts = _("Folder shortcuts"),
cycle_highlight_action = _("Cycle highlight action"),
cycle_highlight_style = _("Cycle highlight style"),
wallabag_download = _("Wallabag retrieval"),
}
@ -488,6 +489,7 @@ function ReaderGesture:buildMenu(ges, default)
{"zoom_content", not self.is_docless},
{"zoom_page", not self.is_docless, true},
{"cycle_highlight_action", not self.is_docless},
{"cycle_highlight_style", not self.is_docless},
{"wallabag_download", self.ui.wallabag ~= nil},
}
local return_menu = {}
@ -1049,6 +1051,8 @@ function ReaderGesture:gestureAction(action, ges)
self.ui:handleEvent(Event:new("SynchronizeWallabag"))
elseif action == "cycle_highlight_action" then
self.ui:handleEvent(Event:new("CycleHighlightAction"))
elseif action == "cycle_highlight_style" then
self.ui:handleEvent(Event:new("CycleHighlightStyle"))
end
return true
end

@ -870,6 +870,22 @@ function ReaderHighlight:onCycleHighlightAction()
timeout = 1,
})
end
return true
end
function ReaderHighlight:onCycleHighlightStyle()
local next_actions = {
lighten = "underscore",
underscore = "invert",
invert = "lighten"
}
self.view.highlight.saved_drawer = next_actions[self.view.highlight.saved_drawer]
self.ui.doc_settings:saveSetting("highlight_drawer", self.view.highlight.saved_drawer)
UIManager:show(Notification:new{
text = T(_("Default highlight style changed to '%1'."), self.view.highlight.saved_drawer),
timeout = 1,
})
return true
end
function ReaderHighlight:highlightFromHoldPos()

Loading…
Cancel
Save