mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #2182 from koreader/houqp-master
footer(fix): avoid setting mini footer to invisible when full progress bar is on
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user