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
+15 -2
View File
@@ -94,10 +94,23 @@ func (a *PlaylistsPage) createListView() {
func (a *PlaylistsPage) createGridView(playlists []*subsonic.Playlist) {
model := createPlaylistGridViewModel(playlists)
a.gridView = widgets.NewFixedGridView(model, a.contr.App.ImageManager)
a.gridView.OnPlay = func(id string) {
a.contr.App.PlaybackManager.PlayPlaylist(id, 0)
a.gridView.OnPlay = func(id string, shuffle bool) {
go a.contr.App.PlaybackManager.PlayPlaylist(id, 0, shuffle)
}
a.gridView.OnAddToQueue = func(id string) {
go a.contr.App.PlaybackManager.LoadPlaylist(id, true, false)
}
a.gridView.OnShowItemPage = a.showPlaylistPage
a.gridView.OnAddToPlaylist = func(id string) {
go func() {
pl, err := a.contr.App.ServerManager.Server.GetPlaylist(id)
if err != nil {
log.Printf("error loading playlist: %s", err.Error())
return
}
a.contr.DoAddTracksToPlaylistWorkflow(sharedutil.TracksToIDs(pl.Entry))
}()
}
}
func (a *PlaylistsPage) showListView() {