mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Cleanup onSetStatusLine()
Follow up to fa0117bb (#4268), to make things a bit clearer:
Only ReaderRolling get the 'SetStatusLine' event, and tells
crengine about the change, and then send the 'UpdatePos' event.
ReaderFooter now just gets a :setVisible() method.
Now, all the code that calls a self.ui.document:set* method, that
most probably triggers a full re-rendering by crengine, do signal
'UpdatePos' immediately after. This event signals that all page
number, pages count, positions... are no more valid and must be
queried or computed again.
This could also be used if we ever want to cache Page Links or
Screen Boxes: this event will have us dropped these caches.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user