[Android] TV: Restore 'Play All' option in browsers

Geoffrey Métais git at videolan.org
Fri May 25 11:30:49 CEST 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri May 25 11:30:27 2018 +0200| [a8cac232fea8c7f7300290cb3bb413eeea6e8e5f] | committer: Geoffrey Métais

TV: Restore 'Play All' option in browsers

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

 .../videolan/vlc/gui/tv/browser/MediaSortedFragment.java   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaSortedFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaSortedFragment.java
index a9d64dff9..64c566650 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaSortedFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/MediaSortedFragment.java
@@ -43,6 +43,8 @@ import org.videolan.vlc.VLCApplication;
 import org.videolan.vlc.gui.tv.browser.interfaces.BrowserActivityInterface;
 import org.videolan.vlc.util.VLCInstance;
 
+import java.util.ArrayList;
+
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
 public abstract class MediaSortedFragment extends SortedBrowserFragment implements MediaBrowser.EventListener {
     protected Uri mUri;
@@ -103,6 +105,18 @@ public abstract class MediaSortedFragment extends SortedBrowserFragment implemen
     public void onPause(){
         super.onPause();
         ((BrowserActivityInterface)getActivity()).updateEmptyView(false);
+        saveCurrentList();
+    }
+
+    private void saveCurrentList() {
+        final ArrayList<MediaWrapper> list = new ArrayList<>();
+        for (ListItem listItem: mMediaItemMap.values()) {
+            for (MediaWrapper mw : listItem.mediaList) {
+                if (mw.getType() == MediaWrapper.TYPE_AUDIO
+                        || mw.getType() == MediaWrapper.TYPE_VIDEO) list.add(mw);
+            }
+        }
+        if (!list.isEmpty()) VLCApplication.storeData(CURRENT_BROWSER_LIST, list);
     }
 
     @Override



More information about the Android mailing list