mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add dummy span widgets & make clock count on seconds
This commit is contained in:
@@ -150,9 +150,7 @@ function ConfirmBox:init()
|
||||
ImageWidget:new{
|
||||
file = "resources/info-i.png"
|
||||
},
|
||||
Widget:new{
|
||||
dimen = { w = 10, h = 0 }
|
||||
},
|
||||
HorizontalSpan:new{ width = 10 },
|
||||
VerticalGroup:new{
|
||||
align = "left",
|
||||
TextWidget:new{
|
||||
|
||||
22
widget.lua
22
widget.lua
@@ -276,6 +276,17 @@ function HorizontalGroup:free()
|
||||
WidgetContainer.free(self)
|
||||
end
|
||||
|
||||
--[[
|
||||
Dummy Widget that reserves horizontal space
|
||||
]]
|
||||
HorizontalSpan = Widget:new{
|
||||
width = 0,
|
||||
}
|
||||
|
||||
function HorizontalSpan:getSize()
|
||||
return {w = self.width, h = 0}
|
||||
end
|
||||
|
||||
--[[
|
||||
A Layout widget that puts objects under each other
|
||||
]]
|
||||
@@ -324,6 +335,17 @@ function VerticalGroup:free()
|
||||
WidgetContainer.free(self)
|
||||
end
|
||||
|
||||
--[[
|
||||
Dummy Widget that reserves vertical space
|
||||
]]
|
||||
VerticalSpan = Widget:new{
|
||||
width = 0,
|
||||
}
|
||||
|
||||
function VerticalSpan:getSize()
|
||||
return {w = 0, h = self.width}
|
||||
end
|
||||
|
||||
--[[
|
||||
an UnderlineContainer is a WidgetContainer that is able to paint
|
||||
a line under its child node
|
||||
|
||||
@@ -53,7 +53,7 @@ function Clock:schedFunc()
|
||||
UIManager:setDirty(self)
|
||||
-- reschedule
|
||||
-- TODO: wait until next real minute shift
|
||||
UIManager:scheduleIn(60, function() self:schedFunc() end)
|
||||
UIManager:scheduleIn(1, function() self:schedFunc() end)
|
||||
end
|
||||
|
||||
function Clock:onShow()
|
||||
@@ -65,7 +65,7 @@ function Clock:getTextWidget()
|
||||
return CenterContainer:new{
|
||||
dimen = { w = 300, h = 25 },
|
||||
TextWidget:new{
|
||||
text = os.date("%H:%M"),
|
||||
text = os.date("%H:%M:%S"),
|
||||
face = Font:getFace("cfont", 12)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user