From f8199dd493babd5bff6c2962d01a907ab50c47a9 Mon Sep 17 00:00:00 2001 From: poire-z Date: Wed, 14 Nov 2018 20:58:56 +0100 Subject: [PATCH] Fix a few edge cases crashes and issues (#4334) - ReaderConfig does not need to call again self:initGesListener() on screen rotation/resize, as it uses the TouchZone infrastructure that deals itself with rotation. So, it was adding new gestures that were overriding tap on footer and preventing it from working. - ReaderFooter: fix refresh area (which was too small when toggling from hidden to visible) - ReaderToc: fix crash when showing TOC in scroll mode after rotation - Menu: fix crash when no onReturn defined (could happen when tap on bottom left corner when showing an empty TOC) --- frontend/apps/reader/modules/readerconfig.lua | 3 --- frontend/apps/reader/modules/readerfooter.lua | 4 +++- frontend/apps/reader/modules/readertoc.lua | 4 +++- frontend/ui/widget/menu.lua | 4 +++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/frontend/apps/reader/modules/readerconfig.lua b/frontend/apps/reader/modules/readerconfig.lua index 2cc31125e..c821d9d6a 100644 --- a/frontend/apps/reader/modules/readerconfig.lua +++ b/frontend/apps/reader/modules/readerconfig.lua @@ -93,9 +93,6 @@ function ReaderConfig:onSwipeShowConfigMenu(ges) end function ReaderConfig:onSetDimensions(dimen) - if Device:isTouchDevice() then - self:initGesListener() - end -- since we cannot redraw config_dialog with new size, we close -- the old one on screen size change if self.config_dialog then diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 32c5d473a..72de85796 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -579,7 +579,9 @@ function ReaderFooter:_updateFooterText() end self.text_container.dimen.w = self.text_width self.horizontal_group:resetLayout() - UIManager:setDirty(self.view.dialog, "ui", self.footer_content.dimen) + UIManager:setDirty(self.view.dialog, function() + return "ui", self.footer_content.dimen + end) end function ReaderFooter:onPageUpdate(pageno) diff --git a/frontend/apps/reader/modules/readertoc.lua b/frontend/apps/reader/modules/readertoc.lua index cf3dc88be..5f5385057 100644 --- a/frontend/apps/reader/modules/readertoc.lua +++ b/frontend/apps/reader/modules/readertoc.lua @@ -85,7 +85,9 @@ function ReaderToc:onPageUpdate(pageno) end function ReaderToc:onPosUpdate(pos, pageno) - self.pageno = pageno + if pageno then + self.pageno = pageno + end end function ReaderToc:fillToc() diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index d471337fb..1f04b76f8 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -695,7 +695,9 @@ function Menu:init() -- return button self.page_return_arrow = Button:new{ icon = "resources/icons/appbar.arrow.left.up.png", - callback = function() self:onReturn() end, + callback = function() + if self.onReturn then self:onReturn() end + end, bordersize = 0, show_parent = self, readonly = self.return_arrow_propagation,