ButtonProgressWidget: Make hold_callback optional (#8940)

We don't need one in FrontLightWidget ;).

Fix https://github.com/koreader/koreader/issues/8913#issuecomment-1074915143
reviewable/pr8942/r1
NiLuJe 2 years ago committed by GitHub
parent c04fba943d
commit 23bce343bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -98,9 +98,7 @@ function ButtonProgressWidget:update()
self.callback("-") self.callback("-")
self:update() self:update()
end, end,
hold_callback = function() hold_callback = self.hold_callback and function() self.hold_callback("-") end,
self.hold_callback("-")
end,
} }
if self.thin_grey_style then if self.thin_grey_style then
button.frame.color = Blitbuffer.COLOR_DARK_GRAY button.frame.color = Blitbuffer.COLOR_DARK_GRAY
@ -147,9 +145,7 @@ function ButtonProgressWidget:update()
self:update() self:update()
end, end,
no_focus = highlighted, no_focus = highlighted,
hold_callback = function() hold_callback = self.hold_callback and function() self.hold_callback(i) end,
self.hold_callback(i)
end,
} }
if self.thin_grey_style then if self.thin_grey_style then
if is_default then if is_default then
@ -204,9 +200,7 @@ function ButtonProgressWidget:update()
self.callback("+") self.callback("+")
self:update() self:update()
end, end,
hold_callback = function() hold_callback = self.hold_callback and function() self.hold_callback("+") end,
self.hold_callback("+")
end,
} }
if self.thin_grey_style then if self.thin_grey_style then
@ -241,9 +235,7 @@ function ButtonProgressWidget:update()
self.callback("") self.callback("")
self:update() self:update()
end, end,
hold_callback = function() hold_callback = self.hold_callback and function() self.hold_callback("") end,
self.hold_callback("")
end,
} }
if self.thin_grey_style then if self.thin_grey_style then
button.frame.color = Blitbuffer.COLOR_DARK_GRAY button.frame.color = Blitbuffer.COLOR_DARK_GRAY

Loading…
Cancel
Save