Notification: closed by any event, but not consuming it

Make Notification have toast=true, and UIManager deal
specifically with such widget:
a "toast" widget gets closed by any event, and let
the event be handled by a lower widget.
This should allow us to not wait or tap to get rid
of a notification, and just go on with what we're
doing.
Also make them have a default timeout of 2s,
used with all existing ones.
This commit is contained in:
poire-z
2021-01-11 18:14:12 +01:00
parent f1046f07a9
commit 8f79c662cf
13 changed files with 43 additions and 56 deletions

View File

@@ -211,7 +211,6 @@ function ReaderFont:onSetFontSize(new_size)
self.ui:handleEvent(Event:new("UpdatePos"))
UIManager:show(Notification:new{
text = T( _("Font size set to %1."), self.font_size),
timeout = 2,
})
return true
@@ -221,7 +220,6 @@ function ReaderFont:onSetLineSpace(space)
self.line_space_percent = math.min(200, math.max(50, space))
UIManager:show(Notification:new{
text = T( _("Line spacing set to %1%."), self.line_space_percent),
timeout = 2,
})
self.ui.document:setInterlineSpacePercent(self.line_space_percent)
self.ui:handleEvent(Event:new("UpdatePos"))
@@ -269,7 +267,6 @@ function ReaderFont:onSetFontGamma(gamma)
local gamma_level = self.ui.document:getGammaLevel()
UIManager:show(Notification:new{
text = T( _("Font gamma set to %1."), gamma_level),
timeout = 2,
})
self.ui:handleEvent(Event:new("RedrawCurrentView"))
return true
@@ -293,7 +290,6 @@ function ReaderFont:setFont(face)
self.font_face = face
UIManager:show(Notification:new{
text = T( _("Redrawing with font %1."), face),
timeout = 2,
})
self.ui.document:setFontFace(face)