diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index 4b9ddb94e..a91b246f8 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -314,7 +314,7 @@ function ReaderFooter:updateFooterPos() end -- updateFooterText will start as a noop. After onReaderReady event is --- received, it will initialized as _updateFooterText +-- received, it will initialized as _updateFooterText below function ReaderFooter:updateFooterText() end @@ -484,7 +484,12 @@ function ReaderFooter:onHoldFooter(arg, ges) end function ReaderFooter:onSetStatusLine(status_line) - self.view.footer_visible = (status_line == 1) + -- 1 is min progress bar while 0 is full cre header progress bar + if status_line == 1 then + self.view.footer_visible = (self.mode ~= MODE.off) + else + self:applyFooterMode(MODE.off) + end self.ui.document:setStatusLineProp(status_line) self.ui:handleEvent(Event:new("UpdatePos")) end diff --git a/frontend/apps/reader/modules/readerview.lua b/frontend/apps/reader/modules/readerview.lua index de8726bb1..ba4a1af70 100644 --- a/frontend/apps/reader/modules/readerview.lua +++ b/frontend/apps/reader/modules/readerview.lua @@ -643,8 +643,7 @@ function ReaderView:onReadSettings(config) end self.state.gamma = config:readSetting("gamma") or DGLOBALGAMMA local full_screen = config:readSetting("kopt_full_screen") or self.document.configurable.full_screen - local status_line = config:readSetting("copt_status_line") or self.document.configurable.status_line - if full_screen == 0 or status_line == 0 then + if full_screen == 0 then self.footer_visible = false end self:resetLayout() diff --git a/spec/unit/readerfooter_spec.lua b/spec/unit/readerfooter_spec.lua index b1b68164d..cf3664774 100644 --- a/spec/unit/readerfooter_spec.lua +++ b/spec/unit/readerfooter_spec.lua @@ -315,4 +315,28 @@ describe("Readerfooter module", function() end assert.is.same(0, found) end) + + it("should toggle between full and min progress bar for cre documents", function() + local sample_txt = "spec/front/unit/data/sample.txt" + local readerui = ReaderUI:new{ + document = DocumentRegistry:openDocument(sample_txt), + } + local footer = readerui.view.footer + + footer:applyFooterMode(0) + assert.is.same(0, footer.mode) + assert.falsy(readerui.view.footer_visible) + readerui.view.footer:onSetStatusLine(1) + assert.is.same(0, footer.mode) + assert.falsy(readerui.view.footer_visible) + + footer.mode = 1 + readerui.view.footer:onSetStatusLine(1) + assert.is.same(1, footer.mode) + assert.truthy(readerui.view.footer_visible) + + readerui.view.footer:onSetStatusLine(0) + assert.is.same(0, footer.mode) + assert.falsy(readerui.view.footer_visible) + end) end)