do not block the Track loading at updating covers

This commit is contained in:
tibbi 2020-10-23 21:40:06 +02:00
parent ed1ba076d2
commit b426209de0

View file

@ -37,13 +37,6 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
} }
tracks.sortWith { o1, o2 -> AlphanumericComparator().compare(o1.title.toLowerCase(), o2.title.toLowerCase()) } tracks.sortWith { o1, o2 -> AlphanumericComparator().compare(o1.title.toLowerCase(), o2.title.toLowerCase()) }
if (!context.config.wereCoversUpdated) {
tracks.filter { it.coverArt.isNotEmpty() }.forEach {
activity.tracksDAO.updateCoverArt(it.coverArt, it.id)
}
context.config.wereCoversUpdated = true
}
activity.runOnUiThread { activity.runOnUiThread {
tracks_placeholder.beVisibleIf(tracks.isEmpty()) tracks_placeholder.beVisibleIf(tracks.isEmpty())
val adapter = TracksAdapter(activity, tracks, false, tracks_list, tracks_fastscroller) { val adapter = TracksAdapter(activity, tracks, false, tracks_list, tracks_fastscroller) {
@ -63,6 +56,13 @@ class TracksFragment(context: Context, attributeSet: AttributeSet) : MyViewPager
tracks_fastscroller.updateBubbleText(track?.title ?: "") tracks_fastscroller.updateBubbleText(track?.title ?: "")
} }
} }
if (!context.config.wereCoversUpdated) {
tracks.filter { it.coverArt.isNotEmpty() }.forEach {
activity.tracksDAO.updateCoverArt(it.coverArt, it.id)
}
context.config.wereCoversUpdated = true
}
} }
tracks_fastscroller.updatePrimaryColor() tracks_fastscroller.updatePrimaryColor()