[Android] Fix remote access browse subtitle

Nicolas Pomepuy git at videolan.org
Wed Feb 7 06:50:56 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jan 15 13:55:52 2024 +0100| [be8209306665086e56ab462524112cfcf0ebca05] | committer: Nicolas Pomepuy

Fix remote access browse subtitle

Fixes #3021

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

 .../main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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 db980b5f56..3319616ec1 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
@@ -862,7 +862,13 @@ private suspend fun getProviderContent(context:Context, provider: BrowserProvide
                 val unparsedDescription = descriptions.firstOrNull { it.first == index }?.second
                 val folders = unparsedDescription.getFolderNumber()
                 val files = unparsedDescription.getFilesNumber()
-                "${context.resources.getQuantityString(org.videolan.vlc.R.plurals.subfolders_quantity, folders, folders)} ${TextUtils.separator} ${context.resources.getQuantityString(org.videolan.vlc.R.plurals.mediafiles_quantity, files, files)}"
+                if (folders > 0 && files > 0) {
+                    "${context.resources.getQuantityString(org.videolan.vlc.R.plurals.subfolders_quantity, folders, folders)} ${TextUtils.separator} ${context.resources.getQuantityString(org.videolan.vlc.R.plurals.mediafiles_quantity, files, files)}"
+                } else if (files > 0) {
+                    context.resources.getQuantityString(org.videolan.vlc.R.plurals.mediafiles_quantity, files, files)
+                } else if (folders > 0) {
+                    context.resources.getQuantityString(org.videolan.vlc.R.plurals.subfolders_quantity, folders, folders)
+                } else mediaLibraryItem.description
             }
         } catch (e: Exception) {
             Log.e(RemoteAccessServer::class.java.simpleName, e.message, e)



More information about the Android mailing list