mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #1808 from apletnev/#1807
#1807 FR: Add separator into menu
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user