From 5fc5386e8722456d8fefe165ffafa57bc901ccb5 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Wed, 28 Aug 2024 15:22:55 +0200 Subject: [PATCH] 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 --- frontend/apps/reader/modules/readerfooter.lua | 9 ++++++++- plugins/readtimer.koplugin/main.lua | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 1b8030f88..255400087 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -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 diff --git a/plugins/readtimer.koplugin/main.lua b/plugins/readtimer.koplugin/main.lua index 4d2b19028..1e41a2508 100644 --- a/plugins/readtimer.koplugin/main.lua +++ b/plugins/readtimer.koplugin/main.lua @@ -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