update all fragments after refetching files
This commit is contained in:
parent
c1f4b739f0
commit
92ff19b206
2 changed files with 9 additions and 3 deletions
|
@ -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) {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue