update rest of icons to themed
This commit is contained in:
@@ -4,10 +4,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"supersonic/backend"
|
"supersonic/backend"
|
||||||
"supersonic/res"
|
|
||||||
"supersonic/sharedutil"
|
"supersonic/sharedutil"
|
||||||
"supersonic/ui/controller"
|
"supersonic/ui/controller"
|
||||||
"supersonic/ui/layouts"
|
"supersonic/ui/layouts"
|
||||||
|
myTheme "supersonic/ui/theme"
|
||||||
"supersonic/ui/util"
|
"supersonic/ui/util"
|
||||||
"supersonic/ui/widgets"
|
"supersonic/ui/widgets"
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
playButton := widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), func() {
|
playButton := widget.NewButtonWithIcon("Play", theme.MediaPlayIcon(), func() {
|
||||||
go page.pm.PlayAlbum(page.albumID, 0)
|
go page.pm.PlayAlbum(page.albumID, 0)
|
||||||
})
|
})
|
||||||
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", res.ResShuffleInvertSvg, func() {
|
shuffleBtn := widgets.NewThemedIconButton(myTheme.IconNameShuffle, " Shuffle", func() {
|
||||||
page.pm.LoadTracks(page.tracklist.Tracks, false, true)
|
page.pm.LoadTracks(page.tracklist.Tracks, false, true)
|
||||||
page.pm.PlayFromBeginning()
|
page.pm.PlayFromBeginning()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"supersonic/sharedutil"
|
"supersonic/sharedutil"
|
||||||
"supersonic/ui/controller"
|
"supersonic/ui/controller"
|
||||||
"supersonic/ui/layouts"
|
"supersonic/ui/layouts"
|
||||||
|
myTheme "supersonic/ui/theme"
|
||||||
"supersonic/ui/util"
|
"supersonic/ui/util"
|
||||||
"supersonic/ui/widgets"
|
"supersonic/ui/widgets"
|
||||||
|
|
||||||
@@ -253,7 +254,7 @@ type ArtistPageHeader struct {
|
|||||||
similarArtists *fyne.Container
|
similarArtists *fyne.Container
|
||||||
favoriteBtn *widgets.FavoriteButton
|
favoriteBtn *widgets.FavoriteButton
|
||||||
playBtn *widget.Button
|
playBtn *widget.Button
|
||||||
playRadioBtn *widget.Button
|
playRadioBtn *widgets.ThemedIconButton
|
||||||
container *fyne.Container
|
container *fyne.Container
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +276,7 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
|||||||
}
|
}
|
||||||
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||||
a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), page.playAllTracks)
|
a.playBtn = widget.NewButtonWithIcon("Play Discography", theme.MediaPlayIcon(), page.playAllTracks)
|
||||||
a.playRadioBtn = widget.NewButtonWithIcon("Play Artist Radio", res.ResShuffleInvertSvg, page.playArtistRadio)
|
a.playRadioBtn = widgets.NewThemedIconButton(myTheme.IconNameShuffle, " Play Artist Radio", page.playArtistRadio)
|
||||||
a.biographyDisp.Wrapping = fyne.TextWrapWord
|
a.biographyDisp.Wrapping = fyne.TextWrapWord
|
||||||
a.ExtendBaseWidget(a)
|
a.ExtendBaseWidget(a)
|
||||||
a.createContainer()
|
a.createContainer()
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package browsing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"supersonic/backend"
|
"supersonic/backend"
|
||||||
"supersonic/res"
|
|
||||||
"supersonic/ui/controller"
|
"supersonic/ui/controller"
|
||||||
|
myTheme "supersonic/ui/theme"
|
||||||
"supersonic/ui/util"
|
"supersonic/ui/util"
|
||||||
"supersonic/ui/widgets"
|
"supersonic/ui/widgets"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ type GenrePage struct {
|
|||||||
searcher *widgets.Searcher
|
searcher *widgets.Searcher
|
||||||
searchText string
|
searchText string
|
||||||
titleDisp *widget.RichText
|
titleDisp *widget.RichText
|
||||||
playRandom *widget.Button
|
playRandom *widgets.ThemedIconButton
|
||||||
|
|
||||||
OnPlayAlbum func(string, int)
|
OnPlayAlbum func(string, int)
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ func NewGenrePage(genre string, contr *controller.Controller, pm *backend.Playba
|
|||||||
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
||||||
SizeName: theme.SizeNameHeadingText,
|
SizeName: theme.SizeNameHeadingText,
|
||||||
}
|
}
|
||||||
g.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, g.playRandomSongs)
|
g.playRandom = widgets.NewThemedIconButton(myTheme.IconNameShuffle, " Play random", g.playRandomSongs)
|
||||||
iter := g.lm.GenreIter(g.genre)
|
iter := g.lm.GenreIter(g.genre)
|
||||||
g.grid = widgets.NewGridView(widgets.NewGridViewAlbumIterator(iter), g.im)
|
g.grid = widgets.NewGridView(widgets.NewGridViewAlbumIterator(iter), g.im)
|
||||||
g.grid.OnPlay = g.onPlayAlbum
|
g.grid.OnPlay = g.onPlayAlbum
|
||||||
@@ -93,8 +93,8 @@ func restoreGenrePage(saved *savedGenrePage) *GenrePage {
|
|||||||
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
g.titleDisp.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
||||||
SizeName: theme.SizeNameHeadingText,
|
SizeName: theme.SizeNameHeadingText,
|
||||||
}
|
}
|
||||||
g.playRandom = widget.NewButtonWithIcon("Play random", res.ResShuffleInvertSvg, g.playRandomSongs)
|
g.playRandom = widgets.NewThemedIconButton(myTheme.IconNameShuffle, "Play random", g.playRandomSongs)
|
||||||
g.grid = widgets.NewGridViewFromState(saved.gridState)
|
g.grid = widgets.NewAlbumGridFromState(saved.gridState)
|
||||||
g.searcher = widgets.NewSearcher()
|
g.searcher = widgets.NewSearcher()
|
||||||
g.searcher.OnSearched = g.OnSearched
|
g.searcher.OnSearched = g.OnSearched
|
||||||
g.searcher.Entry.Text = saved.searchText
|
g.searcher.Entry.Text = saved.searchText
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"supersonic/sharedutil"
|
"supersonic/sharedutil"
|
||||||
"supersonic/ui/controller"
|
"supersonic/ui/controller"
|
||||||
"supersonic/ui/layouts"
|
"supersonic/ui/layouts"
|
||||||
|
myTheme "supersonic/ui/theme"
|
||||||
"supersonic/ui/util"
|
"supersonic/ui/util"
|
||||||
"supersonic/ui/widgets"
|
"supersonic/ui/widgets"
|
||||||
|
|
||||||
@@ -205,7 +206,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
|||||||
page.pm.PlayFromBeginning()
|
page.pm.PlayFromBeginning()
|
||||||
})
|
})
|
||||||
// TODO: find way to pad shuffle svg rather than using a space in the label string
|
// TODO: find way to pad shuffle svg rather than using a space in the label string
|
||||||
shuffleBtn := widget.NewButtonWithIcon(" Shuffle", res.ResShuffleInvertSvg, func() {
|
shuffleBtn := widgets.NewThemedIconButton(myTheme.IconNameShuffle, " Shuffle", func() {
|
||||||
page.pm.LoadTracks(page.tracklist.Tracks, false /*append*/, true /*shuffle*/)
|
page.pm.LoadTracks(page.tracklist.Tracks, false /*append*/, true /*shuffle*/)
|
||||||
page.pm.PlayFromBeginning()
|
page.pm.PlayFromBeginning()
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ func (m *MyTheme) Color(name fyne.ThemeColorName, _ fyne.ThemeVariant) color.Col
|
|||||||
if variant == theme.VariantDark {
|
if variant == theme.VariantDark {
|
||||||
return color.RGBA{R: 35, G: 35, B: 35, A: 255}
|
return color.RGBA{R: 35, G: 35, B: 35, A: 255}
|
||||||
}
|
}
|
||||||
return color.RGBA{R: 225, G: 225, B: 225, A: 255}
|
return color.RGBA{R: 225, G: 223, B: 225, A: 255}
|
||||||
case theme.ColorNameScrollBar:
|
case theme.ColorNameScrollBar:
|
||||||
if variant == theme.VariantDark {
|
if variant == theme.VariantDark {
|
||||||
return theme.DarkTheme().Color(theme.ColorNameForeground, variant)
|
return theme.DarkTheme().Color(theme.ColorNameForeground, variant)
|
||||||
|
|||||||
@@ -61,3 +61,21 @@ func (t *ThemedRectangle) Refresh() {
|
|||||||
func (t *ThemedRectangle) CreateRenderer() fyne.WidgetRenderer {
|
func (t *ThemedRectangle) CreateRenderer() fyne.WidgetRenderer {
|
||||||
return widget.NewSimpleRenderer(t.rect)
|
return widget.NewSimpleRenderer(t.rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ThemedTappableIcon struct {
|
||||||
|
TappableIcon
|
||||||
|
|
||||||
|
IconName fyne.ThemeIconName
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewThemedTappableIcon(iconName fyne.ThemeIconName) *ThemedTappableIcon {
|
||||||
|
t := &ThemedTappableIcon{IconName: iconName}
|
||||||
|
t.ExtendBaseWidget(t)
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *ThemedTappableIcon) Refresh() {
|
||||||
|
icon := fyne.CurrentApp().Settings().Theme().Icon(t.IconName)
|
||||||
|
t.TappableIcon.Icon.Resource = icon
|
||||||
|
t.TappableIcon.Refresh()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package widgets
|
package widgets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"supersonic/res"
|
|
||||||
"supersonic/sharedutil"
|
"supersonic/sharedutil"
|
||||||
"supersonic/ui/layouts"
|
"supersonic/ui/layouts"
|
||||||
"supersonic/ui/os"
|
"supersonic/ui/os"
|
||||||
|
myTheme "supersonic/ui/theme"
|
||||||
"supersonic/ui/util"
|
"supersonic/ui/util"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -524,7 +524,7 @@ func NewTrackRow(tracklist *Tracklist, playingIcon fyne.CanvasObject) *TrackRow
|
|||||||
t.album.OnTapped = func() { tracklist.onAlbumTapped(t.albumID) }
|
t.album.OnTapped = func() { tracklist.onAlbumTapped(t.albumID) }
|
||||||
t.dur = newTrailingAlignRichText()
|
t.dur = newTrailingAlignRichText()
|
||||||
t.year = newTrailingAlignRichText()
|
t.year = newTrailingAlignRichText()
|
||||||
favorite := NewTappbaleIcon(res.ResHeartOutlineInvertPng)
|
favorite := NewThemedTappableIcon(myTheme.IconNameNotFavorite)
|
||||||
favorite.OnTapped = t.toggleFavorited
|
favorite.OnTapped = t.toggleFavorited
|
||||||
t.favorite = container.NewCenter(favorite)
|
t.favorite = container.NewCenter(favorite)
|
||||||
t.rating = NewStarRating()
|
t.rating = NewStarRating()
|
||||||
@@ -623,10 +623,10 @@ func (t *TrackRow) Update(tr *subsonic.Child, rowNum int) {
|
|||||||
// Render favorite column
|
// Render favorite column
|
||||||
if tr.Starred.IsZero() {
|
if tr.Starred.IsZero() {
|
||||||
t.isFavorite = false
|
t.isFavorite = false
|
||||||
t.favorite.Objects[0].(*TappableIcon).Resource = res.ResHeartOutlineInvertPng
|
t.favorite.Objects[0].(*ThemedTappableIcon).IconName = myTheme.IconNameNotFavorite
|
||||||
} else {
|
} else {
|
||||||
t.isFavorite = true
|
t.isFavorite = true
|
||||||
t.favorite.Objects[0].(*TappableIcon).Resource = res.ResHeartFilledInvertPng
|
t.favorite.Objects[0].(*ThemedTappableIcon).IconName = myTheme.IconNameFavorite
|
||||||
}
|
}
|
||||||
|
|
||||||
t.rating.Rating = tr.UserRating
|
t.rating.Rating = tr.UserRating
|
||||||
@@ -648,12 +648,12 @@ func (t *TrackRow) Update(tr *subsonic.Child, rowNum int) {
|
|||||||
|
|
||||||
func (t *TrackRow) toggleFavorited() {
|
func (t *TrackRow) toggleFavorited() {
|
||||||
if t.isFavorite {
|
if t.isFavorite {
|
||||||
t.favorite.Objects[0].(*TappableIcon).Resource = res.ResHeartOutlineInvertPng
|
t.favorite.Objects[0].(*ThemedTappableIcon).IconName = myTheme.IconNameNotFavorite
|
||||||
t.favorite.Refresh()
|
t.favorite.Refresh()
|
||||||
t.isFavorite = false
|
t.isFavorite = false
|
||||||
t.tracklist.onSetFavorite(t.trackID, false)
|
t.tracklist.onSetFavorite(t.trackID, false)
|
||||||
} else {
|
} else {
|
||||||
t.favorite.Objects[0].(*TappableIcon).Resource = res.ResHeartFilledInvertPng
|
t.favorite.Objects[0].(*ThemedTappableIcon).IconName = myTheme.IconNameFavorite
|
||||||
t.favorite.Refresh()
|
t.favorite.Refresh()
|
||||||
t.isFavorite = true
|
t.isFavorite = true
|
||||||
t.tracklist.onSetFavorite(t.trackID, true)
|
t.tracklist.onSetFavorite(t.trackID, true)
|
||||||
|
|||||||
Reference in New Issue
Block a user