[Android] Fix TV build

Geoffrey Métais git at videolan.org
Tue Dec 22 10:44:17 CET 2015


vlc-android | branch: 1.7.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Dec 22 10:43:13 2015 +0100| [5eb2f1aba600c959ecaae15dc837a10fb01334d6] | committer: Geoffrey Métais

Fix TV build

> https://code.videolan.org/videolan/vlc-android/commit/5eb2f1aba600c959ecaae15dc837a10fb01334d6
---

 .../videolan/vlc/gui/tv/browser/BrowserGridFragment.java   | 14 +++++++++++---
 .../vlc/gui/tv/browser/NetworkBrowserFragment.java         | 14 +++++++++++---
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
index a188c1b..3ec3fd7 100644
--- a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
+++ b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/BrowserGridFragment.java
@@ -34,12 +34,13 @@ import android.support.v17.leanback.widget.RowPresenter;
 
 import org.videolan.libvlc.Media;
 import org.videolan.libvlc.util.MediaBrowser;
-import org.videolan.vlc.media.MediaWrapper;
-import org.videolan.vlc.gui.helpers.MediaComparators;
+import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.gui.browser.BaseBrowserFragment;
+import org.videolan.vlc.gui.helpers.MediaComparators;
 import org.videolan.vlc.gui.tv.DetailsActivity;
 import org.videolan.vlc.gui.tv.MediaItemDetails;
 import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
+import org.videolan.vlc.media.MediaWrapper;
 import org.videolan.vlc.util.VLCInstance;
 
 import java.util.ArrayList;
@@ -52,6 +53,13 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
     ArrayList<MediaWrapper> mMediaList = null;
     private MediaWrapper mItemSelected;
 
+    private static MediaBrowser.Discover DISCOVER_LIST[] = BuildConfig.DEBUG ? new MediaBrowser.Discover[] {
+            MediaBrowser.Discover.UPNP,
+            MediaBrowser.Discover.SMB,
+    } : new MediaBrowser.Discover[] {
+            MediaBrowser.Discover.UPNP,
+    };
+
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         if (savedInstanceState != null){
@@ -73,7 +81,7 @@ public class BrowserGridFragment extends GridFragment implements MediaBrowser.Ev
                 if (mUri != null)
                     mMediaBrowser.browse(mUri);
                 else
-                    mMediaBrowser.discoverNetworkShares();
+                    mMediaBrowser.discoverNetworkShares(DISCOVER_LIST);
                 ((BrowserActivityInterface)getActivity()).showProgress(true);
             }
         }
diff --git a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
index 2d32494..1c2dc3d 100644
--- a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
+++ b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/browser/NetworkBrowserFragment.java
@@ -42,17 +42,18 @@ import android.support.v4.util.ArrayMap;
 
 import org.videolan.libvlc.Media;
 import org.videolan.libvlc.util.MediaBrowser;
-import org.videolan.vlc.media.MediaWrapper;
+import org.videolan.vlc.BuildConfig;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
-import org.videolan.vlc.gui.helpers.MediaComparators;
 import org.videolan.vlc.gui.browser.BaseBrowserFragment;
+import org.videolan.vlc.gui.helpers.MediaComparators;
 import org.videolan.vlc.gui.tv.CardPresenter;
 import org.videolan.vlc.gui.tv.DetailsActivity;
 import org.videolan.vlc.gui.tv.MediaItemDetails;
 import org.videolan.vlc.gui.tv.TvUtil;
 import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
 import org.videolan.vlc.gui.tv.browser.interfaces.BrowserFragmentInterface;
+import org.videolan.vlc.media.MediaWrapper;
 import org.videolan.vlc.util.VLCInstance;
 import org.videolan.vlc.util.WeakHandler;
 
@@ -67,6 +68,13 @@ public class NetworkBrowserFragment extends BrowseFragment implements BrowserFra
     public static final String SELECTED_ITEM = "selected";
     public static int UPDATE_DISPLAY = 1;
 
+    private static MediaBrowser.Discover DISCOVER_LIST[] = BuildConfig.DEBUG ? new MediaBrowser.Discover[] {
+            MediaBrowser.Discover.UPNP,
+            MediaBrowser.Discover.SMB,
+    } : new MediaBrowser.Discover[] {
+            MediaBrowser.Discover.UPNP,
+    };
+
     ArrayObjectAdapter mAdapter = new ArrayObjectAdapter(new ListRowPresenter());
     private MediaBrowser mMediaBrowser;
     private MediaWrapper mItemSelected;
@@ -135,7 +143,7 @@ public class NetworkBrowserFragment extends BrowseFragment implements BrowserFra
             if (mUri != null)
                 mMediaBrowser.browse(mUri);
             else
-                mMediaBrowser.discoverNetworkShares();
+                mMediaBrowser.discoverNetworkShares(DISCOVER_LIST);
             ((BrowserActivityInterface)getActivity()).showProgress(true);
         }
     }



More information about the Android mailing list