[Android] Restrict video playlists from Android 2.x devices

Geoffrey Métais git at videolan.org
Thu Mar 3 17:55:46 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar  3 14:41:59 2016 +0100| [a17f6fb072f8bf6d03ad334e32856675e3ace05b] | committer: Geoffrey Métais

Restrict video playlists from Android 2.x devices

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

 vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java | 5 +++++
 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java        | 4 +++-
 vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java    | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 5683459..62c091c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -31,6 +31,7 @@ import android.view.View;
 import android.view.ViewGroup;
 
 import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.databinding.BrowserItemSeparatorBinding;
@@ -375,6 +376,10 @@ public class BaseBrowserAdapter extends  RecyclerView.Adapter<RecyclerView.ViewH
         if (mw.getType() == MediaWrapper.TYPE_DIR)
             fragment.browse(mw, holder.getAdapterPosition(), true);
         else  if (mw.getType() == MediaWrapper.TYPE_AUDIO || mw.getType() == MediaWrapper.TYPE_VIDEO) {
+            if (mw.getType() == MediaWrapper.TYPE_VIDEO && !AndroidUtil.isHoneycombOrLater()) {
+                MediaUtils.openMedia(holder.itemView.getContext(), mw);
+                return;
+            }
             int position = 0;
             LinkedList<MediaWrapper> mediaLocations = new LinkedList<MediaWrapper>();
             MediaWrapper mediaItem;
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 daa2f61..12e2199 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.java
@@ -45,6 +45,7 @@ import android.view.ViewGroup;
 import android.widget.TextView;
 
 import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.libvlc.util.MediaBrowser;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
@@ -472,8 +473,9 @@ public abstract class BaseBrowserFragment extends MediaBrowserFragment implement
             }
             case R.id.directory_view_play_folder:
                 ArrayList<MediaWrapper> mediaList = new ArrayList<MediaWrapper>();
+                boolean videoPlaylist = AndroidUtil.isHoneycombOrLater();
                 for (MediaWrapper mediaItem : mFoldersContentLists.get(position)){
-                    if (mediaItem.getType() == MediaWrapper.TYPE_AUDIO || mediaItem.getType() == MediaWrapper.TYPE_VIDEO)
+                    if (mediaItem.getType() == MediaWrapper.TYPE_AUDIO || (videoPlaylist && mediaItem.getType() == MediaWrapper.TYPE_VIDEO))
                         mediaList.add(mediaItem);
                 }
                 MediaUtils.openList(getActivity(), mediaList, 0);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 9d26c8a..cb2abfa 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -47,6 +47,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.MainActivity;
@@ -359,6 +360,8 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
         menu.findItem(R.id.video_list_info).setVisible(hasInfo);
         menu.findItem(R.id.video_list_delete).setVisible(
                 FileUtils.canWrite(mediaWrapper.getLocation()));
+        if (!AndroidUtil.isHoneycombOrLater())
+            menu.findItem(R.id.video_list_play_all).setVisible(false);
     }
 
     @Override



More information about the Android mailing list