diff --git a/ui/browsing/favoritespage.go b/ui/browsing/favoritespage.go index 41a0027e..db69f7ed 100644 --- a/ui/browsing/favoritespage.go +++ b/ui/browsing/favoritespage.go @@ -132,6 +132,12 @@ func (a *FavoritesPage) Route() controller.Route { return controller.FavoritesRoute() } +func (a *FavoritesPage) Tapped(*fyne.PointEvent) { + if a.tracklistCtr != nil { + a.tracklistCtr.Objects[0].(*widgets.Tracklist).UnselectAll() + } +} + func (a *FavoritesPage) Reload() { // reload favorite albums view if a.searchText != "" { diff --git a/ui/controller/controller.go b/ui/controller/controller.go index 324e5a8c..f2319831 100644 --- a/ui/controller/controller.go +++ b/ui/controller/controller.go @@ -101,8 +101,8 @@ func (m *Controller) ConnectTracklistActions(tracklist *widgets.Tracklist) { m.App.PlaybackManager.LoadTracks(tracklist.Tracks, false, false) m.App.PlaybackManager.PlayTrackAt(idx) } - tracklist.OnPlaySelection = func(tracks []*subsonic.Child) { - m.App.PlaybackManager.LoadTracks(tracks, false, false) + tracklist.OnPlaySelection = func(tracks []*subsonic.Child, shuffle bool) { + m.App.PlaybackManager.LoadTracks(tracks, false, shuffle) m.App.PlaybackManager.PlayFromBeginning() } tracklist.OnSetFavorite = m.SetTrackFavorites diff --git a/ui/widgets/tracklist.go b/ui/widgets/tracklist.go index c903478b..0bcd29d0 100644 --- a/ui/widgets/tracklist.go +++ b/ui/widgets/tracklist.go @@ -60,7 +60,7 @@ type Tracklist struct { // user action callbacks OnPlayTrackAt func(int) - OnPlaySelection func(tracks []*subsonic.Child) + OnPlaySelection func(tracks []*subsonic.Child, shuffle bool) OnAddToQueue func(trackIDs []*subsonic.Child) OnAddToPlaylist func(trackIDs []string) OnSetFavorite func(trackIDs []string, fav bool) @@ -283,7 +283,13 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) { t.ctxMenu.Items = append(t.ctxMenu.Items, fyne.NewMenuItem("Play", func() { if t.OnPlaySelection != nil { - t.OnPlaySelection(t.selectedTracks()) + t.OnPlaySelection(t.selectedTracks(), false) + } + })) + t.ctxMenu.Items = append(t.ctxMenu.Items, + fyne.NewMenuItem("Shuffle", func() { + if t.OnPlaySelection != nil { + t.OnPlaySelection(t.selectedTracks(), true) } })) t.ctxMenu.Items = append(t.ctxMenu.Items,