[Android] Fix initial sort on files

Nicolas Pomepuy git at videolan.org
Fri Sep 30 09:06:27 UTC 2022


vlc-android | branch: 3.5.x | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Sep 29 11:38:38 2022 +0200| [d1724774e4d37d95ba66046afb18295d06dccce8] | committer: Duncan McNamara

Fix initial sort on files

> https://code.videolan.org/videolan/vlc-android/commit/d1724774e4d37d95ba66046afb18295d06dccce8
---

 .../vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index c65704174..38bdb9728 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -83,8 +83,8 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
         else -> true
     }
     fun getComparator(nbOfDigits: Int): Comparator<MediaLibraryItem>? = when {
-            Settings.showTvUi && sort == Medialibrary.SORT_ALPHA && desc -> tvDescComp
-            Settings.showTvUi && sort == Medialibrary.SORT_ALPHA && !desc -> tvAscComp
+            Settings.showTvUi && sort in arrayOf(Medialibrary.SORT_ALPHA, Medialibrary.SORT_DEFAULT) && desc -> tvDescComp
+            Settings.showTvUi && sort in arrayOf(Medialibrary.SORT_ALPHA, Medialibrary.SORT_DEFAULT) && !desc -> tvAscComp
             url != null && Uri.parse(url)?.scheme == "upnp" -> null
             sort == Medialibrary.SORT_ALPHA && desc -> descComp
             sort == Medialibrary.SORT_ALPHA && !desc -> ascComp
@@ -322,8 +322,8 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
                             descriptionUpdate.value = Pair(position, it)
                         }
                         directories.addAll(files)
-                        sort(directories.toMutableList())
-                        withContext(coroutineContextProvider.Main) { foldersContentMap.put(item, directories.toMutableList()) }
+                        sort(directories as MutableList<MediaLibraryItem>)
+                        withContext(coroutineContextProvider.Main) { foldersContentMap.put(item, directories) }
                     }
                     directories.clear()
                     files.clear()



More information about the Android mailing list