[Android] Allow all supported characters in ML strings

Geoffrey Métais git at videolan.org
Mon Mar 5 11:52:01 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar  5 11:51:23 2018 +0100| [851762240e820c578c8ce975cc8cfb814330a41a] | committer: Geoffrey Métais

Allow all supported characters in ML strings

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

 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 6 +++---
 medialibrary/src/org/videolan/medialibrary/Tools.java        | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 937c36f21..29f546368 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -113,7 +113,7 @@ public class Medialibrary {
     }
 
     public boolean addDevice(@NonNull String uuid, @NonNull String path, boolean removable) {
-        return nativeAddDevice(VLCUtil.encodeVLCString(uuid), Tools.encodeVLCMrl(path), removable);
+        return nativeAddDevice(Tools.encodeVLCMrl(uuid), Tools.encodeVLCMrl(path), removable);
     }
 
     public void discover(@NonNull String path) {
@@ -137,7 +137,7 @@ public class Medialibrary {
     }
 
     public boolean removeDevice(String uuid) {
-        return mIsInitiated && !TextUtils.isEmpty(uuid) && nativeRemoveDevice(VLCUtil.encodeVLCString(uuid));
+        return mIsInitiated && !TextUtils.isEmpty(uuid) && nativeRemoveDevice(Tools.encodeVLCMrl(uuid));
     }
 
     @Override
@@ -263,7 +263,7 @@ public class Medialibrary {
     }
 
     public boolean addToHistory(String mrl, String title) {
-        return mIsInitiated && nativeAddToHistory(Tools.encodeVLCMrl(mrl), VLCUtil.encodeVLCString(title));
+        return mIsInitiated && nativeAddToHistory(Tools.encodeVLCMrl(mrl), Tools.encodeVLCMrl(title));
     }
 
     @Nullable
diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java
index b166a4de2..124e96249 100644
--- a/medialibrary/src/org/videolan/medialibrary/Tools.java
+++ b/medialibrary/src/org/videolan/medialibrary/Tools.java
@@ -6,7 +6,6 @@ import android.os.Environment;
 import android.support.annotation.Nullable;
 import android.text.TextUtils;
 
-import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.medialibrary.media.MediaLibraryItem;
 import org.videolan.medialibrary.media.MediaWrapper;
 
@@ -126,6 +125,6 @@ public class Tools {
 
     static String encodeVLCMrl(String mrl) {
         if (mrl.startsWith("/")) mrl = "file://"+mrl;
-        return VLCUtil.encodeVLCString(Uri.encode(Uri.decode(mrl), ":/@"));
+        return Uri.encode(Uri.decode(mrl), ".-_~/()&!$*+,;='@:");
     }
 }



More information about the Android mailing list