ReadTimer: Don't blindly repaint the footer in update_status_bars

Send a dedicated event that will let ReaderFooter check if we actually have anything relevant to display, and will do the usual "should I repaint/refresh" checks ;).

Fix #12323
Regression since #12002
This commit is contained in:
NiLuJe
2024-08-28 15:22:55 +02:00
parent a86271b8f1
commit 5fc5386e87
2 changed files with 9 additions and 2 deletions

View File

@@ -486,7 +486,7 @@ ReaderFooter.default_settings = {
function ReaderFooter:init()
self.settings = G_reader_settings:readSetting("footer", self.default_settings)
self.additional_footer_content = {} -- place, where additional header content can be inserted.
self.additional_footer_content = {} -- array, where additional header content can be inserted.
-- Remove items not supported by the current device
if not Device:hasFastWifiStatusQuery() then
@@ -2468,6 +2468,13 @@ function ReaderFooter:onBookMetadataChanged(prop_updated)
end
end
function ReaderFooter:onRefreshAdditionalContent()
if #self.additional_footer_content > 0 then
-- Can be sent an any time, so we need to be careful about the repaint/refresh
self:maybeUpdateFooter()
end
end
function ReaderFooter:onCloseWidget()
self:free()
end

View File

@@ -98,7 +98,7 @@ function ReadTimer:update_status_bars(seconds)
UIManager:broadcastEvent(Event:new("UpdateHeader"))
end
if self.show_value_in_footer then
UIManager:broadcastEvent(Event:new("UpdateFooter", true))
UIManager:broadcastEvent(Event:new("RefreshAdditionalContent"))
end
-- if seconds schedule 1ms later
if seconds and seconds >= 0 then