From a97dbb05ed893f7261ad8bdcc32e3855777562e5 Mon Sep 17 00:00:00 2001 From: yparitcher Date: Mon, 23 May 2022 03:19:47 -0400 Subject: [PATCH] Page turn animations: add to dispatcher (#9123) xref: https://www.mobileread.com/forums/showthread.php?p=4224443&postcount=1119 --- frontend/apps/reader/modules/readerview.lua | 4 ++++ frontend/dispatcher.lua | 1 + frontend/ui/elements/page_turns.lua | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index a484eecd4..2f39f0de5 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -897,6 +897,10 @@ function ReaderView:onPageChangeAnimation(forward) end end +function ReaderView:onTogglePageChangeAnimation() + G_reader_settings:flipNilOrFalse("swipe_animations") +end + function ReaderView:onReaderFooterVisibilityChange() -- Don't bother ReaderRolling with this nonsense, the footer's height is NOT handled via visible_area there ;) if self.ui.paging and self.state.page then diff --git a/frontend/dispatcher.lua b/frontend/dispatcher.lua index 89ac394c6..571f657f2 100644 --- a/frontend/dispatcher.lua +++ b/frontend/dispatcher.lua @@ -129,6 +129,7 @@ local settingsList = { book_cover = {category="none", event="ShowBookCover", title=_("Book cover"), reader=true, separator=true}, show_config_menu = {category="none", event="ShowConfigMenu", title=_("Show bottom menu"), reader=true}, toggle_bookmark = {category="none", event="ToggleBookmark", title=_("Toggle bookmark"), reader=true}, + toggle_page_change_Animation = {category="none", event="TogglePageChangeAnimation", title=_("Toggle page turn animations"), reader=true, condition=Device:canDoSwipeAnimation()}, toggle_inverse_reading_order = {category="none", event="ToggleReadingOrder", title=_("Toggle page turn direction"), reader=true, separator=true}, cycle_highlight_action = {category="none", event="CycleHighlightAction", title=_("Cycle highlight action"), reader=true}, cycle_highlight_style = {category="none", event="CycleHighlightStyle", title=_("Cycle highlight style"), reader=true}, diff --git a/frontend/ui/elements/page_turns.lua b/frontend/ui/elements/page_turns.lua index b2c1677ac..229bc89ad 100644 --- a/frontend/ui/elements/page_turns.lua +++ b/frontend/ui/elements/page_turns.lua @@ -148,7 +148,7 @@ if Device:canDoSwipeAnimation() then return G_reader_settings:isTrue("swipe_animations") end, callback = function() - G_reader_settings:flipNilOrFalse("swipe_animations") + UIManager:broadcastEvent(Event:new("TogglePageChangeAnimation")) end, separator = true, })