diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index 6ce03f4be..dcc8db3f5 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -8,6 +8,7 @@ local BottomContainer = require("ui/widget/container/bottomcontainer") local UnderlineContainer = require("ui/widget/container/underlinecontainer") local FocusManager = require("ui/widget/focusmanager") local TextWidget = require("ui/widget/textwidget") +local LineWidget = require("ui/widget/linewidget") local OverlapGroup = require("ui/widget/overlapgroup") local VerticalSpan = require("ui/widget/verticalspan") local HorizontalSpan = require("ui/widget/horizontalspan") @@ -109,6 +110,45 @@ function MenuCloseButton:onClose() return true end +--[[ +Widget that displays a solid line in menu +--]] +local SeparatorMenuItem = InputContainer:new{ + style = "solid", + dimen = nil, + _line_container = nil, +} + +function SeparatorMenuItem:init() + self._line_container = CenterContainer:new{ + vertical_align = "center", + dimen = Geom:new { + w = self.dimen.w, + h = self.dimen.h + }, + HorizontalGroup:new { + align = "center", + OverlapGroup:new { + dimen = Geom:new { w = self.dimen.w, h = Screen:scaleBySize(2) }, + LineWidget:new { + style = self.style, + dimen = Geom:new { w = self.dimen.w - 30, h = Screen:scaleBySize(2) }, + } + }, + } + } + + self[1] = FrameContainer:new { + bordersize = 0, + padding = 0, + HorizontalGroup:new { + align = "center", + HorizontalSpan:new { width = 15 }, + self._line_container + } + } +end + --[[ Widget that displays an item for menu --]] @@ -641,20 +681,27 @@ function Menu:updateItems(select_number) item_shortcut = "Ent" end end - local item_tmp = MenuItem:new{ - show_parent = self.show_parent, - state = self.item_table[i].state, - state_size = self.state_size or {}, - text = self.item_table[i].text, - mandatory = self.item_table[i].mandatory, - bold = self.item_table.current == i, - face = self.cface, - dimen = self.item_dimen:new(), - shortcut = item_shortcut, - shortcut_style = shortcut_style, - table = self.item_table[i], - menu = self, - } + local item_tmp + if self.item_table[i].text == "-" then + item_tmp = SeparatorMenuItem:new{ + dimen = self.item_dimen:new{ h = Screen:scaleBySize(10) }, + } + else + item_tmp = MenuItem:new{ + show_parent = self.show_parent, + state = self.item_table[i].state, + state_size = self.state_size or {}, + text = self.item_table[i].text, + mandatory = self.item_table[i].mandatory, + bold = self.item_table.current == i, + face = self.cface, + dimen = self.item_dimen:new(), + shortcut = item_shortcut, + shortcut_style = shortcut_style, + table = self.item_table[i], + menu = self, + } + end table.insert(self.item_group, item_tmp) -- this is for focus manager table.insert(self.layout, {item_tmp}) diff --git a/plugins/statistics.koplugin/main.lua b/plugins/statistics.koplugin/main.lua index 8be4dbb52..25f13762d 100755 --- a/plugins/statistics.koplugin/main.lua +++ b/plugins/statistics.koplugin/main.lua @@ -318,7 +318,7 @@ function ReaderStatistics:updateTotalStat() DEBUG ("TOTALSTATS", total_stats) table.insert(total_stats, 1, { text = _("Total hours read"), mandatory = util.secondsToClock(total_books_time, false) }) - table.insert(total_stats, 2, { text = _("----------------------------------------------------") }) + table.insert(total_stats, 2, { text = "-" }) table.insert(total_stats, 3, { text = self.data.title, mandatory = util.secondsToClock(self.data.total_time_in_sec, false),