[Android] fix audio cover and URItoFile

Sébastien Toque git at videolan.org
Wed Apr 4 22:14:53 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Wed Apr  4 20:58:06 2012 +0200| [0bf07d9a86b2626f9853026277ce347f6d60da1e] | committer: Sébastien Toque

fix audio cover and URItoFile

> http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=0bf07d9a86b2626f9853026277ce347f6d60da1e
---

 vlc-android/src/org/videolan/vlc/AudioService.java |    2 +-
 vlc-android/src/org/videolan/vlc/Util.java         |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 81bbcf9..bac9e7f 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -344,7 +344,7 @@ public class AudioService extends Service {
                 if (b != null)
                     return b;
             }
-            File f = new File(mCurrentMedia.getLocation());
+            File f = Util.URItoFile(mCurrentMedia.getLocation());
             for (File s : f.getParentFile().listFiles()) {
                 if (s.getAbsolutePath().endsWith("png") ||
                         s.getAbsolutePath().endsWith("jpg"))
diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index 1327cd4..19a10f0 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -26,6 +26,7 @@ import java.text.DecimalFormat;
 
 import android.content.Context;
 import android.graphics.Bitmap;
+import android.net.Uri;
 import android.widget.Toast;
 
 public class Util {
@@ -41,7 +42,7 @@ public class Util {
     }
 
     public static File URItoFile(String URI) {
-        return new File(URI.replace("file://", "file:"));
+        return new File(Uri.decode(URI).replace("file://",""));
     }
 
     public static String PathToURI(String path) {



More information about the Android mailing list