[Android] decode title in VideoPlayerActivity

Sébastien Toque git at videolan.org
Tue Apr 3 21:35:11 CEST 2012


android | branch: master | Sébastien Toque <xilasz at gmail.com> | Tue Apr  3 21:27:01 2012 +0200| [255db4d2a17fc7a0cdb829d7015fcd5a3904475e] | committer: Sébastien Toque

decode title in VideoPlayerActivity

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

 .../vlc/gui/video/VideoPlayerActivity.java         |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index cf8788a..c70efae 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -22,6 +22,7 @@ package org.videolan.vlc.gui.video;
 
 import java.io.File;
 import java.lang.reflect.Method;
+import java.net.URLDecoder;
 
 import org.videolan.vlc.EventManager;
 import org.videolan.vlc.LibVLC;
@@ -787,10 +788,13 @@ public class VideoPlayerActivity extends Activity {
             if (lastTime > 0 && location.equals(lastLocation))
                 mLibVLC.setTime(lastTime);
 
-            title = new File(location).getName();
-            int dotIndex = title.lastIndexOf('.');
-            if (dotIndex != -1)
-                title = title.substring(0, dotIndex);
+            title = URLDecoder.decode(location);
+            if (title.startsWith("file:")) {
+                title = new File(title).getName();
+                int dotIndex = title.lastIndexOf('.');
+                if (dotIndex != -1)
+                    title = title.substring(0, dotIndex);
+            }
             mTitle.setText(title);
         }
     }



More information about the Android mailing list