Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX] Gesture manager: corner gestures #4878

Merged
merged 20 commits into from Apr 7, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

address next @poire-z comment before it arises (submenu, action display)

  • Loading branch information...
Frenzie committed Apr 6, 2019
commit c1ae019bb763d33760b66c136edba3b8b3028944
@@ -216,6 +216,35 @@ function ReaderGesture:genMultiswipeSubmenu()
end

function ReaderGesture:addToMainMenu(menu_items)
local gesture_manager = G_reader_settings:readSetting(self.ges_mode)

local cornerHoldTextFunc = function(gesture)
local action_name = gesture_manager[gesture] ~= "nothing" and action_strings[gesture_manager[gesture]] or _("Available")
return T(_("%1 (%2)"), gesture, action_name)
end
local corner_hold_submenu = {
text = _("Hold corner"),
sub_item_table = {
{
text_func = function() return cornerHoldTextFunc(_("Top left")) end,
enabled_func = function() return self.ges_mode == "gesture_reader" end,
sub_item_table = self:buildMenu("hold_top_left_corner", self.default_gesture["hold_top_left_corner"]),
},
{
text_func = function() return cornerHoldTextFunc(_("Top right")) end,
sub_item_table = self:buildMenu("hold_top_right_corner", self.default_gesture["hold_top_right_corner"]),
},
{
text_func = function() return cornerHoldTextFunc(_("Bottom left")) end,
sub_item_table = self:buildMenu("hold_bottom_left_corner", self.default_gesture["hold_bottom_left_corner"]),
},
{
text_func = function() return cornerHoldTextFunc(_("Bottom right")) end,
sub_item_table = self:buildMenu("hold_bottom_right_corner", self.default_gesture["hold_bottom_right_corner"]),
separator = true,
},
},
}
menu_items.gesture_manager = {
text = _("Gesture manager"),
sub_item_table = {
@@ -311,32 +340,14 @@ function ReaderGesture:addToMainMenu(menu_items)
sub_item_table = self:buildMenu("tap_right_bottom_corner", self.default_gesture["tap_right_bottom_corner"]),
separator = true,
},
{
text = _("Hold top left corner"),
enabled_func = function() return self.ges_mode == "gesture_reader" end,
sub_item_table = self:buildMenu("hold_top_left_corner", self.default_gesture["hold_top_left_corner"]),
},
{
text = _("Hold top right corner"),
sub_item_table = self:buildMenu("hold_top_right_corner", self.default_gesture["hold_top_right_corner"]),
},
{
text = _("Hold bottom left corner"),
sub_item_table = self:buildMenu("hold_bottom_left_corner", self.default_gesture["hold_bottom_left_corner"]),
},
{
text = _("Hold bottom right corner"),
sub_item_table = self:buildMenu("hold_bottom_right_corner", self.default_gesture["hold_bottom_right_corner"]),
separator = true,
},
corner_hold_submenu,
{
text = _("Short diagonal swipe"),
sub_item_table = self:buildMenu("short_diagonal_swipe", self.default_gesture["short_diagonal_swipe"]),
},
},
}

local gesture_manager = G_reader_settings:readSetting(self.ges_mode)
local twoFingerSwipeTextFunc = function(gesture, friendly_name)
local action_name = gesture_manager[gesture] ~= "nothing" and action_strings[gesture_manager[gesture]] or _("Available")
return T(_("%1 (%2)"), friendly_name, action_name)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.