hook up tap handling and action dispatch

This commit is contained in:
Drew Weymouth
2024-12-28 20:06:15 -08:00
parent f702ef5c31
commit 0f74bee746
4 changed files with 136 additions and 31 deletions
+7 -1
View File
@@ -133,6 +133,7 @@ type GridViewState struct {
OnPlayNext func(id string)
OnAddToQueue func(id string)
OnAddToPlaylist func(id string)
OnFavorite func(id string, fav bool)
OnDownload func(id string)
OnShare func(id string)
OnShowItemPage func(id string)
@@ -280,6 +281,11 @@ func (g *GridView) createNewItemCard() fyne.CanvasObject {
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)
card.ImgLoader.OnBeforeLoad = func() { card.Cover.SetImage(nil) }
card.OnPlay = func() { g.onPlay(card.ItemID(), false) }
card.OnFavorite = func(fav bool) {
if g.OnFavorite != nil {
g.OnFavorite(card.itemID, fav)
}
}
card.OnShowSecondaryPage = func(id string) {
if g.OnShowSecondaryPage != nil {
g.OnShowSecondaryPage(id)
@@ -342,7 +348,7 @@ func (g *GridView) doUpdateItemCard(itemIdx int, card *GridViewItem) {
}
card.Cover.Im.PlaceholderIcon = g.Placeholder
g.stateMutex.Unlock()
card.Update(item)
card.Update(&item)
card.ImgLoader.Load(item.CoverArtID)
// if user has scrolled near the bottom, fetch more