[Android] Directory view : add video information option

Alexandre Perraud git at videolan.org
Thu May 28 17:00:12 CEST 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Thu May 28 16:58:31 2015 +0200| [2f3f79e412a6f830166e2c49816de2e27befad00] | committer: Alexandre Perraud

Directory view : add video information option

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

 vlc-android/res/menu/directory_view_file.xml              |    7 +++++--
 .../org/videolan/vlc/gui/browser/BaseBrowserFragment.java |   13 ++++++++++++-
 .../src/org/videolan/vlc/gui/video/MediaInfoFragment.java |    2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/menu/directory_view_file.xml b/vlc-android/res/menu/directory_view_file.xml
index 339aab3..33cf628 100644
--- a/vlc-android/res/menu/directory_view_file.xml
+++ b/vlc-android/res/menu/directory_view_file.xml
@@ -7,8 +7,11 @@
         android:id="@+id/directory_view_append"
         android:title="@string/append" />
     <item
-	    android:id="@+id/directory_view_delete"
-	    android:title="@string/delete" />
+        android:id="@+id/directory_view_delete"
+        android:title="@string/delete" />
+    <item
+        android:id="@+id/directory_view_info"
+        android:title="@string/info" />
     <item
         android:id="@+id/directory_view_play_audio"
         android:title="@string/play_as_audio" />
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
index e56e474..fc29694 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -23,6 +23,7 @@
 package org.videolan.vlc.gui.browser;
 
 import android.annotation.TargetApi;
+import android.content.Intent;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Message;
@@ -53,6 +54,7 @@ import org.videolan.vlc.MediaWrapper;
 import org.videolan.vlc.PlaybackServiceController;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.gui.SecondaryActivity;
 import org.videolan.vlc.gui.dialogs.CommonDialogs;
 import org.videolan.vlc.gui.DividerItemDecoration;
 import org.videolan.vlc.gui.MainActivity;
@@ -339,9 +341,12 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
     protected void setContextMenu(MenuInflater inflater, Menu menu, int position) {
         MediaWrapper mw = (MediaWrapper) mAdapter.getItem(position);
         boolean canWrite = Util.canWrite(mw.getLocation());
-        if (mw.getType() == MediaWrapper.TYPE_AUDIO || mw.getType() == MediaWrapper.TYPE_VIDEO) {
+        boolean isAudio = mw.getType() == MediaWrapper.TYPE_AUDIO;
+        boolean isVideo = mw.getType() == MediaWrapper.TYPE_VIDEO;
+        if (isAudio || isVideo) {
             inflater.inflate(R.menu.directory_view_file, menu);
             menu.findItem(R.id.directory_view_delete).setVisible(canWrite);
+            menu.findItem(R.id.directory_view_info).setVisible(isVideo);
         } else if (mw.getType() == MediaWrapper.TYPE_DIR) {
             boolean isEmpty = mMediaLists.get(position) == null || mMediaLists.get(position).isEmpty();
             if (canWrite || !isEmpty) {
@@ -411,6 +416,12 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
                         });
                 alertDialog.show();
                 return true;
+            case  R.id.directory_view_info:
+                Intent i = new Intent(getActivity(), SecondaryActivity.class);
+                i.putExtra("fragment", "mediaInfo");
+                i.putExtra("param", mw.getLocation());
+                startActivity(i);
+                return true;
             case R.id.directory_view_play_audio:
                 PlaybackServiceController.getInstance().load(mw);
                 return true;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
index fc6074f..f9953d7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
@@ -161,7 +161,7 @@ public class MediaInfoFragment extends ListFragment {
     public void setMediaLocation(String MRL) {
         if (MRL == null)
             return;
-        mItem = MediaLibrary.getInstance().getMediaItem(MRL);
+        mItem = MediaLibrary.getInstance().getMediaItem(Uri.decode(MRL));
     }
 
     Runnable mCheckFile = new Runnable() {



More information about the Android mailing list