Minor state handling tweaks when the footer is disabled/invisible (#5494)

* Don't break `doc_pages` updates when it's completely disabled. (c.f., the commit's comment, doing it on every page turn seems a bit overkill, but I get that it's probably done that way because it was easier ;)).
* Detect the empty footerTextGenerator properly in `_updateFooterText` (it's `""`, not `nil`).
* Abort `_updateFooterText` early when the footer is invisible (and has been for a while/ever, i.e., when not requesting a repaint, like a mode switch would).
* Never send `SetBottomPageMargin` events twice.
* Minor tweaks to touchmenu & configdialog to avoid useless repaints (don't redraw the reader/fm unless we absolutely need to).
* Make sure we show the progress bar alone instead of nothing when disabling the last enabled mode in the menu.
This commit is contained in:
NiLuJe
2019-10-15 21:57:51 +02:00
committed by GitHub
parent 6082f84e13
commit f2f2aa6e4d
4 changed files with 46 additions and 25 deletions

View File

@@ -865,10 +865,15 @@ end
function ConfigDialog:onShowConfigPanel(index)
self.panel_index = index
local old_dimen = self.dialog_frame.dimen and self.dialog_frame.dimen:copy()
local old_layout_h = self.layout and #self.layout
self:update()
-- NOTE: Keep that one as UI to avoid delay when both this and the topmenu are shown.
-- Plus, this is also called for each tab anyway, so that wouldn't have been great.
UIManager:setDirty(self.is_fresh and self or "all", function()
-- NOTE: And we also only need to repaint what's behind us when switching to a smaller dialog...
-- This is trickier than in touchmenu, because dimen appear to fluctuate before/after painting...
-- So we've settled instead for the amount of lines in the panel, as line-height is constant.
local keep_bg = old_layout_h and #self.layout >= old_layout_h
UIManager:setDirty((self.is_fresh or keep_bg) and self or "all", function()
local refresh_dimen =
old_dimen and old_dimen:combine(self.dialog_frame.dimen)
or self.dialog_frame.dimen