fix: clear stale cover art and backgrounds on tracks without art (#957)
* fix: ensure load callback fires on error Calls callOnLoaded(nil) when image loading fails. This fixes the bottomplayer silently retaining stale images by ensuring consumers always get a callback and can clear their display state. * fix: clear background layers on missing art nil state now hides the blurred background widgets or animates the gradient to transparent, depending on the active configuration
This commit is contained in:
@@ -330,6 +330,25 @@ func (a *NowPlayingPage) onImageLoaded(img image.Image, err error) {
|
||||
|
||||
fyne.Do(func() { a.card.SetCoverImage(img) })
|
||||
if img == nil {
|
||||
if a.conf.UseBackgroundImage {
|
||||
fyne.Do(func() {
|
||||
if !a.backgroundImgA.Hidden {
|
||||
a.backgroundImgA.Hide()
|
||||
}
|
||||
if !a.backgroundImgB.Hidden {
|
||||
a.backgroundImgB.Hide()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if a.backgroundGradient.StartColor != color.Transparent {
|
||||
anim := canvas.NewColorRGBAAnimation(
|
||||
a.backgroundGradient.StartColor, color.Transparent, myTheme.AnimationDurationMedium, func(c color.Color) {
|
||||
a.backgroundGradient.StartColor = c
|
||||
a.backgroundGradient.Refresh()
|
||||
})
|
||||
anim.Start()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ func (i *ThumbnailLoader) Load(coverID string) {
|
||||
fyne.Do(func() {
|
||||
if err != nil {
|
||||
log.Printf("Error loading cover image: %s", err.Error())
|
||||
i.callOnLoaded(nil)
|
||||
} else {
|
||||
i.callOnLoaded(img)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user