mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderFooter: Smarter hardware event handlers
Make sure we don't repaint the footer over anything else than ReaderUI, as some events are fired without direct UI interaction, so we can't be assured of the actual state of the UI. Fix #7556 Exposed since #7379, but could arguably happen with other existing handlers before.
This commit is contained in:
@@ -1873,14 +1873,6 @@ function ReaderFooter:onUpdateFooter(force_repaint, force_recompute)
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFooter:onCharging()
|
||||
self:onUpdateFooter(self.view.footer_visible)
|
||||
end
|
||||
|
||||
function ReaderFooter:onNotCharging()
|
||||
self:onUpdateFooter(self.view.footer_visible)
|
||||
end
|
||||
|
||||
function ReaderFooter:updateFooterPage(force_repaint, force_recompute)
|
||||
if type(self.pageno) ~= "number" then return end
|
||||
if self.ui.document:hasHiddenFlows() then
|
||||
@@ -2230,24 +2222,42 @@ function ReaderFooter:onCloseDocument()
|
||||
self:unscheduleFooterAutoRefresh()
|
||||
end
|
||||
|
||||
-- Used by event handlers that can trip without direct UI interaction...
|
||||
function ReaderFooter:maybeUpdateFooter()
|
||||
-- ...so we need to avoid stomping over unsuspecting widgets (usually, ScreenSaver).
|
||||
if UIManager:getTopWidget() == "ReaderUI" then
|
||||
self:onUpdateFooter(self.view.footer_visible)
|
||||
else
|
||||
self:onUpdateFooter()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFooter:onFrontlightStateChanged()
|
||||
if self.settings.frontlight then
|
||||
self:onUpdateFooter(true)
|
||||
self:maybeUpdateFooter()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFooter:onNetworkConnected()
|
||||
if self.settings.wifi_status then
|
||||
self:onUpdateFooter(true)
|
||||
self:maybeUpdateFooter()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFooter:onNetworkDisconnected()
|
||||
if self.settings.wifi_status then
|
||||
self:onUpdateFooter(true)
|
||||
self:maybeUpdateFooter()
|
||||
end
|
||||
end
|
||||
|
||||
function ReaderFooter:onCharging()
|
||||
self:maybeUpdateFooter()
|
||||
end
|
||||
|
||||
function ReaderFooter:onNotCharging()
|
||||
self:maybeUpdateFooter()
|
||||
end
|
||||
|
||||
function ReaderFooter:onSetRotationMode()
|
||||
self:updateFooterContainer()
|
||||
self:resetLayout(true)
|
||||
|
||||
Reference in New Issue
Block a user