use rounded image corners (TODO: allow disabling this)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/theme"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
|
|||||||
pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) }))
|
pm.OnStopped(util.FyneDoFunc(func() { bp.Controls.SetPlaying(false) }))
|
||||||
|
|
||||||
bp.NowPlaying = widgets.NewNowPlayingCard()
|
bp.NowPlaying = widgets.NewNowPlayingCard()
|
||||||
|
bp.NowPlaying.ImageCornerRadius = theme.InputRadiusSize()
|
||||||
bp.NowPlaying.OnCoverTapped = func() {
|
bp.NowPlaying.OnCoverTapped = func() {
|
||||||
contr.NavigateTo(controller.NowPlayingRoute())
|
contr.NavigateTo(controller.NowPlayingRoute())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
a.ExtendBaseWidget(a)
|
a.ExtendBaseWidget(a)
|
||||||
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
|
a.cover = widgets.NewImagePlaceholder(myTheme.AlbumIcon, 225)
|
||||||
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
a.cover.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||||
|
a.cover.CornerRadius = theme.InputRadiusSize()
|
||||||
|
|
||||||
a.titleLabel = widget.NewRichTextWithText("")
|
a.titleLabel = widget.NewRichTextWithText("")
|
||||||
a.titleLabel.Truncation = fyne.TextTruncateEllipsis
|
a.titleLabel.Truncation = fyne.TextTruncateEllipsis
|
||||||
|
|||||||
@@ -503,6 +503,7 @@ func NewArtistPageHeader(page *ArtistPage) *ArtistPageHeader {
|
|||||||
}
|
}
|
||||||
a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225)
|
a.artistImage = widgets.NewImagePlaceholder(myTheme.ArtistIcon, 225)
|
||||||
a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() }
|
a.artistImage.OnTapped = func(*fyne.PointEvent) { a.showPopUpCover() }
|
||||||
|
a.artistImage.CornerRadius = theme.InputRadiusSize()
|
||||||
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
a.favoriteBtn = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||||
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
|
a.playBtn = widget.NewButtonWithIcon(lang.L("Play Discography"), theme.MediaPlayIcon(), func() {
|
||||||
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)
|
go a.artistPage.pm.PlayArtistDiscography(a.artistID, false /*shuffle*/)
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ func NewNowPlayingPage(
|
|||||||
pm.OnStopped(doFmtStatus)
|
pm.OnStopped(doFmtStatus)
|
||||||
|
|
||||||
a.card = widgets.NewLargeNowPlayingCard()
|
a.card = widgets.NewLargeNowPlayingCard()
|
||||||
|
a.card.ImageCornerRadius = theme.InputRadiusSize()
|
||||||
a.card.OnAlbumNameTapped = func() {
|
a.card.OnAlbumNameTapped = func() {
|
||||||
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
|
contr.NavigateTo(controller.AlbumRoute(a.nowPlaying.Metadata().AlbumID))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ func NewPlaylistPageHeader(page *PlaylistPage) *PlaylistPageHeader {
|
|||||||
|
|
||||||
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
|
a.image = widgets.NewImagePlaceholder(myTheme.PlaylistIcon, 225)
|
||||||
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
a.image.OnTapped = func(*fyne.PointEvent) { go a.showPopUpCover() }
|
||||||
|
a.image.CornerRadius = theme.InputRadiusSize()
|
||||||
a.titleLabel = util.NewTruncatingRichText()
|
a.titleLabel = util.NewTruncatingRichText()
|
||||||
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
a.titleLabel.Segments[0].(*widget.TextSegment).Style = widget.RichTextStyle{
|
||||||
SizeName: theme.SizeNameHeadingText,
|
SizeName: theme.SizeNameHeadingText,
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ type ThemedRectangle struct {
|
|||||||
|
|
||||||
rect *canvas.Rectangle
|
rect *canvas.Rectangle
|
||||||
|
|
||||||
ColorName fyne.ThemeColorName
|
ColorName fyne.ThemeColorName
|
||||||
Translucent bool
|
Translucent bool
|
||||||
BorderWidth float32
|
BorderWidth float32
|
||||||
BorderColorName fyne.ThemeColorName
|
BorderColorName fyne.ThemeColorName
|
||||||
CornerRadiusName fyne.ThemeSizeName
|
CornerRadius float32
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewThemedRectangle(colorName fyne.ThemeColorName) *ThemedRectangle {
|
func NewThemedRectangle(colorName fyne.ThemeColorName) *ThemedRectangle {
|
||||||
@@ -43,9 +43,7 @@ func (t *ThemedRectangle) Refresh() {
|
|||||||
t.rect.FillColor = fc
|
t.rect.FillColor = fc
|
||||||
t.rect.StrokeWidth = t.BorderWidth
|
t.rect.StrokeWidth = t.BorderWidth
|
||||||
t.rect.StrokeColor = theme.Color(t.BorderColorName, settings.ThemeVariant())
|
t.rect.StrokeColor = theme.Color(t.BorderColorName, settings.ThemeVariant())
|
||||||
if t.CornerRadiusName != "" {
|
t.rect.CornerRadius = t.CornerRadius
|
||||||
t.rect.CornerRadius = theme.Size(t.CornerRadiusName)
|
|
||||||
}
|
|
||||||
t.BaseWidget.Refresh()
|
t.BaseWidget.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -365,7 +365,7 @@ func AddHeaderBackground(obj fyne.CanvasObject) *fyne.Container {
|
|||||||
|
|
||||||
func AddHeaderBackgroundWithColorName(obj fyne.CanvasObject, colorName fyne.ThemeColorName) *fyne.Container {
|
func AddHeaderBackgroundWithColorName(obj fyne.CanvasObject, colorName fyne.ThemeColorName) *fyne.Container {
|
||||||
bgrnd := myTheme.NewThemedRectangle(colorName)
|
bgrnd := myTheme.NewThemedRectangle(colorName)
|
||||||
bgrnd.CornerRadiusName = theme.SizeNameInputRadius
|
bgrnd.CornerRadius = theme.InputRadiusSize()
|
||||||
return container.NewStack(bgrnd,
|
return container.NewStack(bgrnd,
|
||||||
container.New(&layout.CustomPaddedLayout{LeftPadding: 10, RightPadding: 10, TopPadding: 10, BottomPadding: 10},
|
container.New(&layout.CustomPaddedLayout{LeftPadding: 10, RightPadding: 10, TopPadding: 10, BottomPadding: 10},
|
||||||
obj))
|
obj))
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ func (g *GridView) createGridWrap() {
|
|||||||
|
|
||||||
func (g *GridView) createNewItemCard() fyne.CanvasObject {
|
func (g *GridView) createNewItemCard() fyne.CanvasObject {
|
||||||
card := NewGridViewItem(g.Placeholder)
|
card := NewGridViewItem(g.Placeholder)
|
||||||
|
card.Cover.Im.CornerRadius = theme.InputRadiusSize()
|
||||||
card.SetSize(backend.AppInstance().Config.GridView.CardSize)
|
card.SetSize(backend.AppInstance().Config.GridView.CardSize)
|
||||||
card.ItemIndex = -1
|
card.ItemIndex = -1
|
||||||
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)
|
card.ImgLoader = util.NewThumbnailLoader(g.imageFetcher, card.Cover.SetImage)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import (
|
|||||||
type ImagePlaceholder struct {
|
type ImagePlaceholder struct {
|
||||||
ScaleMode canvas.ImageScale
|
ScaleMode canvas.ImageScale
|
||||||
PlaceholderIcon fyne.Resource
|
PlaceholderIcon fyne.Resource
|
||||||
|
CornerRadius float32
|
||||||
|
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
content *fyne.Container
|
content *fyne.Container
|
||||||
@@ -109,6 +110,8 @@ func (i *ImagePlaceholder) Refresh() {
|
|||||||
i.imageDisp.Hidden = !i.HaveImage()
|
i.imageDisp.Hidden = !i.HaveImage()
|
||||||
i.imageDisp.ScaleMode = i.ScaleMode
|
i.imageDisp.ScaleMode = i.ScaleMode
|
||||||
i.iconImage.ScaleMode = i.ScaleMode
|
i.iconImage.ScaleMode = i.ScaleMode
|
||||||
|
i.imageDisp.CornerRadius = i.CornerRadius
|
||||||
|
i.border.CornerRadius = i.CornerRadius
|
||||||
i.BaseWidget.Refresh()
|
i.BaseWidget.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import (
|
|||||||
type LargeNowPlayingCard struct {
|
type LargeNowPlayingCard struct {
|
||||||
CaptionedImage
|
CaptionedImage
|
||||||
|
|
||||||
DisableRating bool
|
DisableRating bool
|
||||||
|
ImageCornerRadius float32
|
||||||
|
|
||||||
isRadio bool
|
isRadio bool
|
||||||
trackName *widget.RichText
|
trackName *widget.RichText
|
||||||
@@ -163,5 +164,6 @@ func (n *LargeNowPlayingCard) Refresh() {
|
|||||||
} else {
|
} else {
|
||||||
n.rating.Enable()
|
n.rating.Enable()
|
||||||
}
|
}
|
||||||
|
n.cover.CornerRadius = n.ImageCornerRadius
|
||||||
n.BaseWidget.Refresh()
|
n.BaseWidget.Refresh()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ func NewListHeader(cols []ListColumn, layout *layouts.ColumnsLayout) *ListHeader
|
|||||||
l.columnVisible[i] = true
|
l.columnVisible[i] = true
|
||||||
}
|
}
|
||||||
rect := myTheme.NewThemedRectangle(myTheme.ColorNameListHeader)
|
rect := myTheme.NewThemedRectangle(myTheme.ColorNameListHeader)
|
||||||
rect.CornerRadiusName = theme.SizeNameSelectionRadius
|
rect.CornerRadius = theme.SelectionRadiusSize()
|
||||||
l.container = container.NewStack(rect, l.columnsContainer)
|
l.container = container.NewStack(rect, l.columnsContainer)
|
||||||
l.ExtendBaseWidget(l)
|
l.ExtendBaseWidget(l)
|
||||||
l.buildColumns()
|
l.buildColumns()
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ import (
|
|||||||
type NowPlayingCard struct {
|
type NowPlayingCard struct {
|
||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
DisableRating bool
|
DisableRating bool
|
||||||
|
ImageCornerRadius float32
|
||||||
|
|
||||||
trackName *OptionHyperlink
|
trackName *OptionHyperlink
|
||||||
artistName *MultiHyperlink
|
artistName *MultiHyperlink
|
||||||
@@ -163,6 +164,11 @@ func (n *NowPlayingCard) Update(track mediaprovider.MediaItem) {
|
|||||||
n.Refresh()
|
n.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *NowPlayingCard) Refresh() {
|
||||||
|
n.cover.CornerRadius = n.ImageCornerRadius
|
||||||
|
n.BaseWidget.Refresh()
|
||||||
|
}
|
||||||
|
|
||||||
func (n *NowPlayingCard) SetImage(cover image.Image) {
|
func (n *NowPlayingCard) SetImage(cover image.Image) {
|
||||||
n.cover.SetImage(cover, true)
|
n.cover.SetImage(cover, true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ func NewPlayQueueListRow(playQueueList *PlayQueueList, im *backend.ImageManager,
|
|||||||
p.ExtendBaseWidget(p)
|
p.ExtendBaseWidget(p)
|
||||||
|
|
||||||
p.cover.ScaleMode = canvas.ImageScaleFastest
|
p.cover.ScaleMode = canvas.ImageScaleFastest
|
||||||
|
p.cover.CornerRadius = theme.InputRadiusSize()
|
||||||
p.title.OnMouseIn = p.MouseIn
|
p.title.OnMouseIn = p.MouseIn
|
||||||
p.title.OnMouseOut = p.MouseOut
|
p.title.OnMouseOut = p.MouseOut
|
||||||
p.artist.OnTapped = playQueueList.onArtistTapped
|
p.artist.OnTapped = playQueueList.onArtistTapped
|
||||||
|
|||||||
@@ -274,6 +274,7 @@ func NewExpandedTracklistRow(tracklist *Tracklist, im *backend.ImageManager, pla
|
|||||||
t.playingIcon = playingIcon
|
t.playingIcon = playingIcon
|
||||||
t.img = NewImagePlaceholder(myTheme.TracksIcon, tracklistThumbnailSize)
|
t.img = NewImagePlaceholder(myTheme.TracksIcon, tracklistThumbnailSize)
|
||||||
t.img.ScaleMode = canvas.ImageScaleFastest
|
t.img.ScaleMode = canvas.ImageScaleFastest
|
||||||
|
t.img.CornerRadius = theme.InputRadiusSize()
|
||||||
|
|
||||||
t.imageLoader = util.NewThumbnailLoader(im, func(i image.Image) {
|
t.imageLoader = util.NewThumbnailLoader(im, func(i image.Image) {
|
||||||
t.img.SetImage(i, false)
|
t.img.SetImage(i, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user