update all fragments after refetching files

This commit is contained in:
tibbi 2022-03-14 21:45:16 +01:00
parent c1f4b739f0
commit 92ff19b206
2 changed files with 9 additions and 3 deletions

View file

@ -194,7 +194,11 @@ class MainActivity : SimpleActivity() {
}
}
updateAllDatabases()
updateAllDatabases {
getAllFragments().forEach {
it?.setupFragment(this)
}
}
}
private fun initFragments() {
@ -377,7 +381,8 @@ class MainActivity : SimpleActivity() {
}
}
private fun getAllFragments() = arrayListOf(playlists_fragment_holder, artists_fragment_holder, albums_fragment_holder, tracks_fragment_holder)
private fun getAllFragments() =
arrayListOf(playlists_fragment_holder, folders_fragment_holder, artists_fragment_holder, albums_fragment_holder, tracks_fragment_holder)
@Subscribe(threadMode = ThreadMode.MAIN)
fun trackChangedEvent(event: Events.TrackChanged) {

View file

@ -284,10 +284,11 @@ fun Context.getAllInitialTracks(): ArrayList<Track> {
}
// store new artists, albums and tracks into our local db, delete invalid items
fun Context.updateAllDatabases() {
fun Context.updateAllDatabases(callback: () -> Unit) {
ensureBackgroundThread {
updateCachedArtists { artists ->
updateCachedAlbums(artists)
callback()
}
}
}