From 882a815f6c96b771e79991dfca7d27c4744cd326 Mon Sep 17 00:00:00 2001 From: Zijie He Date: Mon, 25 Apr 2016 19:45:55 -0700 Subject: [PATCH] Use default font if settings.reader.lua does not provide one. Provide a Toggle button if readerfooter gesture actions are disabled. --- frontend/apps/reader/modules/readerfooter.lua | 60 +++++++++++++------ reader.lua | 4 +- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/frontend/apps/reader/modules/readerfooter.lua b/frontend/apps/reader/modules/readerfooter.lua index a10d85dcf..b707a661d 100644 --- a/frontend/apps/reader/modules/readerfooter.lua +++ b/frontend/apps/reader/modules/readerfooter.lua @@ -146,13 +146,13 @@ function ReaderFooter:resetLayout() self.dimen = self[1]:getSize() self._saved_screen_width = new_screen_width - local range = Geom:new{ - x = new_screen_width*DTAP_ZONE_MINIBAR.x, - y = new_screen_height*DTAP_ZONE_MINIBAR.y, - w = new_screen_width*DTAP_ZONE_MINIBAR.w, - h = new_screen_height*DTAP_ZONE_MINIBAR.h - } if Device:isTouchDevice() then + local range = Geom:new{ + x = new_screen_width*DTAP_ZONE_MINIBAR.x, + y = new_screen_height*DTAP_ZONE_MINIBAR.y, + w = new_screen_width*DTAP_ZONE_MINIBAR.w, + h = new_screen_height*DTAP_ZONE_MINIBAR.h + } self.ges_events = { TapFooter = { GestureRange:new{ @@ -202,21 +202,43 @@ function ReaderFooter:addToMainMenu(tab_item_table) end, } end + local sub_items = {} + if Geom:new{ + x = DTAP_ZONE_MINIBAR.x, + y = DTAP_ZONE_MINIBAR.y, + w = DTAP_ZONE_MINIBAR.w, + h = DTAP_ZONE_MINIBAR.h + }:sizeof() == 0 then + table.insert(sub_items, { + text = _("Toggle"), + enabled_func = function() + return not self.view.flipping_visible + end, + callback = function() + if not self.view.flipping_visible then + self:onTapFooter(nil, nil) + end + end, + }) + end + for i, v in ipairs({ + get_minibar_option("all_at_once"), + get_minibar_option("auto_refresh_time"), + get_minibar_option("progress_bar"), + get_minibar_option("toc_markers"), + get_minibar_option("battery"), + get_minibar_option("time"), + get_minibar_option("page_progress"), + get_minibar_option("pages_left"), + get_minibar_option("percentage"), + get_minibar_option("book_time_to_read"), + get_minibar_option("chapter_time_to_read"), + }) do + table.insert(sub_items, v) + end table.insert(tab_item_table.setting, { text = _("Status bar"), - sub_item_table = { - get_minibar_option("all_at_once"), - get_minibar_option("auto_refresh_time"), - get_minibar_option("progress_bar"), - get_minibar_option("toc_markers"), - get_minibar_option("battery"), - get_minibar_option("time"), - get_minibar_option("page_progress"), - get_minibar_option("pages_left"), - get_minibar_option("percentage"), - get_minibar_option("book_time_to_read"), - get_minibar_option("chapter_time_to_read"), - } + sub_item_table = sub_items, }) end diff --git a/reader.lua b/reader.lua index 8b695ff7c..291a05912 100755 --- a/reader.lua +++ b/reader.lua @@ -101,7 +101,9 @@ local Font = require("ui/font") -- font local fontmap = G_reader_settings:readSetting("fontmap") if fontmap ~= nil then - Font.fontmap = fontmap + for k, v in pairs(fontmap) do + Font.fontmap[k] = v + end end -- last file local last_file = G_reader_settings:readSetting("lastfile")