use parenthesized year when inline with album name
This commit is contained in:
@@ -76,6 +76,7 @@ func NewLargeNowPlayingCard(cfg *backend.Config) *LargeNowPlayingCard {
|
|||||||
n.trackName.Truncation = fyne.TextTruncateEllipsis
|
n.trackName.Truncation = fyne.TextTruncateEllipsis
|
||||||
n.albumName.SizeName = myTheme.SizeNameSubSubHeadingText
|
n.albumName.SizeName = myTheme.SizeNameSubSubHeadingText
|
||||||
n.albumName.OnTapped = n.onAlbumNameTapped
|
n.albumName.OnTapped = n.onAlbumNameTapped
|
||||||
|
n.albumName.SuffixParenthesized = true
|
||||||
n.artistName.OnTapped = n.onArtistNameTapped
|
n.artistName.OnTapped = n.onArtistNameTapped
|
||||||
n.artistName.SizeName = myTheme.SizeNameSubSubHeadingText
|
n.artistName.SizeName = myTheme.SizeNameSubSubHeadingText
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ type MultiHyperlink struct {
|
|||||||
|
|
||||||
Segments []MultiHyperlinkSegment
|
Segments []MultiHyperlinkSegment
|
||||||
|
|
||||||
// Suffix string that is appended (with · separator)
|
// Suffix string that is appended (with · separator, or parenthesized
|
||||||
// only if there is enough room
|
// if SuffixParenthesized is true) only if there is enough room
|
||||||
Suffix string
|
Suffix string
|
||||||
|
|
||||||
|
SuffixParenthesized bool
|
||||||
|
|
||||||
OnMouseIn func(*desktop.MouseEvent)
|
OnMouseIn func(*desktop.MouseEvent)
|
||||||
OnMouseOut func()
|
OnMouseOut func()
|
||||||
OnTapped func(string)
|
OnTapped func(string)
|
||||||
@@ -139,12 +141,18 @@ func (c *MultiHyperlink) layoutObjects() {
|
|||||||
i += 1
|
i += 1
|
||||||
c.content.Objects = c.objects[:2*i-1]
|
c.content.Objects = c.objects[:2*i-1]
|
||||||
if i == len(c.Segments) && c.Suffix != "" {
|
if i == len(c.Segments) && c.Suffix != "" {
|
||||||
|
var suffixText string
|
||||||
|
if c.SuffixParenthesized {
|
||||||
|
suffixText = "\u2009(" + c.Suffix + ")"
|
||||||
|
} else {
|
||||||
|
suffixText = "· " + c.Suffix
|
||||||
|
}
|
||||||
if c.suffixLabel == nil {
|
if c.suffixLabel == nil {
|
||||||
c.suffixLabel = ttwidget.NewRichTextWithText("· " + c.Suffix)
|
c.suffixLabel = ttwidget.NewRichTextWithText(suffixText)
|
||||||
c.suffixLabel.OnMouseIn = c.callOnMouseIn
|
c.suffixLabel.OnMouseIn = c.callOnMouseIn
|
||||||
c.suffixLabel.OnMouseOut = c.callOnMouseOut
|
c.suffixLabel.OnMouseOut = c.callOnMouseOut
|
||||||
} else {
|
} else {
|
||||||
c.suffixLabel.Segments[0].(*widget.TextSegment).Text = "· " + c.Suffix
|
c.suffixLabel.Segments[0].(*widget.TextSegment).Text = suffixText
|
||||||
}
|
}
|
||||||
sizeName := c.sizeName()
|
sizeName := c.sizeName()
|
||||||
if c.SuffixSizeName != "" {
|
if c.SuffixSizeName != "" {
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ func NewNowPlayingCard(cfg *backend.Config) *NowPlayingCard {
|
|||||||
n.cover.Hidden = true
|
n.cover.Hidden = true
|
||||||
n.trackName.Hidden = true
|
n.trackName.Hidden = true
|
||||||
n.albumName.Hidden = true
|
n.albumName.Hidden = true
|
||||||
|
n.albumName.SuffixParenthesized = true
|
||||||
|
n.albumName.SuffixSizeName = myTheme.SizeNameSubText
|
||||||
n.trackName.SetTextStyle(fyne.TextStyle{Bold: true})
|
n.trackName.SetTextStyle(fyne.TextStyle{Bold: true})
|
||||||
n.trackName.OnShowMenu = n.showMenu
|
n.trackName.OnShowMenu = n.showMenu
|
||||||
n.albumName.OnTapped = n.onAlbumNameTapped
|
n.albumName.OnTapped = n.onAlbumNameTapped
|
||||||
|
|||||||
Reference in New Issue
Block a user