Show audio files from MediaStore.Files
table
This commit is contained in:
parent
f6cd3ed7ad
commit
35ae6dd946
1 changed files with 1 additions and 14 deletions
|
@ -13,13 +13,10 @@ import com.simplemobiletools.musicplayer.activities.SimpleActivity
|
|||
import com.simplemobiletools.musicplayer.activities.TracksActivity
|
||||
import com.simplemobiletools.musicplayer.adapters.FoldersAdapter
|
||||
import com.simplemobiletools.musicplayer.dialogs.ChangeSortingDialog
|
||||
import com.simplemobiletools.musicplayer.extensions.albumsDAO
|
||||
import com.simplemobiletools.musicplayer.extensions.artistDAO
|
||||
import com.simplemobiletools.musicplayer.extensions.config
|
||||
import com.simplemobiletools.musicplayer.extensions.tracksDAO
|
||||
import com.simplemobiletools.musicplayer.helpers.FOLDER
|
||||
import com.simplemobiletools.musicplayer.helpers.TAB_FOLDERS
|
||||
import com.simplemobiletools.musicplayer.models.Album
|
||||
import com.simplemobiletools.musicplayer.models.Folder
|
||||
import com.simplemobiletools.musicplayer.models.Track
|
||||
import kotlinx.android.synthetic.main.fragment_folders.view.*
|
||||
|
@ -29,17 +26,7 @@ class FoldersFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||
|
||||
override fun setupFragment(activity: BaseSimpleActivity) {
|
||||
ensureBackgroundThread {
|
||||
val albums = ArrayList<Album>()
|
||||
val artists = context.artistDAO.getAll()
|
||||
artists.forEach { artist ->
|
||||
albums.addAll(context.albumsDAO.getArtistAlbums(artist.id))
|
||||
}
|
||||
|
||||
var tracks = ArrayList<Track>()
|
||||
albums.forEach { album ->
|
||||
tracks.addAll(context.tracksDAO.getTracksFromAlbum(album.id))
|
||||
}
|
||||
|
||||
var tracks = context.tracksDAO.getAll()
|
||||
tracks = tracks.distinctBy { "${it.path}/${it.mediaStoreId}" }.toMutableList() as ArrayList<Track>
|
||||
|
||||
Track.sorting = context.config.trackSorting
|
||||
|
|
Loading…
Reference in a new issue