[Android] Ml: Fix ban / unban with spaces in the name

Duncan McNamara git at videolan.org
Tue Sep 13 11:37:17 UTC 2022


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Thu Aug 25 17:19:23 2022 +0200| [629bf3bd3b5372d425333f347eb5569189804e34] | committer: Duncan McNamara

Ml: Fix ban / unban with spaces in the name

The callback called after ban / unban of a directory compares
non encoded directories from the StorageBrowserAdapter to a
VLCencoded directory string. Because of this after ban / unban the item
view was not updated after action.

Fixes #2596

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

 .../src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
index aa4d8f411..9e1f30c50 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/StorageBrowserFragment.kt
@@ -40,6 +40,7 @@ import kotlinx.coroutines.CoroutineExceptionHandler
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
 import org.videolan.libvlc.util.AndroidUtil
+import org.videolan.libvlc.util.VLCUtil
 import org.videolan.medialibrary.MLServiceLocator
 import org.videolan.medialibrary.interfaces.Medialibrary
 import org.videolan.medialibrary.interfaces.media.MediaWrapper
@@ -110,8 +111,8 @@ class StorageBrowserFragment : FileBrowserFragment(), BrowserContainer<MediaLibr
         addBannedFoldersCallback { folder, _ ->
             (adapter as StorageBrowserAdapter).bannedFolders = Medialibrary.getInstance().bannedFolders().toList()
             adapter.dataset.forEachIndexed{ index, mediaLibraryItem ->
-                if ("${(mediaLibraryItem as Storage).uri}/" == folder) adapter.notifyItemChanged(index)
-            }
+                if ("${VLCUtil.encodeVLCString((mediaLibraryItem as Storage).uri.toString())}/" == folder) adapter.notifyItemChanged(index)
+                }
         }
     }
 



More information about the Android mailing list