make playlist image clickable to show pop-up
This commit is contained in:
@@ -229,6 +229,8 @@ type PlaylistPageHeader struct {
|
|||||||
ownerLabel *widget.Label
|
ownerLabel *widget.Label
|
||||||
trackTimeLabel *widget.Label
|
trackTimeLabel *widget.Label
|
||||||
|
|
||||||
|
fullSizeCoverFetching bool
|
||||||
|
|
||||||
container *fyne.Container
|
container *fyne.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,6 +241,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
|||||||
a.ExtendBaseWidget(a)
|
a.ExtendBaseWidget(a)
|
||||||
|
|
||||||
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
|
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
|
||||||
|
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||||
a.titleLabel = util.NewTruncatingRichText()
|
a.titleLabel = util.NewTruncatingRichText()
|
||||||
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
||||||
SizeName: theme.SizeNameHeadingText,
|
SizeName: theme.SizeNameHeadingText,
|
||||||
@@ -324,18 +327,34 @@ func (a *PlaylistPageHeader) Update(playlist *mediaprovider.PlaylistWithTracks)
|
|||||||
var haveCover bool
|
var haveCover bool
|
||||||
if playlist.CoverArtID != "" {
|
if playlist.CoverArtID != "" {
|
||||||
if im, err := a.page.im.GetCoverThumbnail(playlist.CoverArtID); err == nil && im != nil {
|
if im, err := a.page.im.GetCoverThumbnail(playlist.CoverArtID); err == nil && im != nil {
|
||||||
a.image.SetImage(im, false /*tappable*/)
|
a.image.SetImage(im, true /*tappable*/)
|
||||||
haveCover = true
|
haveCover = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !haveCover {
|
if !haveCover {
|
||||||
if im, err := a.page.im.GetCoverThumbnail(playlist.ID); err == nil && im != nil {
|
if im, err := a.page.im.GetCoverThumbnail(playlist.ID); err == nil && im != nil {
|
||||||
a.image.SetImage(im, false)
|
a.image.SetImage(im, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a.Refresh()
|
a.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *PlaylistPageHeader) showPopUpCover() {
|
||||||
|
if a.fullSizeCoverFetching || a.playlistInfo == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
a.fullSizeCoverFetching = true
|
||||||
|
defer func() { a.fullSizeCoverFetching = false }()
|
||||||
|
cover, err := a.page.im.GetFullSizeCoverArt(a.playlistInfo.CoverArtID)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("error getting full size playlist cover: %s", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if a.page != nil {
|
||||||
|
a.page.contr.ShowPopUpImage(cover)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *PlaylistPageHeader) formatPlaylistOwnerStr(p *mediaprovider.PlaylistWithTracks) string {
|
func (a *PlaylistPageHeader) formatPlaylistOwnerStr(p *mediaprovider.PlaylistWithTracks) string {
|
||||||
pubPriv := lang.L("Public playlist by")
|
pubPriv := lang.L("Public playlist by")
|
||||||
if !p.Public {
|
if !p.Public {
|
||||||
|
|||||||
Reference in New Issue
Block a user