standardize info message between lyrics viewer and radios page

This commit is contained in:
Drew Weymouth
2024-06-02 09:47:18 -07:00
parent 457a894b56
commit bf4d187ba2
3 changed files with 37 additions and 18 deletions
+8 -6
View File
@@ -12,7 +12,7 @@ import (
type LyricsViewer struct {
widget.BaseWidget
noLyricsLabel widget.Label
noLyricsMsg fyne.CanvasObject
viewer *fynelyrics.LyricsViewer
lyrics *mediaprovider.Lyrics
nextLyricLine int
@@ -27,11 +27,13 @@ type LyricsViewer struct {
}
func NewLyricsViewer() *LyricsViewer {
l := &LyricsViewer{noLyricsLabel: widget.Label{
Text: "Lyrics not available",
}, isEmpty: true}
l := &LyricsViewer{
noLyricsMsg: container.NewCenter(NewInfoMessage(
"Lyrics not available", "")),
isEmpty: true,
}
l.ExtendBaseWidget(l)
l.container = container.NewStack(&l.noLyricsLabel)
l.container = container.NewStack(l.noLyricsMsg)
return l
}
@@ -41,7 +43,7 @@ func (l *LyricsViewer) SetLyrics(lyrics *mediaprovider.Lyrics) {
l.firstUpdate = true
if lyrics == nil || len(lyrics.Lines) == 0 {
if !l.isEmpty {
l.container.Objects[0] = &l.noLyricsLabel
l.container.Objects[0] = l.noLyricsMsg
l.isEmpty = true
l.Refresh()
}