[Android] We already have a Util function for URI conversions

Jean-Baptiste Kempf git at videolan.org
Mon Oct 15 14:16:18 CEST 2012


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Oct 15 14:09:07 2012 +0200| [733ae7be8ce1d8cc034d68417151a6963a720840] | committer: Jean-Baptiste Kempf

We already have a Util function for URI conversions

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=733ae7be8ce1d8cc034d68417151a6963a720840
---

 vlc-android/src/org/videolan/vlc/LibVLC.java               |    2 +-
 vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java |    7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/LibVLC.java b/vlc-android/src/org/videolan/vlc/LibVLC.java
index 623516f..e2e43bd 100644
--- a/vlc-android/src/org/videolan/vlc/LibVLC.java
+++ b/vlc-android/src/org/videolan/vlc/LibVLC.java
@@ -476,7 +476,7 @@ public class LibVLC {
 
     public native int getSpuTracksCount();
 
-    public static native String nativeToURI(String path);
+    public native String nativeToURI(String path);
 
     public static native void nativeReadDirectory(String path, ArrayList<String> res);
 
diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
index 34d4be2..0678e11 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryAdapter.java
@@ -293,8 +293,9 @@ public class DirectoryAdapter extends BaseAdapter {
 
     public boolean browse(String directoryName) {
         try {
-            this.mCurrentDir = new URI(LibVLC.nativeToURI(this.mCurrentDir
-                    + "/" + directoryName)).normalize().getPath();
+            this.mCurrentDir = new URI(
+                    Util.PathToURI(this.mCurrentDir + "/" + directoryName))
+                    .normalize().getPath();
             this.mCurrentDir = Util.stripTrailingSlash(this.mCurrentDir);
         } catch (URISyntaxException e) {
             e.printStackTrace();
@@ -319,7 +320,7 @@ public class DirectoryAdapter extends BaseAdapter {
     public String getMediaLocation(int position) {
         if (position >= mCurrentNode.children.size())
             return null;
-        return LibVLC.nativeToURI(
+        return Util.PathToURI(
                 this.mCurrentDir + "/" + mCurrentNode.children.get(position).name
         );
     }



More information about the Android mailing list