set state properly when reusing NowPlayingPage in constructor
This commit is contained in:
@@ -86,13 +86,15 @@ func NewNowPlayingPage(
|
||||
canShare bool,
|
||||
lrcLibEnabled bool,
|
||||
) *NowPlayingPage {
|
||||
state := nowPlayingPageState{
|
||||
conf: conf, contr: contr, pool: pool, sm: sm, im: im, pm: pm, mp: mp, canRate: canRate, canShare: canShare, lrcLib: lrcLibEnabled,
|
||||
}
|
||||
if page, ok := pool.Obtain(util.WidgetTypeNowPlayingPage).(*NowPlayingPage); ok && page != nil {
|
||||
page.nowPlayingPageState = state
|
||||
page.Reload()
|
||||
return page
|
||||
}
|
||||
a := &NowPlayingPage{nowPlayingPageState: nowPlayingPageState{
|
||||
conf: conf, contr: contr, pool: pool, sm: sm, im: im, pm: pm, mp: mp, canRate: canRate, canShare: canShare, lrcLib: lrcLibEnabled,
|
||||
}}
|
||||
a := &NowPlayingPage{nowPlayingPageState: state}
|
||||
a.ExtendBaseWidget(a)
|
||||
|
||||
pm.OnPaused(a.formatStatusLine)
|
||||
|
||||
@@ -50,7 +50,7 @@ func (l *LyricsViewer) SetLyrics(lyrics *mediaprovider.Lyrics) {
|
||||
|
||||
if l.viewer == nil {
|
||||
l.viewer = fynelyrics.NewLyricsViewer()
|
||||
l.viewer.ActiveLyricPosition = fynelyrics.ActiveLyricPositionMiddle
|
||||
l.viewer.ActiveLyricPosition = fynelyrics.ActiveLyricPositionUpperMiddle
|
||||
l.viewer.InactiveLyricColorName = theme.ColorNameInactiveLyric
|
||||
}
|
||||
lines := make([]string, len(lyrics.Lines))
|
||||
|
||||
Reference in New Issue
Block a user