[Android] MediaBrowser: add an interact option in browse()
Thomas Guillem
git at videolan.org
Thu Feb 4 15:28:43 CET 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 3 18:57:23 2016 +0100| [060a57480d9edea0640f3cabfa5387c23296b4cc] | committer: Thomas Guillem
MediaBrowser: add an interact option in browse()
> https://code.videolan.org/videolan/vlc-android/commit/060a57480d9edea0640f3cabfa5387c23296b4cc
---
.../src/org/videolan/libvlc/util/MediaBrowser.java | 20 +++++++++++++-------
.../videolan/vlc/gui/audio/AudioBrowserFragment.java | 2 +-
.../vlc/gui/browser/BaseBrowserFragment.java | 6 +++---
.../vlc/gui/tv/browser/BrowserGridFragment.java | 2 +-
.../vlc/gui/tv/browser/SortedBrowserFragment.java | 2 +-
5 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java b/libvlc/src/org/videolan/libvlc/util/MediaBrowser.java
index fb15ab1..770afed 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,17 +177,21 @@ 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);
+ media.addOption(IGNORE_LIST_OPTION + mIgnoreList);
+ int flags = Media.Parse.ParseNetwork;
+ if (interact)
+ flags |= Media.Parse.DoInteract;
reset();
mBrowserMediaList = media.subItems();
mBrowserMediaList.setEventListener(mBrowserMediaListEventListener);
- media.parseAsync(Media.Parse.ParseNetwork);
+ media.parseAsync(flags);
mMedia = media;
}
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..66b0d08 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), true);
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(), false);
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(), false);
} 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