2
0
mirror of https://github.com/koreader/koreader synced 2024-11-04 12:00:25 +00:00

Merge pull request #22 from chrox/master

add time information in menu footer by neoquest in hi-pda forum
This commit is contained in:
{Qingping,Dave} Hou 2013-03-29 07:43:33 -07:00
commit ba780e734a

View File

@ -164,6 +164,7 @@ TouchMenu = InputContainer:new{
item_height = scaleByDPI(50), item_height = scaleByDPI(50),
bordersize = scaleByDPI(2), bordersize = scaleByDPI(2),
padding = scaleByDPI(5), padding = scaleByDPI(5),
footer_height = scaleByDPI(50),
width = nil, width = nil,
height = nil, height = nil,
page = 1, page = 1,
@ -218,7 +219,14 @@ function TouchMenu:init()
face = Font:getFace("ffont", 20), face = Font:getFace("ffont", 20),
text = "", text = "",
} }
self.time_info = TextWidget:new{
face = Font:getFace("ffont", 20),
text = "",
}
local footer_width = self.width - self.padding*2 - self.bordersize*2 - 20
self.footer = HorizontalGroup:new{ self.footer = HorizontalGroup:new{
LeftContainer:new{
dimen = Geom:new{ w = footer_width*0.33, h = self.footer_height},
IconButton:new{ IconButton:new{
invert = true, invert = true,
icon_file = "resources/icons/appbar.chevron.up.png", icon_file = "resources/icons/appbar.chevron.up.png",
@ -227,7 +235,15 @@ function TouchMenu:init()
self:backToUpperMenu() self:backToUpperMenu()
end, end,
}, },
},
CenterContainer:new{
dimen = Geom:new{ w = self.width*0.33, h = self.footer_height},
self.footer_page, self.footer_page,
},
RightContainer:new{
dimen = Geom:new{ w = self.width*0.33, h = self.footer_height},
self.time_info,
}
} }
self[1] = FrameContainer:new{ self[1] = FrameContainer:new{
@ -310,6 +326,7 @@ function TouchMenu:updateItems()
table.insert(self.item_group, VerticalSpan:new{width = scaleByDPI(2)}) table.insert(self.item_group, VerticalSpan:new{width = scaleByDPI(2)})
table.insert(self.item_group, self.footer) table.insert(self.item_group, self.footer)
self.footer_page.text = "Page "..self.page.."/"..self.page_num self.footer_page.text = "Page "..self.page.."/"..self.page_num
self.time_info.text = os.date(" %H:%M ")
-- FIXME: this is a dirty hack to clear previous menus -- FIXME: this is a dirty hack to clear previous menus
-- refert to issue #664 -- refert to issue #664
UIManager.repaint_all = true UIManager.repaint_all = true