more fyne.Do updates
This commit is contained in:
+17
-13
@@ -33,19 +33,21 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
|
||||
|
||||
pm.OnSongChange(bp.onSongChange)
|
||||
pm.OnPlayTimeUpdate(func(cur, total float64, _ bool) {
|
||||
if !pm.IsSeeking() {
|
||||
bp.Controls.UpdatePlayTime(cur, total)
|
||||
}
|
||||
fyne.Do(func() {
|
||||
if !pm.IsSeeking() {
|
||||
bp.Controls.UpdatePlayTime(cur, total)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
pm.OnPaused(func() {
|
||||
bp.Controls.SetPlaying(false)
|
||||
fyne.Do(func() { bp.Controls.SetPlaying(false) })
|
||||
})
|
||||
pm.OnPlaying(func() {
|
||||
bp.Controls.SetPlaying(true)
|
||||
fyne.Do(func() { bp.Controls.SetPlaying(true) })
|
||||
})
|
||||
pm.OnStopped(func() {
|
||||
bp.Controls.SetPlaying(false)
|
||||
fyne.Do(func() { bp.Controls.SetPlaying(false) })
|
||||
})
|
||||
|
||||
bp.NowPlaying = widgets.NewNowPlayingCard()
|
||||
@@ -124,13 +126,15 @@ func NewBottomPanel(pm *backend.PlaybackManager, im *backend.ImageManager, contr
|
||||
}
|
||||
|
||||
func (bp *BottomPanel) onSongChange(song mediaprovider.MediaItem, _ *mediaprovider.Track) {
|
||||
if song == nil {
|
||||
bp.NowPlaying.Update(nil)
|
||||
bp.imageLoader.Load("")
|
||||
} else {
|
||||
bp.NowPlaying.Update(song)
|
||||
bp.imageLoader.Load(song.Metadata().CoverArtID)
|
||||
}
|
||||
fyne.Do(func() {
|
||||
if song == nil {
|
||||
bp.NowPlaying.Update(nil)
|
||||
bp.imageLoader.Load("")
|
||||
} else {
|
||||
bp.NowPlaying.Update(song)
|
||||
bp.imageLoader.Load(song.Metadata().CoverArtID)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (bp *BottomPanel) CreateRenderer() fyne.WidgetRenderer {
|
||||
|
||||
@@ -391,14 +391,16 @@ func (g *GridView) checkFetchMoreItems(count int) {
|
||||
g.stateMutex.Lock()
|
||||
g.items = append(g.items, items...)
|
||||
g.stateMutex.Unlock()
|
||||
g.loadingDots.Stop()
|
||||
if len(items) < batchFetchSize {
|
||||
g.done = true
|
||||
}
|
||||
n += len(items)
|
||||
if len(items) > 0 {
|
||||
g.grid.Refresh()
|
||||
}
|
||||
fyne.DoAndWait(func() {
|
||||
g.loadingDots.Stop()
|
||||
if len(items) > 0 {
|
||||
g.grid.Refresh()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (l *LoadingDots) animate(ctx context.Context) {
|
||||
l.running.Store(false)
|
||||
return
|
||||
case <-ticker.C:
|
||||
l.doTick(foreground, disabled)
|
||||
fyne.Do(func() { l.doTick(foreground, disabled) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user