use API for refresh when closing widgets in message popups

This commit is contained in:
Hans-Werner Hilse
2014-11-30 22:25:23 +00:00
parent 1091a8a3b9
commit e8642fbad7
2 changed files with 23 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ local Notification = InputContainer:new{
timeout = nil,
margin = 5,
padding = 5,
closed = false,
}
function Notification:init()
@@ -55,17 +56,25 @@ function Notification:init()
}
end
function Notification:close()
if not self.closed then
self.closed = true
UIManager:close(self, "partial", self[1][1].dimen)
end
end
function Notification:onShow()
-- triggered by the UIManager after we got successfully shown (not yet painted)
if self.timeout then
UIManager:scheduleIn(self.timeout, function() UIManager:close(self) end)
UIManager:scheduleIn(self.timeout, function() self:close() end)
end
self.closed = false
return true
end
function Notification:onAnyKeyPressed()
-- triggered by our defined key events
UIManager:close(self)
self:close()
return true
end