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