Fix #136: add context menu to album and playlist grid views

This commit is contained in:
Drew Weymouth
2023-05-02 17:50:35 -07:00
parent 118b19aa13
commit 76657b5c1c
10 changed files with 122 additions and 97 deletions
+18 -6
View File
@@ -58,14 +58,16 @@ type GridViewState struct {
items []GridViewItemModel
itemsMutex sync.RWMutex
iter GridViewIterator
imageFetcher ImageFetcher
highestShown int
fetching bool
done bool
imageFetcher ImageFetcher
OnPlay func(string)
OnShowItemPage func(string)
OnShowSecondaryPage func(string)
OnPlay func(id string, shuffle bool)
OnAddToQueue func(id string)
OnAddToPlaylist func(id string)
OnShowItemPage func(id string)
OnShowSecondaryPage func(id string)
scrollPos float32
}
@@ -152,9 +154,14 @@ func (g *GridView) createGridWrapList() {
// create func
func() fyne.CanvasObject {
card := NewGridViewItem()
card.OnPlay = func() {
card.OnPlay = func(shuffle bool) {
if g.OnPlay != nil {
g.OnPlay(card.ItemID())
g.OnPlay(card.ItemID(), shuffle)
}
}
card.OnAddToQueue = func() {
if g.OnAddToQueue != nil {
g.OnAddToQueue(card.ItemID())
}
}
card.OnShowSecondaryPage = func() {
@@ -167,6 +174,11 @@ func (g *GridView) createGridWrapList() {
g.OnShowItemPage(card.ItemID())
}
}
card.OnAddToPlaylist = func() {
if g.OnAddToPlaylist != nil {
g.OnAddToPlaylist(card.ItemID())
}
}
return card
},
// update func