diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 41b443108..1b0ed10e7 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -692,18 +692,11 @@ function ReaderFooter:onHoldFooter() return true end -function ReaderFooter:onSetStatusLine(status_line, on_read_settings) - -- Ignore this event when it is first sent by ReaderCoptListener - -- on book loading, so we stay with the saved footer settings - if on_read_settings then - return - end - -- 1 is min progress bar while 0 is full cre header progress bar - if status_line == 1 then - -- If footer was off (if previously with full status bar), make the - -- footer visible, as if we taped on it (and so we don't duplicate - -- this code - not if flipping_visible as in this case, a ges.pos - -- argument to onTapFooter(ges) is required) +function ReaderFooter:setVisible(visible) + if visible then + -- If it was off, just do as if we tap'ed on it (so we don't + -- duplicate onTapFooter() code - not if flipping_visible as in + -- this case, a ges.pos argument to onTapFooter(ges) is required) if self.mode == MODE.off and not self.view.flipping_visible then self:onTapFooter() end @@ -711,7 +704,6 @@ function ReaderFooter:onSetStatusLine(status_line, on_read_settings) else self:applyFooterMode(MODE.off) end - self.ui:handleEvent(Event:new("UpdatePos")) end function ReaderFooter:onResume() diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index 13cd40316..bbb86a64a 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -709,11 +709,18 @@ function ReaderRolling:updatePageLink() end --]] -function ReaderRolling:onSetStatusLine(status_line) +function ReaderRolling:onSetStatusLine(status_line, on_read_settings) + -- status_line values: -- in crengine: 0=header enabled, 1=disabled -- in koreader: 0=top status bar, 1=bottom mini bar self.ui.document:setStatusLineProp(status_line) self.cre_top_bar_enabled = status_line == 0 + if not on_read_settings then + -- Ignore this event when it is first sent by ReaderCoptListener + -- on book loading, so we stay with the saved footer settings + self.view.footer:setVisible(status_line == 1) + end + self.ui:handleEvent(Event:new("UpdatePos")) end function ReaderRolling:updateBatteryState() diff --git a/spec/unit/readerfooter_spec.lua b/spec/unit/readerfooter_spec.lua index e757756f1..023d6a401 100644 --- a/spec/unit/readerfooter_spec.lua +++ b/spec/unit/readerfooter_spec.lua @@ -625,16 +625,16 @@ describe("Readerfooter module", function() footer:applyFooterMode(0) assert.is.same(0, footer.mode) assert.falsy(readerui.view.footer_visible) - readerui.view.footer:onSetStatusLine(1) + readerui.rolling:onSetStatusLine(1) assert.is.same(1, footer.mode) assert.truthy(readerui.view.footer_visible) footer.mode = 1 - readerui.view.footer:onSetStatusLine(1) + readerui.rolling:onSetStatusLine(1) assert.is.same(1, footer.mode) assert.truthy(readerui.view.footer_visible) - readerui.view.footer:onSetStatusLine(0) + readerui.rolling:onSetStatusLine(0) assert.is.same(0, footer.mode) assert.falsy(readerui.view.footer_visible) end)