[Android] MediaBrowser: add an interact option in browse()

Thomas Guillem git at videolan.org
Wed Feb 3 18:57:55 CET 2016


vlc-android | branch: dialog | Thomas Guillem <thomas at gllm.fr> | Wed Feb  3 18:57:23 2016 +0100| [11dba9dd05bc31a3a026a36d994d0debbbfb0063] | committer: Thomas Guillem

MediaBrowser: add an interact option in browse()

> https://code.videolan.org/videolan/vlc-android/commit/11dba9dd05bc31a3a026a36d994d0debbbfb0063
---

 libvlc/src/org/videolan/libvlc/util/MediaBrowser.java     | 15 ++++++++++-----
 .../org/videolan/vlc/gui/audio/AudioBrowserFragment.java  |  2 +-
 .../org/videolan/vlc/gui/browser/BaseBrowserFragment.java |  6 +++---
 .../videolan/vlc/gui/tv/browser/BrowserGridFragment.java  |  2 +-
 .../vlc/gui/tv/browser/SortedBrowserFragment.java         |  2 +-
 5 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
index fb15ab1..37d0d33 100644
--- a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
+++ b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
@@ -153,10 +153,11 @@ public class MediaBrowser {
      * Browse to the specified local path starting with '/'.
      *
      * @param path
+     * @param interact true if browsing could fire up dialogs
      */
-    public synchronized void browse(String path) {
+    public synchronized void browse(String path, boolean interact) {
         final Media media = new Media(mLibVlc, path);
-        browse(media);
+        browse(media, interact);
         media.release();
     }
 
@@ -164,10 +165,11 @@ public class MediaBrowser {
      * Browse to the specified uri.
      *
      * @param uri
+     * @param interact true if browsing could fire up dialogs
      */
-    public synchronized void browse(Uri uri) {
+    public synchronized void browse(Uri uri, boolean interact) {
         final Media media = new Media(mLibVlc, uri);
-        browse(media);
+        browse(media, interact);
         media.release();
     }
 
@@ -175,13 +177,16 @@ public class MediaBrowser {
      * Browse to the specified media.
      *
      * @param media Can be a media returned by MediaBrowser.
+     * @param interact true if browsing could fire up dialogs
      */
-    public synchronized void browse(Media media) {
+    public synchronized void browse(Media media, boolean interact) {
         /* media can be associated with a medialist,
          * so increment ref count in order to don't clean it with the medialist
          */
         media.retain();
         media.addOption(IGNORE_LIST_OPTION+mIgnoreList);
+        if (!interact)
+            media.addOption(":no-interact");
         reset();
         mBrowserMediaList = media.subItems();
         mBrowserMediaList.setEventListener(mBrowserMediaListEventListener);
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index e11cb8c..45fee68 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -539,7 +539,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
                     if (medias.size() == 1 && mPlaylistAdapter.getMedias(position).get(0).getType() == MediaWrapper.TYPE_PLAYLIST) {
                         if (mMediaBrowser == null)
                             mMediaBrowser = new MediaBrowser(VLCInstance.get(), this);
-                        mMediaBrowser.browse(mPlaylistAdapter.getMedias(position).get(0).getUri());
+                        mMediaBrowser.browse(mPlaylistAdapter.getMedias(position).get(0).getUri(), true);
                         return true;
                     } else
                         adapter = mPlaylistAdapter;
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 497b3d5..6c0864e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -315,7 +315,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
         if (mRoot)
             browseRoot();
         else
-            mMediaBrowser.browse(mCurrentMedia != null ? mCurrentMedia.getUri() : Uri.parse(mMrl));
+            mMediaBrowser.browse(mCurrentMedia != null ? mCurrentMedia.getUri() : Uri.parse(mMrl), false);
         mHandler.sendEmptyMessageDelayed(BrowserFragmentHandler.MSG_SHOW_LOADING, 300);
     }
 
@@ -504,7 +504,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
                 mw = null;
             if (mw != null){
                 if (mw.getType() == MediaWrapper.TYPE_DIR || mw.getType() == MediaWrapper.TYPE_PLAYLIST){
-                    mMediaBrowser.browse(mw.getUri());
+                    mMediaBrowser.browse(mw.getUri(), true);
                     return;
                 }
             }
@@ -557,7 +557,7 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
 
             if (mw != null) {
                 if (mCurrentParsedPosition < mAdapter.getItemCount()) {
-                    mMediaBrowser.browse(mw.getUri());
+                    mMediaBrowser.browse(mw.getUri(), true);
                 } else {
                     mCurrentParsedPosition = -1;
                     releaseBrowser();
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
index 9ded0eb..928d18b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
@@ -72,7 +72,7 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
             if (mMediaBrowser != null) {
                 mMediaList = new ArrayList<MediaWrapper>();
                 if (mUri != null)
-                    mMediaBrowser.browse(mUri);
+                    mMediaBrowser.browse(mUri, true);
                 else
                     mMediaBrowser.discoverNetworkShares(Util.NETWORK_DISCOVER_LIST);
                 ((BrowserActivityInterface)getActivity()).showProgress(true);
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index 05dd918..945e558 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -142,7 +142,7 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
         mMediaBrowser = new MediaBrowser(VLCInstance.get(), this);
         if (mMediaBrowser != null) {
             if (mUri != null)
-                mMediaBrowser.browse(mUri);
+                mMediaBrowser.browse(mUri, true);
             else
                 browseRoot();
             ((BrowserActivityInterface)getActivity()).showProgress(true);



More information about the Android mailing list