diff --git a/frontend/ui/widget/bookstatuswidget.lua b/frontend/ui/widget/bookstatuswidget.lua index b60b2f3d9..36a253893 100644 --- a/frontend/ui/widget/bookstatuswidget.lua +++ b/frontend/ui/widget/bookstatuswidget.lua @@ -114,6 +114,12 @@ function BookStatusWidget:init() range = function() return self.dimen end, } } + self.ges_events.MultiSwipe = { + GestureRange:new{ + ges = "multiswipe", + range = function() return self.dimen end, + } + } end local screen_size = Screen:getSize() @@ -602,6 +608,14 @@ function BookStatusWidget:onSwipe(arg, ges_ev) end end +function BookStatusWidget:onMultiSwipe(arg, ges_ev) + -- For consistency with other fullscreen widgets where swipe south can't be + -- used to close and where we then allow any multiswipe to close, allow any + -- multiswipe to close this widget too. + self:onClose() + return true +end + function BookStatusWidget:onClose() self:saveSummary() -- NOTE: Flash on close to avoid ghosting, since we show an image. diff --git a/frontend/ui/widget/imageviewer.lua b/frontend/ui/widget/imageviewer.lua index ef78ef403..7ee9012c1 100644 --- a/frontend/ui/widget/imageviewer.lua +++ b/frontend/ui/widget/imageviewer.lua @@ -115,6 +115,8 @@ function ImageViewer:init() scale = {diagonal - Screen:scaleBySize(200), diagonal}, rate = 1.0, } }, + -- Allow closing with any multiswipe + MultiSwipe = { GestureRange:new{ ges = "multiswipe", range = range } }, } end if self.fullscreen then @@ -549,6 +551,13 @@ function ImageViewer:onSwipe(_, ges) return true end +function ImageViewer:onMultiSwipe(_, ges) + -- As swipe south to close is only enabled when scaled to fit, but not + -- when we are zoomed in/out, allow any multiswipe to close. + self:onClose() + return true +end + function ImageViewer:onHold(_, ges) -- Start of pan self._panning = true diff --git a/frontend/ui/widget/keyvaluepage.lua b/frontend/ui/widget/keyvaluepage.lua index 23120bdda..5623b7784 100644 --- a/frontend/ui/widget/keyvaluepage.lua +++ b/frontend/ui/widget/keyvaluepage.lua @@ -295,6 +295,12 @@ function KeyValuePage:init() range = self.dimen, } } + self.ges_events.MultiSwipe = { + GestureRange:new{ + ges = "multiswipe", + range = self.dimen, + } + } end -- return button @@ -634,6 +640,14 @@ function KeyValuePage:onSwipe(arg, ges_ev) end end +function KeyValuePage:onMultiSwipe(arg, ges_ev) + -- For consistency with other fullscreen widgets where swipe south can't be + -- used to close and where we then allow any multiswipe to close, allow any + -- multiswipe to close this widget too. + self:onClose() + return true +end + function KeyValuePage:onClose() UIManager:close(self) return true diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index b4480fc9c..4e6f0ac24 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -914,6 +914,12 @@ function Menu:init() range = self.dimen, } } + self.ges_events.MultiSwipe = { + GestureRange:new{ + ges = "multiswipe", + range = self.dimen, + } + } end self.ges_events.Close = self.on_close_ges end @@ -1348,7 +1354,7 @@ function Menu:onSwipe(arg, ges_ev) elseif direction == "south" then if self.has_close_button and not self.no_title then -- If there is a close button displayed (so, this Menu can be - -- closed), allow easier closing with swipe up/down + -- closed), allow easier closing with swipe south. self:onClose() end -- If there is no close button, it's a top level Menu and swipe @@ -1362,6 +1368,18 @@ function Menu:onSwipe(arg, ges_ev) end end +function Menu:onMultiSwipe(arg, ges_ev) + -- For consistency with other fullscreen widgets where swipe south can't be + -- used to close and where we then allow any multiswipe to close, allow any + -- multiswipe to close this widget too. + if self.has_close_button and not self.no_title then + -- If there is a close button displayed (so, this Menu can be + -- closed), allow easier closing with swipe south. + self:onClose() + end + return true +end + function Menu:setTitleBarLeftIcon(icon) self.title_bar:setLeftIcon(icon) end diff --git a/plugins/statistics.koplugin/calendarview.lua b/plugins/statistics.koplugin/calendarview.lua index 594316a8f..3b6a64519 100644 --- a/plugins/statistics.koplugin/calendarview.lua +++ b/plugins/statistics.koplugin/calendarview.lua @@ -442,6 +442,12 @@ function CalendarView:init() range = self.dimen, } } + self.ges_events.MultiSwipe = { + GestureRange:new{ + ges = "multiswipe", + range = self.dimen, + } + } end self.outer_padding = Size.padding.large @@ -830,6 +836,14 @@ function CalendarView:onSwipe(arg, ges_ev) end end +function CalendarView:onMultiSwipe(arg, ges_ev) + -- For consistency with other fullscreen widgets where swipe south can't be + -- used to close and where we then allow any multiswipe to close, allow any + -- multiswipe to close this widget too. + self:onClose() + return true +end + function CalendarView:onClose() UIManager:close(self) return true diff --git a/plugins/statistics.koplugin/readerprogress.lua b/plugins/statistics.koplugin/readerprogress.lua index 93454b1e2..993b066c3 100644 --- a/plugins/statistics.koplugin/readerprogress.lua +++ b/plugins/statistics.koplugin/readerprogress.lua @@ -71,6 +71,12 @@ function ReaderProgress:init() range = function() return self.dimen end, } } + self.ges_events.MultiSwipe = { + GestureRange:new{ + ges = "multiswipe", + range = function() return self.dimen end, + } + } end self.covers_fullscreen = true -- hint for UIManager:_repaint() self[1] = FrameContainer:new{ @@ -519,6 +525,14 @@ function ReaderProgress:onSwipe(arg, ges_ev) end end +function ReaderProgress:onMultiSwipe(arg, ges_ev) + -- For consistency with other fullscreen widgets where swipe south can't be + -- used to close and where we then allow any multiswipe to close, allow any + -- multiswipe to close this widget too. + self:onClose() + return true +end + function ReaderProgress:onClose() UIManager:close(self) return true