[Android] [PATCH] Pass the title as well when switiching vout

Edward Wang edward.c.wang at compdigitec.com
Thu Aug 23 17:05:31 CEST 2012


---
 vlc-android/src/org/videolan/vlc/AudioService.java |    2 +-
 .../vlc/gui/video/VideoPlayerActivity.java         |   13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java
index 552cc66..55ff2c5 100644
--- a/vlc-android/src/org/videolan/vlc/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java
@@ -313,7 +313,7 @@ public class AudioService extends Service {
         if(mCurrentMedia == null) return;
 
         // Switch to the video player & don't lose the currently playing stream
-        VideoPlayerActivity.start(VLCApplication.getAppContext(), mCurrentMedia.getLocation(), true);
+        VideoPlayerActivity.start(VLCApplication.getAppContext(), mCurrentMedia.getLocation(), mCurrentMedia.getTitle(), true);
     }
 
     private void executeUpdate() {
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 3263b9f..3a494d1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -357,12 +357,13 @@ public class VideoPlayerActivity extends Activity {
     }
 
     public static void start(Context context, String location) {
-        start(context, location, false);
+        start(context, location, null, false);
     }
 
-    public static void start(Context context, String location, Boolean dontParse) {
+    public static void start(Context context, String location, String title, Boolean dontParse) {
         Intent intent = new Intent(context, VideoPlayerActivity.class);
         intent.putExtra("itemLocation", location);
+        intent.putExtra("itemTitle", title);
         intent.putExtra("dontParse", dontParse);
 
         if (dontParse)
@@ -1124,8 +1125,9 @@ public class VideoPlayerActivity extends Activity {
      */
     private void load() {
         mLocation = null;
-        String title = null;
+        String title = getResources().getString(R.string.title);
         boolean dontParse = false;
+        String itemTitle = null;
 
         if (getIntent().getAction() != null
                 && getIntent().getAction().equals(Intent.ACTION_VIEW)) {
@@ -1134,6 +1136,7 @@ public class VideoPlayerActivity extends Activity {
         } else if(getIntent().getExtras() != null) {
             /* Started from VideoListActivity */
             mLocation = getIntent().getExtras().getString("itemLocation");
+            itemTitle = getIntent().getExtras().getString("itemTitle");
             dontParse = getIntent().getExtras().getBoolean("dontParse");
         }
 
@@ -1156,7 +1159,9 @@ public class VideoPlayerActivity extends Activity {
                 if (dotIndex != -1)
                     title = title.substring(0, dotIndex);
             }
-            mTitle.setText(title);
+        } else if(itemTitle != null) {
+            title = itemTitle;
         }
+        mTitle.setText(title);
     }
 }
-- 
1.7.5.4



More information about the Android mailing list