Add gesture - show current book statistics (#5167)

pull/5173/head
Robert 5 years ago committed by Frans de Jonge
parent 47da9600d1
commit 825a3c4b52

@ -38,6 +38,7 @@ local action_strings = {
toc = _("Table of contents"),
bookmarks = _("Bookmarks"),
reading_progress = _("Reading progress"),
book_statistics = _("Book statistics"),
book_status = _("Book status"),
book_info = _("Book information"),
book_description = _("Book description"),
@ -617,6 +618,8 @@ function ReaderGesture:buildMenu(ges, default)
{ "toc", not self.is_docless},
{"bookmarks", not self.is_docless},
{"reading_progress", ReaderGesture.getReaderProgress ~= nil},
{"book_statistics", not self.is_docless},
{"book_status", not self.is_docless},
{"book_info", not self.is_docless},
{"book_description", not self.is_docless},
@ -1076,6 +1079,8 @@ function ReaderGesture:gestureAction(action, ges)
return
elseif action == "reading_progress" and ReaderGesture.getReaderProgress then
UIManager:show(ReaderGesture.getReaderProgress())
elseif action == "book_statistics" and ReaderGesture.getBookStats then
UIManager:show(ReaderGesture.getBookStats())
elseif action == "toc" then
self.ui:handleEvent(Event:new("ShowToc"))
elseif action == "night_mode" then

@ -145,6 +145,14 @@ function ReaderStatistics:init()
return readingprogress
end
ReaderGesture.getBookStats = function()
if self:isDocless() or not self.is_enabled then return end
local stats = KeyValuePage:new{
title = _("Statistics"),
kv_pairs = self:getCurrentStat(self.id_curr_book),
}
return stats
end
end
function ReaderStatistics:initData()

Loading…
Cancel
Save