[Android] VideoGridList: show the group list as a secondary fragment

Adrien Maglo git at videolan.org
Fri Feb 21 13:33:13 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Fri Feb 21 13:33:07 2014 +0100| [bea806fc41e23ad1516ea65d2adab9bdaac6d292] | committer: Adrien Maglo

VideoGridList: show the group list as a secondary fragment

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java           |    6 +++++-
 .../src/org/videolan/vlc/gui/video/VideoGridFragment.java        |    6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 8fa935f..a0c307d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -38,6 +38,7 @@ import org.videolan.vlc.gui.audio.AudioAlbumsSongsFragment;
 import org.videolan.vlc.gui.audio.AudioPlayer;
 import org.videolan.vlc.gui.audio.EqualizerFragment;
 import org.videolan.vlc.gui.video.MediaInfoFragment;
+import org.videolan.vlc.gui.video.VideoGridFragment;
 import org.videolan.vlc.gui.video.VideoListAdapter;
 import org.videolan.vlc.interfaces.ISortable;
 import org.videolan.vlc.widget.SlidingPaneLayout;
@@ -116,7 +117,8 @@ public class MainActivity extends SherlockFragmentActivity {
     private String mCurrentFragment;
     private String mPreviousFragment;
     private List<String> secondaryFragments = Arrays.asList("albumsSongs", "equalizer",
-                                                            "about", "search", "mediaInfo");
+                                                            "about", "search", "mediaInfo",
+                                                            "videoGroupList");
     private HashMap<String, Fragment> mSecondaryFragments = new HashMap<String, Fragment>();
 
     private SharedPreferences mSettings;
@@ -491,6 +493,8 @@ public class MainActivity extends SherlockFragmentActivity {
             f = new SearchFragment();
         } else if(id.equals("mediaInfo")) {
             f = new MediaInfoFragment();
+        } else if(id.equals("videoGroupList")) {
+            f = new VideoGridFragment();
         }
         else {
             throw new IllegalArgumentException("Wrong fragment id.");
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 0898c6b..fd6415d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -257,9 +257,9 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
     public void onGridItemClick(GridView l, View v, int position, long id) {
         Media media = (Media) getListAdapter().getItem(position);
         if (media instanceof MediaGroup) {
-            VideoGridFragment videoList = new VideoGridFragment();
-            videoList.setGroup(media.getTitle());
-            MainActivity.ShowFragment(getActivity(), "videolist", videoList);
+            MainActivity activity = (MainActivity)getActivity();
+            VideoGridFragment frag = (VideoGridFragment)activity.showSecondaryFragment("videoGroupList");
+            frag.setGroup(media.getTitle());
         }
         else
             playVideo(media, false);



More information about the Android mailing list