From 12621e6d973d37efbf25808dd653b421757c80cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 6 Jun 2022 20:36:12 +0200 Subject: [PATCH] properly sort items at TracksActivity at initial loading too --- .../musicplayer/activities/TracksActivity.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt index dbe91594..9ac70e93 100644 --- a/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/musicplayer/activities/TracksActivity.kt @@ -100,7 +100,11 @@ class TracksActivity : SimpleActivity() { val playlistTracks = tracksDAO.getTracksFromPlaylist(playlist!!.id).map { track -> track.title = track.getProperTitle(showFilename) track - } + } as ArrayList + + Track.sorting = config.playlistTracksSorting + playlistTracks.sort() + runOnUiThread { tracks_placeholder.beVisibleIf(playlistTracks.isEmpty()) tracks_placeholder_2.beVisibleIf(playlistTracks.isEmpty()) @@ -123,7 +127,11 @@ class TracksActivity : SimpleActivity() { val folderTracks = tracksDAO.getTracksFromFolder(folder ?: "").map { track -> track.title = track.getProperTitle(showFilename) track - } + } as ArrayList + + Track.sorting = config.playlistTracksSorting + folderTracks.sort() + runOnUiThread { tracks_placeholder.beVisibleIf(folderTracks.isEmpty()) }