[Android] Fix the remote access item icon for browser

Nicolas Pomepuy git at videolan.org
Thu Feb 22 13:29:25 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Feb  7 13:58:44 2024 +0100| [c4146bd50eec84afcabf11a792f22ba3d78d556a] | committer: Nicolas Pomepuy

Fix the remote access item icon for browser

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

 .../videolan/vlc/webserver/RemoteAccessRouting.kt  | 27 +++++++++++-----------
 .../src/components/MediaItem.vue                   |  3 ++-
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
index 0c13740a70..a90893778e 100644
--- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
+++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt
@@ -662,18 +662,26 @@ fun Route.setupRouting(appContext: Context, scope: CoroutineScope) {
                 }
             }
             val list = dataset.getList().mapIndexed { index, it ->
-                val path = when (it) {
+                val filePath = when (it) {
                     is MediaWrapper -> it.uri.toString()
                     is Storage -> it.uri.toString()
                     else -> throw IllegalStateException("Unrecognised media type")
 
                 }
-                val title = if (provider is FileBrowserProvider
-                        && (provider.url == null || Uri.parse(provider.url).scheme.isSchemeFile())
+                val title = if ((provider.url == null || Uri.parse(provider.url).scheme.isSchemeFile())
                         && it is MediaWrapper) it.fileName else it.title
                 val isFolder = if (it is MediaWrapper) it.type == MediaWrapper.TYPE_DIR else true
+                var fileType = "folder"
+                if (!isFolder) {
+                    fileType = when ((it as MediaWrapper).type) {
+                        MediaWrapper.TYPE_AUDIO -> "audio"
+                        MediaWrapper.TYPE_VIDEO -> "video"
+                        MediaWrapper.TYPE_SUBTITLE -> "subtitle"
+                        else -> "file"
+                    }
+                }
                 RemoteAccessServer.PlayQueueItem(1000L + index, title, it.description ?: "", 0, it.artworkMrl
-                        ?: "", false, "", path, isFolder)
+                        ?: "", false, "", filePath, isFolder, fileType = fileType)
             }
 
             //segments
@@ -1128,17 +1136,8 @@ private suspend fun getProviderContent(context:Context, provider: BrowserProvide
                 && (provider.url == null || Uri.parse(provider.url).scheme.isSchemeFile())
                 && mediaLibraryItem is MediaWrapper) mediaLibraryItem.fileName else mediaLibraryItem.title
         val isFolder = if (mediaLibraryItem is MediaWrapper) mediaLibraryItem.type == MediaWrapper.TYPE_DIR else true
-        var type = "folder"
-        if (!isFolder) {
-            type = when ((mediaLibraryItem as MediaWrapper).type) {
-                MediaWrapper.TYPE_AUDIO -> "audio"
-                MediaWrapper.TYPE_VIDEO -> "video"
-                MediaWrapper.TYPE_SUBTITLE -> "subtitle"
-                else -> "file"
-            }
-        }
         list.add(RemoteAccessServer.PlayQueueItem(idPrefix + index, title, description, 0, mediaLibraryItem.artworkMrl
-                ?: "", false, "", path, isFolder, fileType = type))
+                ?: "", false, "", path, isFolder))
     }
     return list
 }
diff --git a/buildsystem/network-sharing-server/src/components/MediaItem.vue b/buildsystem/network-sharing-server/src/components/MediaItem.vue
index 8d417d8ab4..86863f26d6 100644
--- a/buildsystem/network-sharing-server/src/components/MediaItem.vue
+++ b/buildsystem/network-sharing-server/src/components/MediaItem.vue
@@ -1,7 +1,8 @@
 <template>
     <div v-if="(isCard)" class="card">
         <div v-on:click="manageClick" class="ratio clickable" v-bind:class="(mainImgClasses())">
-            <img v-lazy="$getImageUrl(media, this.mediaType)" class="media-img-top">
+            <img v-if="this.mediaType == 'file'" v-lazy="$getImageUrl(media, media.fileType)" class="media-img-top">
+            <img v-else v-lazy="$getImageUrl(media, this.mediaType)" class="media-img-top">
             <div class="media-overlay" v-show="!isBrowse()">
                 <img class="overlay-play" :src="(isOpenable() ? `./icons/open.svg` : `./icons/play_circle_white.svg`)"
                     width="48" />



More information about the Android mailing list