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

[feat, UX] Add multiswipe recorder #4644

Merged
merged 2 commits into from Feb 22, 2019

Conversation

Projects
None yet
3 participants
@Frenzie
Copy link
Member

Frenzie commented Feb 22, 2019


@Frenzie Frenzie added this to the 2019.03 milestone Feb 22, 2019

@Frenzie Frenzie requested a review from poire-z Feb 22, 2019

@poire-z
Copy link
Contributor

poire-z left a comment

Nice, lgtm.
(may be remove the blank lines 95 & 97)

@Frenzie Frenzie merged commit 2e255a1 into koreader:master Feb 22, 2019

1 check was pending

ci/circleci CircleCI is running your tests
Details

@Frenzie Frenzie deleted the Frenzie:multiswipe-recorder branch Feb 22, 2019

Frenzie added a commit to Frenzie/koreader that referenced this pull request Feb 22, 2019

Frenzie added a commit that referenced this pull request Feb 22, 2019

[fix] ReaderGesture: don't crash without custom gestures (#4645)
Silly oversight in #4644.

Also remove unused util because apparently CircleCI didn't run on the other PR when it should've.
@NiLuJe

This comment has been minimized.

Copy link
Member

NiLuJe commented Feb 22, 2019

Obligatory Konami code reference. :D

@Frenzie

This comment has been minimized.

Copy link
Member Author

Frenzie commented Feb 23, 2019

Haha, it does look a bit like it! :D

@poire-z

This comment has been minimized.

Copy link
Contributor

poire-z commented Feb 24, 2019

(Many multiswipe PRs, don't really know where to put my comments :) so putting them in the related PR even if one single place would may be better).

When recording/adding a new gesture, one needs to restart koreader to see it in the menu and be able to assign some action to it.
Not really bothering, but might need some InfoMessage inviting to do so if that can't be workarounded.

@Frenzie

This comment has been minimized.

Copy link
Member Author

Frenzie commented Feb 24, 2019

It's easy enough to work around, but I was hoping there was something more proper in place, see #4651.

diff --git a/frontend/apps/reader/modules/readergesture.lua b/frontend/apps/reader/modules/readergesture.lua
index 45f75eff..a180b776 100644
--- a/frontend/apps/reader/modules/readergesture.lua
+++ b/frontend/apps/reader/modules/readergesture.lua
@@ -55,6 +55,15 @@ function ReaderGesture:initGesture()
     G_reader_settings:saveSetting(self.ges_mode, gesture_manager)
 end
 
+function ReaderGesture:genMultiswipeSubmenu()
+    return {
+        text = _("Multiswipe"),
+        sub_item_table = self:buildMultiswipeMenu(),
+        enabled_func = function() return self.multiswipes_enabled end,
+        separator = true,
+    }
+end
+
 function ReaderGesture:addToMainMenu(menu_items)
     menu_items.gesture = {
         text = _("Gesture manager"),
@@ -71,7 +80,7 @@ function ReaderGesture:addToMainMenu(menu_items)
             {
                 text = _("Multiswipe recorder"),
                 enabled_func = function() return self.multiswipes_enabled end,
-                callback = function()
+                callback = function(touchmenu_instance)
                     local multiswipe_recorder
                     multiswipe_recorder = InputDialog:new{
                         title = _("Multiswipe recorder"),
@@ -92,6 +101,8 @@ function ReaderGesture:addToMainMenu(menu_items)
                                         if not recorded_multiswipe then return end
                                         logger.dbg("Multiswipe recorder detected:", recorded_multiswipe)
                                         custom_multiswipes:addTableItem("multiswipes", recorded_multiswipe)
+                                        -- TODO implement some nicer method in TouchMenu than this ugly hack for updating the menu
+                                        touchmenu_instance.item_table[3] = self:genMultiswipeSubmenu()
                                         UIManager:close(multiswipe_recorder)
                                     end,
                                 },

even if one single place would may be better

I think just opening a new issue would be easier to keep track of. :-)

Frenzie added a commit to Frenzie/koreader that referenced this pull request Feb 24, 2019

[UX] Gesture manager: delete custom gestures and update menu
Also extend the default set of gestures to include all of them, and add east south west north for refresh. (I've always thought small diagonal swipe to be rather awkward to trigger.)

See koreader#4644 (comment) and koreader#4651 regarding the menu update.

Frenzie added a commit to Frenzie/koreader that referenced this pull request Feb 24, 2019

[UX] Gesture manager: delete custom gestures and update menu
Include a safety check to prevent rerecording an existing gesture.

Also extend the default set of gestures to include all of them, and add east south west north for refresh. (I've always thought small diagonal swipe to be rather awkward to trigger.)

See koreader#4644 (comment) and koreader#4651 regarding the menu update.

Frenzie added a commit that referenced this pull request Feb 24, 2019

[UX] Gesture manager: delete custom gestures and update menu (#4652)
Include a safety check to prevent rerecording an existing gesture.

Also extend the default set of gestures to include all of them, and add east south west north for refresh. (I've always thought small diagonal swipe to be rather awkward to trigger.)

See #4644 (comment) and #4651 regarding the menu update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.