[Android] Fix MediaGroup opening

Geoffrey Métais git at videolan.org
Fri Nov 13 14:07:34 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Nov 13 14:06:41 2015 +0100| [3643f3325d075f332ebd7dbb58f576897766faf8] | committer: Geoffrey Métais

Fix MediaGroup opening

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

 .../org/videolan/vlc/gui/video/VideoGridFragment.java   |   15 +--------------
 .../org/videolan/vlc/gui/video/VideoListAdapter.java    |   11 +++++++++--
 2 files changed, 10 insertions(+), 16 deletions(-)

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 b16bbfc..9e8fa21 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -74,7 +74,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
-public class VideoGridFragment extends MediaBrowserFragment implements ISortable, IVideoBrowser, SwipeRefreshLayout.OnRefreshListener, AdapterView.OnItemClickListener {
+public class VideoGridFragment extends MediaBrowserFragment implements ISortable, IVideoBrowser, SwipeRefreshLayout.OnRefreshListener {
 
     public final static String TAG = "VLC/VideoListFragment";
 
@@ -256,19 +256,6 @@ public class VideoGridFragment extends MediaBrowserFragment implements ISortable
                 sidePadding, mGridView.getPaddingBottom());
     }
 
-    @Override
-    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-        MediaWrapper media = mVideoAdapter.getItem(position);
-        if (media == null)
-            return;
-        if (media instanceof MediaGroup) {
-            MainActivity activity = (MainActivity)getActivity();
-            activity.showSecondaryFragment(SecondaryActivity.VIDEO_GROUP_LIST, media.getTitle());
-        }
-        else
-            playVideo(media, false);
-    }
-
     protected void playVideo(MediaWrapper media, boolean fromStart) {
         media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
         VideoPlayerActivity.start(getActivity(), media.getUri(), fromStart);
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index c741539..4a80281 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -36,11 +36,12 @@ import android.widget.ImageView;
 import org.videolan.vlc.BR;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.gui.MainActivity;
+import org.videolan.vlc.gui.SecondaryActivity;
 import org.videolan.vlc.gui.helpers.AsyncImageLoader;
 import org.videolan.vlc.gui.helpers.BitmapCache;
 import org.videolan.vlc.gui.helpers.BitmapUtil;
 import org.videolan.vlc.media.MediaGroup;
-import org.videolan.vlc.media.MediaUtils;
 import org.videolan.vlc.media.MediaWrapper;
 import org.videolan.vlc.util.Strings;
 
@@ -330,7 +331,13 @@ public class VideoListAdapter extends RecyclerView.Adapter<VideoListAdapter.View
     public class ClickHandler {
         public void onClick(View v){
             MediaWrapper media = mVideos.get(((Integer) v.findViewById(R.id.item_more).getTag()).intValue());
-            MediaUtils.openMedia(v.getContext(), media);
+            if (media instanceof MediaGroup) {
+                MainActivity activity = (MainActivity) mFragment.getActivity();
+                activity.showSecondaryFragment(SecondaryActivity.VIDEO_GROUP_LIST, media.getTitle());
+            } else {
+                media.removeFlags(MediaWrapper.MEDIA_FORCE_AUDIO);
+                VideoPlayerActivity.start(v.getContext(), media.getUri(), media.getTitle());
+            }
         }
         public void onMoreClick(View v){
             if (mFragment == null)



More information about the Android mailing list