fix: only show reader status at the end of the book

This commit is contained in:
Qingping Hou
2016-02-21 17:46:19 -08:00
parent 69f9ebd528
commit 8c01835458
7 changed files with 118 additions and 46 deletions

View File

@@ -21,6 +21,10 @@ function ReaderStatus:init()
self.enabled = false
return
end
-- register event listener if enabled
self.onEndOfBook = function()
self:showStatus()
end
self.total_pages = self.document:getPageCount()
self.ui:registerPostInitCallback(function()
self.ui.menu:registerToMainMenu(self)
@@ -48,19 +52,6 @@ function ReaderStatus:showStatus()
UIManager:show(status_page)
end
function ReaderStatus:onPageUpdate(pageno)
if self.enabled then
--in case when pageUpdate event generated before _document:render()
if pageno > self.total_pages or self.total_pages == 1 then
self.total_pages = self.document:getPageCount()
end
if pageno == self.total_pages and self.total_pages ~= 1 then
self:showStatus()
end
end
end
function ReaderStatus:onReadSettings(config)
self.settings = config
end