[Android] Fix browser adapter initial sort

Nicolas Pomepuy git at videolan.org
Fri Jun 17 13:30:07 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jun 17 14:43:04 2022 +0200| [5b4d340b2fe8b9ebc08a5add40b9447aaed11e39] | committer: Duncan McNamara

Fix browser adapter initial sort

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

 .../src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.kt          | 2 +-
 .../vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.kt
index 0d4e0e739..c9f9b7ab8 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.kt
@@ -160,7 +160,7 @@ open class BaseBrowserAdapter(val browserContainer: BrowserContainer<MediaLibrar
                 && "content" != scheme
                 && "otg" != scheme)
                 && !multiSelectHelper.inActionMode)
-        vh.bindingContainer.setFileName(if (sort == Medialibrary.SORT_FILENAME && media.type != MediaWrapper.TYPE_DIR && "file" == scheme) media.fileName else null)
+        vh.bindingContainer.setFileName(if ((sort == Medialibrary.SORT_FILENAME || sort == Medialibrary.SORT_DEFAULT) && media.type != MediaWrapper.TYPE_DIR && "file" == scheme) media.fileName else null)
         if (networkRoot || (isFavorite && getProtocol(media)?.contains("file") == false)) vh.bindingContainer.setProtocol(getProtocol(media))
         vh.bindingContainer.setCover(getIcon(media, specialIcons))
         vh.selectView(multiSelectHelper.isSelected(position))
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 9d7d045af..f3ed160d0 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -73,10 +73,10 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
         get() = when {
             Settings.showTvUi && sort == Medialibrary.SORT_ALPHA && desc -> tvDescComp
             Settings.showTvUi && sort == Medialibrary.SORT_ALPHA && !desc -> tvAscComp
-            sort == Medialibrary.SORT_FILENAME && desc -> filenameDescComp
-            sort == Medialibrary.SORT_FILENAME && !desc -> filenameAscComp
             sort == Medialibrary.SORT_ALPHA && desc -> descComp
-            else -> ascComp
+            sort == Medialibrary.SORT_ALPHA && !desc -> ascComp
+            (sort == Medialibrary.SORT_FILENAME || sort == Medialibrary.SORT_DEFAULT) && desc -> filenameDescComp
+            else -> filenameAscComp
         }
 
     init {



More information about the Android mailing list