fix scrolling performance of grid views when not showing album year
This commit is contained in:
@@ -3,10 +3,11 @@ package widgets
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fyne.io/fyne/v2/lang"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2/lang"
|
||||||
|
|
||||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||||
"github.com/dweymouth/supersonic/sharedutil"
|
"github.com/dweymouth/supersonic/sharedutil"
|
||||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||||
@@ -329,14 +330,13 @@ func (g *GridView) doUpdateItemCard(itemIdx int, card *GridViewItem) {
|
|||||||
}
|
}
|
||||||
card.ItemIndex = itemIdx
|
card.ItemIndex = itemIdx
|
||||||
g.itemForIndex[itemIdx] = card
|
g.itemForIndex[itemIdx] = card
|
||||||
card.Cover.Im.PlaceholderIcon = g.Placeholder
|
|
||||||
card.ShowSuffix = g.ShowSuffix
|
card.ShowSuffix = g.ShowSuffix
|
||||||
if !card.NeedsUpdate(item) && card.ItemIndex == itemIdx {
|
if !card.NeedsUpdate(item) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
g.stateMutex.Unlock()
|
g.stateMutex.Unlock()
|
||||||
card.Refresh()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
card.Cover.Im.PlaceholderIcon = g.Placeholder
|
||||||
g.stateMutex.Unlock()
|
g.stateMutex.Unlock()
|
||||||
card.Update(item)
|
card.Update(item)
|
||||||
card.ImgLoader.Load(item.CoverArtID)
|
card.ImgLoader.Load(item.CoverArtID)
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ func NewGridViewItem(placeholderResource fyne.Resource) *GridViewItem {
|
|||||||
|
|
||||||
func (g *GridViewItem) NeedsUpdate(model GridViewItemModel) bool {
|
func (g *GridViewItem) NeedsUpdate(model GridViewItemModel) bool {
|
||||||
return g.itemID != model.ID || !slices.Equal(g.secondaryIDs, model.SecondaryIDs) ||
|
return g.itemID != model.ID || !slices.Equal(g.secondaryIDs, model.SecondaryIDs) ||
|
||||||
g.secondaryText.Suffix != model.Suffix
|
(g.ShowSuffix && g.secondaryText.Suffix != model.Suffix) ||
|
||||||
|
(!g.ShowSuffix && g.secondaryText.Suffix != "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GridViewItem) Update(model GridViewItemModel) {
|
func (g *GridViewItem) Update(model GridViewItemModel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user