switch to ImagePlaceholder on album page
This commit is contained in:
@@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/dweymouth/supersonic/ui/widgets"
|
"github.com/dweymouth/supersonic/ui/widgets"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
@@ -171,7 +170,7 @@ type AlbumPageHeader struct {
|
|||||||
|
|
||||||
page *AlbumPage
|
page *AlbumPage
|
||||||
|
|
||||||
cover *widgets.TappableImage
|
cover *widgets.ImagePlaceholder
|
||||||
titleLabel *widget.RichText
|
titleLabel *widget.RichText
|
||||||
artistLabel *widgets.MultiHyperlink
|
artistLabel *widgets.MultiHyperlink
|
||||||
genreLabel *widgets.MultiHyperlink
|
genreLabel *widgets.MultiHyperlink
|
||||||
@@ -189,9 +188,8 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
// be directly captured in a closure throughout this function!
|
// be directly captured in a closure throughout this function!
|
||||||
a := &AlbumPageHeader{page: page}
|
a := &AlbumPageHeader{page: page}
|
||||||
a.ExtendBaseWidget(a)
|
a.ExtendBaseWidget(a)
|
||||||
a.cover = widgets.NewTappableImage(func(*fyne.PointEvent) { go a.showPopUpCover() })
|
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
|
||||||
a.cover.FillMode = canvas.ImageFillContain
|
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||||
a.cover.SetMinSize(fyne.NewSize(225, 225))
|
|
||||||
|
|
||||||
a.titleLabel = widget.NewRichTextWithText("")
|
a.titleLabel = widget.NewRichTextWithText("")
|
||||||
a.titleLabel.Wrapping = fyne.TextTruncate
|
a.titleLabel.Wrapping = fyne.TextTruncate
|
||||||
@@ -230,7 +228,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
a.page.contr.ShowDownloadDialog(a.page.tracks, a.titleLabel.String())
|
a.page.contr.ShowDownloadDialog(a.page.tracks, a.titleLabel.String())
|
||||||
}),
|
}),
|
||||||
fyne.NewMenuItem("Show Info...", func() {
|
fyne.NewMenuItem("Show Info...", func() {
|
||||||
a.page.contr.ShowAlbumInfoDialog(a.albumID, a.titleLabel.String(), a.cover.Image.Image)
|
a.page.contr.ShowAlbumInfoDialog(a.albumID, a.titleLabel.String(), a.cover.Image())
|
||||||
}))
|
}))
|
||||||
pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a))
|
pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a))
|
||||||
}
|
}
|
||||||
@@ -271,7 +269,7 @@ func (a *AlbumPageHeader) Update(album *mediaprovider.AlbumWithTracks, im *backe
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if cover, err := im.GetCoverThumbnail(album.CoverArtID); err == nil {
|
if cover, err := im.GetCoverThumbnail(album.CoverArtID); err == nil {
|
||||||
a.cover.Image.Image = cover
|
a.cover.SetImage(cover, true)
|
||||||
a.cover.Refresh()
|
a.cover.Refresh()
|
||||||
} else {
|
} else {
|
||||||
log.Printf("error fetching cover: %v", err)
|
log.Printf("error fetching cover: %v", err)
|
||||||
@@ -288,7 +286,7 @@ func (a *AlbumPageHeader) Clear() {
|
|||||||
a.miscLabel.SetText("")
|
a.miscLabel.SetText("")
|
||||||
a.toggleFavButton.IsFavorited = false
|
a.toggleFavButton.IsFavorited = false
|
||||||
a.fullSizeCoverFetching = false
|
a.fullSizeCoverFetching = false
|
||||||
a.cover.Image.Image = nil
|
a.cover.SetImage(nil, false)
|
||||||
a.cover.Refresh()
|
a.cover.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ func (a *AlbumInfoDialog) buildMainContainer(albumInfo *mediaprovider.AlbumInfo,
|
|||||||
iconImage := canvas.NewImageFromImage(albumCover)
|
iconImage := canvas.NewImageFromImage(albumCover)
|
||||||
iconImage.FillMode = canvas.ImageFillContain
|
iconImage.FillMode = canvas.ImageFillContain
|
||||||
iconImage.SetMinSize(fyne.NewSize(100, 100))
|
iconImage.SetMinSize(fyne.NewSize(100, 100))
|
||||||
|
iconImage.Hidden = albumCover == nil
|
||||||
title := widget.NewRichTextWithText(albumName)
|
title := widget.NewRichTextWithText(albumName)
|
||||||
title.Segments[0].(*widget.TextSegment).Style.TextStyle.Bold = true
|
title.Segments[0].(*widget.TextSegment).Style.TextStyle.Bold = true
|
||||||
title.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameSubHeadingText
|
title.Segments[0].(*widget.TextSegment).Style.SizeName = theme.SizeNameSubHeadingText
|
||||||
|
|||||||
Reference in New Issue
Block a user